# Chat ## Domain Types ### Completion Message - **CompletionMessage:** `object` A message containing the model's (assistant) response in a chat conversation. - **role:** `"assistant"` Must be "assistant" to identify this as the model's response - `"assistant"` - **content:** `string OR MessageTextContentItem` The content of the model's response. - **UnionMember0:** `string` - `MessageTextContentItem` - **stop\_reason:** `"stop" OR "tool_calls" OR "length"` The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request. - `"stop"` - `"tool_calls"` - `"length"` - **tool\_calls:** `array of object` The tool calls generated by the model, such as function calls. - **id:** `string` The ID of the tool call. - **function:** `object` The function that the model called. - **arguments:** `string` The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - **name:** `string` The name of the function to call. ### Create Chat Completion Response - **CreateChatCompletionResponse:** `object` Response from a chat completion request. - **completion\_message:** `CompletionMessage` The complete response message - **id:** `string` The unique identifier of the chat completion request. - **metrics:** `array of object` - **metric:** `string` - **value:** `number` - **unit:** `string` ### Create Chat Completion Response Stream Chunk - **CreateChatCompletionResponseStreamChunk:** `object` A chunk of a streamed chat completion response. - **event:** `object` The event containing the new content - **delta:** `object OR object` Content generated since last event. This can be one or more tokens, or a tool call. - **Text:** `object` - **text:** `string` - **type:** `"text"` - `"text"` - **ToolCall:** `object` - **function:** `object` - **arguments:** `string` The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - **name:** `string` The name of the function to call. - **type:** `"tool_call"` - `"tool_call"` - **id:** `string` The ID of the tool call. - **event\_type:** `"start" OR "complete" OR "progress" OR "metrics"` Type of the event - `"start"` - `"complete"` - `"progress"` - `"metrics"` - **metrics:** `array of object` - **metric:** `string` - **value:** `number` - **unit:** `string` - **stop\_reason:** `"stop" OR "tool_calls" OR "length"` The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request. - `"stop"` - `"tool_calls"` - `"length"` - **id:** `string` The unique identifier of the chat completion request. ### Message - **Message:** `UserMessage OR SystemMessage OR ToolResponseMessage OR CompletionMessage` A message from the user in a chat conversation. - `UserMessage` - `SystemMessage` - `ToolResponseMessage` - `CompletionMessage` ### Message Image Content Item - **MessageImageContentItem:** `object` A image content item - **image\_url:** `object` Contains either an image URL or a data URL for a base64 encoded image. - **url:** `string` Either a URL of the image or the base64 encoded image data. - **type:** `"image_url"` Discriminator type of the content item. Always "image" - `"image_url"` ### Message Text Content Item - **MessageTextContentItem:** `object` A text content item - **text:** `string` Text content - **type:** `"text"` Discriminator type of the content item. Always "text" - `"text"` ### System Message - **SystemMessage:** `object` A system message providing instructions or context to the model. - **content:** `string OR array of MessageTextContentItem` The content of the system message. - **TextContent:** `string` The text contents of the message. - **ArrayOfContentItems:** `array of MessageTextContentItem` A list of content items, which can include text and other media. Supported content types differ based on model. - **role:** `"system"` Must be "system" to identify this as a system message - `"system"` ### Tool Response Message - **ToolResponseMessage:** `object` A message representing the result of a tool invocation. - **content:** `string OR array of MessageTextContentItem` The content of the user message, which can include text and other media. - **TextContent:** `string` The text contents of the message. - **ArrayOfContentItems:** `array of MessageTextContentItem` A list of content items, which can include text and other media. Supported content types differ based on model. - **role:** `"tool"` Must be "tool" to identify this as a tool response - `"tool"` - **tool\_call\_id:** `string` Unique identifier for the tool call this response is for ### User Message - **UserMessage:** `object` A message from the user in a chat conversation. - **content:** `string OR array of MessageTextContentItem OR MessageImageContentItem` The content of the user message, which can include text and other media. - **TextContent:** `string` The text contents of the message. - **ArrayOfContentItems:** `array of MessageTextContentItem OR MessageImageContentItem` A list of content items, which can include text and other media. Supported content types differ based on model. - `MessageTextContentItem` - `MessageImageContentItem` - **role:** `"user"` Must be "user" to identify this as a user message. - `"user"`