Bundle OpenAI API client. Supports Chat Completions (GPT-4o, o1, etc.), Embeddings, Image Generation (DALL-E), and function/tool calling. Set OPENAI_API_KEY environment variable before use. Compile with -lib openai.
Message
Create messages within threads
Inherits: EndPoint
Operations
Create # function
Loads a message
function : Create(role:String, content:String, thread:API.OpenAI.Thread, token:String) ~ API.OpenAI.MessageParameters
| Name | Type | Description |
|---|---|---|
| role | String | role of the entity that is creating the message |
| content | String | content of the message. |
| thread | Thread | thread associated with message |
| token | String | API token |
Return
| Type | Description |
|---|---|
| Message | loaded Message |
Create # function
Create a message.
function : Create(role:String, content:String, thread:API.OpenAI.Thread, files:Vector<API.OpenAI.File>, token:String) ~ API.OpenAI.MessageParameters
| Name | Type | Description |
|---|---|---|
| role | String | role of the entity that is creating the message |
| content | String | content of the message. |
| thread | Thread | thread associated with message |
| files | Vector<APIOpenAIFile> | list to attach to the message |
| token | String | API token |
Return
| Type | Description |
|---|---|
| Message | newly created message |
GetContents #
Get the content of the message
method : public : GetContents() ~ ContentsReturn
| Type | Description |
|---|---|
| Contents | list of messages with roles |
GetCreatedAt #
Unix timestamp (in seconds) of when the object instance was created
method : public : GetCreatedAt() ~ IntReturn
| Type | Description |
|---|---|
| Int | time with the object instance was created |
GetId #
Get object instance API ID
method : public : GetId() ~ StringReturn
| Type | Description |
|---|---|
| String | instance ID |
GetObject #
Get the object type
method : public : GetObject() ~ StringReturn
| Type | Description |
|---|---|
| String | object type |
GetRole #
Get the role of the entity that is creating the message
method : public : GetRole() ~ StringReturn
| Type | Description |
|---|---|
| String | role of the entity that is creating the message |
GetThreadId #
Get the ID of the thread associated with message
method : public : GetThreadId() ~ StringReturn
| Type | Description |
|---|---|
| String | thread ID |
ListMessages # function
Loads a messages associated with thread
function : ListMessages(thread:API.OpenAI.Thread, token:String) ~ Vector<API.OpenAI.Message>Parameters
| Name | Type | Description |
|---|---|---|
| thread | Thread | thread associated with message |
| token | String | API token |
Return
| Type | Description |
|---|---|
| Vector<APIOpenAIMessage> | messages associated with thread |