Qore OpenAiDataProvider Module Reference 1.3
Loading...
Searching...
No Matches
OpenAiDataProviderCommon.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
26namespace OpenAiDataProvider {
28class OpenAiDataProviderCommon : public DataProvider::AbstractDataProvider {
29
30public:
32 const DefaultOpenAiUrl = "https://api.openai.com/";
33
36
38 const ConstructorOptions = ...;
39
40
42 const RetrySet = ...;
43
44
46 const MaxIoRetries = 5;
47
49 const AssistantApiHdr = ...;
50
51
52protected:
54 *RestClient::RestClient rest;
55
57 static bool init;
58
60 static Mutex m();
61
62public:
63
65 constructor(RestClient::RestClient rest);
66
67
69 constructor(*hash<auto> options);
70
71
73 setLogger(*LoggerInterface logger);
74
75
77
82 *hash<string, bool> getSupportedReferenceData();
83
84
86
93protected:
94 *list<hash<AllowedValueInfo>> getReferenceDataImpl(string type, *hash<auto> action_opts);
95public:
96
97
99protected:
100 *list<hash<AllowedValueInfo>> getReferenceModels();
101public:
102
103
105protected:
106 *list<hash<AllowedValueInfo>> getReferenceAssistants();
107public:
108
109
111protected:
112 hash<auto> doRestCommand(string method, string path, auto body, *hash<auto> hdr, *reference<hash<auto>> info);
113public:
114
115
117protected:
118 bool retry(hash<ExceptionInfo> ex, reference<int> retries);
119public:
120
121};
122};
The OpenAi data provider common base class.
Definition OpenAiDataProviderCommon.qc.dox.h:28
const AssistantApiHdr
Headers required for the OpenAI assistant API.
Definition OpenAiDataProviderCommon.qc.dox.h:49
static bool init
first time initialization
Definition OpenAiDataProviderCommon.qc.dox.h:57
*RestClient::RestClient rest
The REST client object for API calls.
Definition OpenAiDataProviderCommon.qc.dox.h:54
const RetrySet
IO errors for REST retries.
Definition OpenAiDataProviderCommon.qc.dox.h:42
hash< auto > doRestCommand(string method, string path, auto body, *hash< auto > hdr, *reference< hash< auto > > info)
Makes a REST call and returns the response; handles rate limit responses.
const MaxIoRetries
Max retries.
Definition OpenAiDataProviderCommon.qc.dox.h:46
constructor(*hash< auto > options)
Creates the object from constructor options.
const DefaultOpenAiUrl
The default OpenAi URL.
Definition OpenAiDataProviderCommon.qc.dox.h:32
constructor(RestClient::RestClient rest)
Creates the object.
*list< hash< AllowedValueInfo > > getReferenceModels()
Returns available models.
*list< hash< AllowedValueInfo > > getReferenceDataImpl(string type, *hash< auto > action_opts)
Returns reference data of the given kind if available.
setLogger(*LoggerInterface logger)
Accepts a LoggerInterface object for logging (or clears it)
const DefaultOpenAiApiVersion
The default OpenAi API version.
Definition OpenAiDataProviderCommon.qc.dox.h:35
const ConstructorOptions
Constructor options.
Definition OpenAiDataProviderCommon.qc.dox.h:38
*hash< string, bool > getSupportedReferenceData()
Returns information on supported reference data.
*list< hash< AllowedValueInfo > > getReferenceAssistants()
Returns available assistants.
bool retry(hash< ExceptionInfo > ex, reference< int > retries)
Returns True if the error indicates that the operation should be retried.
static Mutex m()
lock for first time initialization
Qore OpenAiDataProvider module definition.
Definition OpenAiAssistantCreateDataProvider.qc.dox.h:26