Qore OpenAiRestClient Module Reference 1.0
Loading...
Searching...
No Matches
OpenAiRestClient::OpenAiRestClient Class Reference

this class provides the REST client API for communication with OpenAi servers More...

Public Member Functions

 constructor (hash< auto > opts, *softbool do_not_connect)
 creates the object with the given options
 

Static Public Member Functions

static hash< auto > getOptions (hash< auto > opts)
 returns options for OpenAiRestClient::OpenAiRestClient::constructor()
 

Public Attributes

const DefaultApiVersion = "v1"
 Default OpenAi API version.
 
const DefaultOptions = ...
 Default constructor options.
 
const DefaultUrl = "https://api.openai.com"
 Default OpenAi REST API URL.
 

Protected Attributes

string api
 The API version in use.
 

Detailed Description

this class provides the REST client API for communication with OpenAi servers

You must use an API key in the 'token' option to call OpenAi APIs

Member Function Documentation

◆ constructor()

OpenAiRestClient::OpenAiRestClient::constructor ( hash< auto > opts,
*softbool do_not_connect )

creates the object with the given options

Example:
OpenAiRestClient rest(opts);
Parameters
optsvalid options are all the options for the RestClient class; note that the URL is set by default if not provided (see DefaultUrl)
do_not_connectif False (the default), then a connection will be immediately established to the remote server
Exceptions
RESTCLIENT-ERRORinvalid option passed to constructor, unsupported data serialization, etc