1#if !defined(_LLMCONNECTION_H_)
2#define _LLMCONNECTION_H_
191 const std::string&
getName()
const {
return name; }
203 const std::vector<LLMHeader>&
getHeaders()
const {
return headers; }
229 void* userData, std::string* fullReply = NULL);
240 std::string applyTemplates(
const std::string& text,
const char* input)
const;
242 static bool extractJSONPath(
const char* json, uint32 size,
const char* path,
248 LLMResult resolveStreamTransport(
const char* transportAttr);
249 void resolveSecret();
250 static bool nodeHasInlineSecret(
const XMLNode& node);
255 void* userData, std::string* fullReply);
263 std::string vendorTypeName;
264 std::string endpoint;
266 bool globalConnection;
267 std::string schemaVersion;
268 std::string apiKeyRef;
269 std::string secretsFile;
270 std::string apiKeySecret;
271 std::string requestTemplate;
272 std::string responseTemplate;
273 std::vector<LLMHeader> headers;
276 std::vector<std::string> models;
277 std::string selectedModel;
281 void accountUsageJSON(
const char* json, uint32 size);
284 void notifyOwnerEnded();
291 volatile bool cancelRequested;
292 uint64 connectTimeMS;
Cross-platform utility toolbox for CMSDK: threading, synchronization, shared memory,...
const std::string & getVendorTypeName() const
LLMResult getLastError() const
const std::string & getName() const
LLMResult interact(const char *input, std::string &reply)
LLMResult configure(const XMLNode &llmNode)
const std::string & getSelectedModel() const
const std::vector< LLMHeader > & getHeaders() const
void setOwner(void *owner, LLMOwnerEndCallback callback)
LLMResult selectModel(const char *modelName)
LLMResult configureFromString(const char *xml)
const std::string & getEndpoint() const
const LLMConstraints & getConstraints() const
LLMVendorType getVendorType() const
LLMResult interactStream(const char *input, LLMStreamCallback callback, void *userData, std::string *fullReply=NULL)
LLMStreamTransport getStreamTransport() const
std::vector< std::string > listModels() const
const std::string & getSchemaVersion() const
bool hasResolvedSecret() const
const std::string & getResponseTemplate() const
const std::string & getRequestTemplate() const
bool isConfigured() const
const std::string & getAPIKeyRef() const
Central owner of all channels, listeners and connections in a process.
const char * LLMResultText(LLMResult result)
const char * LLMStreamTransportText(LLMStreamTransport transport)
const char * LLMVendorTypeText(LLMVendorType type)
bool(* LLMStreamCallback)(const char *token, uint32 size, void *userData)
void(* LLMOwnerEndCallback)(void *owner, LLMConnection *connection, const LLMStats &finalStats)
@ LLM_ERR_CONFIG_NO_VENDOR
@ LLM_ERR_CONFIG_NO_ENDPOINT
@ LLM_ERR_SECRET_UNRESOLVED
@ LLM_ERR_CONFIG_BAD_TRANSPORT
@ LLM_ERR_CONFIG_UNKNOWN_VENDOR
@ LLM_ERR_CONFIG_INLINE_SECRET
@ LLM_ERR_NOT_IMPLEMENTED
@ LLM_ERR_HTTP_UNREACHABLE
@ LLM_ERR_STREAM_CANCELLED
int32 maxTokensPerRequest
Small recursive XML DOM parser (XMLNode) used by CMSDK for all PsySpec XML parsing.