39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#pragma once
|
|
|
|
// The ONE table of REST calls this module makes. The shapes are OpenAI's
|
|
// (every row is an OpenAI operation); providers differ only in base URL, auth
|
|
// and quirks, which live in registry.cpp. tools/check_spec.py checks every
|
|
// row against OpenAI's published OpenAPI document. Code builds every path
|
|
// from this table, never from a literal.
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
#include "clients/request.h"
|
|
|
|
namespace molo::compat {
|
|
|
|
enum class Call { kChat, kEmbeddings, kModels, kImages, kTranscribe, kSpeech };
|
|
|
|
struct CallSpec {
|
|
Call call;
|
|
const char* http_method; // GET POST
|
|
const char* path; // from the provider base URL
|
|
const char* operation_id; // OpenAI OpenAPI operationId
|
|
const char* request; // OpenAI request schema name ("" for GET)
|
|
const char* body_fields; // comma list: request body fields we send
|
|
const char* response; // OpenAI response schema name
|
|
const char* fields_read; // comma list: response fields we read
|
|
unsigned feature; // registry Feature bit a row must claim
|
|
const char* feature_name;
|
|
};
|
|
|
|
struct Calls {
|
|
static const CallSpec& spec_of(Call call);
|
|
static clients::Method method_of(Call call);
|
|
static std::size_t count();
|
|
static const CallSpec& at(std::size_t index);
|
|
};
|
|
|
|
} // namespace molo::compat
|