Type definitions
Language Model Type Definitions
Section titled âLanguage Model Type DefinitionsâInspired by Vercels AI SDK.
Language Model Prompt
Section titled âLanguage Model PromptâConversations with LLMs consist of a series of prompts/messages. Each prompt can be of four types:
- system: Provides context or instructions to the model.
- user: Represents the userâs input or question.
- assistant: Represents the modelâs response.
- tool: Represents a tool call made by the model.
Check the next section for the structure of each type.
// system{ "role": "system", "content": string}// user{ "role": "user", "content": [LanguageModelText | LanguageModelFile]}// assistant{ "role": "assistant", "content": [LanguageModelText | LanguageModelFile | LanguageModelReasoning | LanguageModelToolCall]}// tool{ "role": "tool", "content": [LanguageModelToolResult]}Language Model Content
Section titled âLanguage Model ContentâLanguage Model Text
Section titled âLanguage Model Textâ{ "type": "text", "text": string, "providerOptions": object // Optional provider-specific options}Language Model File
Section titled âLanguage Model Fileâ{ "type": "file", "mediaType": string, // IANA media type (e.g., 'image/png', 'audio/mp3') "data": string, // file content encoded in base64 "filename?": string, // Optional filename for the file "providerOptions": object // Optional provider-specific options}Language Model Reasoning
Section titled âLanguage Model Reasoningâ{ "type": "reasoning", "text": string, "providerOptions": object // Optional provider-specific options}Language Model Tool Call
Section titled âLanguage Model Tool Callâ{ "type": "tool_call", "toolCallId": string, "toolName": string, "args": string, // JSON string of arguments passed to the tool "providerOptions" object // Optional provider-specific options}Language Model Tool Result
Section titled âLanguage Model Tool Resultâ{ "type": "tool_result", "toolCallId": string, "toolName": string, "result": string, // JSON string of the tool result "providerOptions" object // Optional provider-specific options}