ref: c30d74014c8bc587f00ef0d178d1a4f16b448035
dir: /oai.h/
typedef struct OResult OResult;
typedef struct ORequest ORequest;
typedef struct OPrompt OPrompt;
struct OPrompt {
char *role;
char *content;
OPrompt *next;
};
struct ORequest {
char *model;
OPrompt *prompts;
};
struct OResult {
char *role;
char *message;
};
/*
* initoai returns 1 on success. If baseurl or apikey is nil, it'll try to fetch the data
* from the environment variables $oaiurl and $oaikey. Key is optional.
*/
int initoai(char *baseurl, char *apikey);
/*
* makerequest to make the request.
*/
OResult makerequest(ORequest);
/*
* append a prompt to the existing request. You can set the role and the content.
* The content is built from the fmt and the variadic arguments.
*/
int addprompt(ORequest*, char *role, char *fmt, ...);