Documentation
¶
Index ¶
- func SeparateTools(tools []Tool) (builtinTools []coreTypes.ActionDefinition, ...)
- type Content
- type ContentItem
- type FormatConfig
- type FunctionToolCall
- type Input
- type InputMessage
- type Message
- type MessageContentItem
- type ReasoningConfig
- type RequestBody
- type ResponseBody
- type ResponseMessage
- type TextConfig
- type TokenDetails
- type Tool
- type ToolChoice
- type UsageInfo
- type UserLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeparateTools ¶
func SeparateTools(tools []Tool) (builtinTools []coreTypes.ActionDefinition, userTools []coreTypes.ActionDefinition)
SeparateTools separates a slice of Tools into builtin tools and user tools as ActionDefinitions
Types ¶
type Content ¶
type Content struct { Text *string `json:"-"` Items *[]ContentItem `json:"-"` }
Content represents either a string or a slice of ContentItem
func (*Content) GetItems ¶
func (c *Content) GetItems() []ContentItem
GetItems returns the items value or empty slice
func (*Content) MarshalJSON ¶
MarshalJSON implements custom JSON marshaling for Content
func (*Content) UnmarshalJSON ¶
UnmarshalJSON implements custom JSON unmarshaling for Content
type ContentItem ¶
type ContentItem struct { Type string `json:"type"` Text string `json:"text,omitempty"` ImageURL string `json:"image_url,omitempty"` }
ContentItem represents an item in a content array
type FormatConfig ¶
type FormatConfig struct {
Type string `json:"type"`
}
FormatConfig represents format configuration options
type FunctionToolCall ¶
type FunctionToolCall struct { Arguments string `json:"arguments"` CallID string `json:"call_id"` Name string `json:"name"` Type string `json:"type"` ID string `json:"id"` Status string `json:"status"` }
FunctionToolCall represents a function tool call as a top-level object in the output array
type Input ¶
Input represents either a string or a slice of Message
func (*Input) GetMessages ¶
GetMessages returns the messages value or empty slice
func (*Input) IsMessages ¶
IsMessages returns true if the input contains messages
func (*Input) MarshalJSON ¶
MarshalJSON implements custom JSON marshaling for Input
func (*Input) UnmarshalJSON ¶
UnmarshalJSON implements custom JSON unmarshaling for Input
type InputMessage ¶
InputMessage represents a user input message
type Message ¶
type Message struct { // Common fields Type string `json:"type,omitempty"` // InputMessage fields (when this is a regular chat message) Role *string `json:"role,omitempty"` Content *Content `json:"content,omitempty"` // WebSearchToolCall fields (when type == "web_search_call") ID *string `json:"id,omitempty"` Status *string `json:"status,omitempty"` // Function call and function call output Arguments *string `json:"arguments,omitempty"` CallId *string `json:"call_id,omitempty"` Name *string `json:"name,omitempty"` Output *string `json:"output,omitempty"` }
Message represents different types of messages in the input
func (*Message) IsFunctionCall ¶
func (*Message) IsFunctionCallOutput ¶
func (*Message) IsInputMessage ¶
IsInputMessage returns true if this is a regular chat message
func (*Message) IsValidFunctionCallOutput ¶
func (*Message) IsWebSearchCall ¶
IsWebSearchCall returns true if this is a web search tool call
func (*Message) ToInputMessage ¶
func (m *Message) ToInputMessage() *InputMessage
ToInputMessage converts to InputMessage if this is a regular message
type MessageContentItem ¶
type MessageContentItem struct { Type string `json:"type"` Text string `json:"text"` Annotations []interface{} `json:"annotations"` }
MessageContentItem represents a content item in a message
type ReasoningConfig ¶
type ReasoningConfig struct { Effort *string `json:"effort,omitempty"` Summary *string `json:"summary,omitempty"` }
ReasoningConfig represents reasoning configuration options
type RequestBody ¶
type RequestBody struct { Model string `json:"model"` Input Input `json:"input"` Include []string `json:"include,omitempty"` Instructions *string `json:"instructions,omitempty"` MaxOutputTokens *int `json:"max_output_tokens,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"` PreviousResponseID *string `json:"previous_response_id,omitempty"` Reasoning *ReasoningConfig `json:"reasoning,omitempty"` Store *bool `json:"store,omitempty"` Stream *bool `json:"stream,omitempty"` Temperature *float64 `json:"temperature,omitempty"` Text *TextConfig `json:"text,omitempty"` ToolChoice json.RawMessage `json:"tool_choice,omitempty"` Tools []Tool `json:"tools,omitempty"` TopP *float64 `json:"top_p,omitempty"` Truncation *string `json:"truncation,omitempty"` }
RequestBody represents the request body structure for the OpenAI API
func (*RequestBody) SetInputByType ¶
func (r *RequestBody) SetInputByType()
func (*RequestBody) ToChatCompletionMessages ¶
func (r *RequestBody) ToChatCompletionMessages() []openai.ChatCompletionMessage
type ResponseBody ¶
type ResponseBody struct { ID string `json:"id"` Object string `json:"object"` CreatedAt int64 `json:"created_at"` Status string `json:"status"` Error interface{} `json:"error"` IncompleteDetails interface{} `json:"incomplete_details"` Instructions interface{} `json:"instructions"` MaxOutputTokens interface{} `json:"max_output_tokens"` Model string `json:"model"` Output []interface{} `json:"output"` ParallelToolCalls bool `json:"parallel_tool_calls"` PreviousResponseID interface{} `json:"previous_response_id"` Reasoning ReasoningConfig `json:"reasoning"` Store bool `json:"store"` Temperature float64 `json:"temperature"` Text TextConfig `json:"text"` ToolChoice string `json:"tool_choice"` Tools []Tool `json:"tools"` TopP float64 `json:"top_p"` Truncation string `json:"truncation"` Usage UsageInfo `json:"usage"` User interface{} `json:"user"` Metadata map[string]interface{} `json:"metadata"` }
ResponseBody represents the structure of the OpenAI API response
type ResponseMessage ¶
type ResponseMessage struct { Type string `json:"type"` ID string `json:"id"` Status string `json:"status"` Role string `json:"role"` Content []MessageContentItem `json:"content"` }
ResponseMessage represents a message in the response
type TextConfig ¶
type TextConfig struct {
Format *FormatConfig `json:"format,omitempty"`
}
TextConfig represents text configuration options
type TokenDetails ¶
type TokenDetails struct { CachedTokens int `json:"cached_tokens"` ReasoningTokens int `json:"reasoning_tokens,omitempty"` }
TokenDetails represents details about token usage
type Tool ¶
type Tool struct { Type string `json:"type"` // Function tool fields (used when type == "function") Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Parameters *jsonschema.Definition `json:"parameters,omitempty"` Strict *bool `json:"strict,omitempty"` // Web search tool fields (used when type == "web_search_preview" etc.) SearchContextSize *string `json:"search_context_size,omitempty"` UserLocation *UserLocation `json:"user_location,omitempty"` }
Tool represents a tool that can be called by the assistant
func (*Tool) IsFunction ¶
IsFunction returns true if this is a function tool
func (*Tool) IsWebSearch ¶
IsWebSearch returns true if this is a web search tool
func (*Tool) ToActionDefinition ¶
func (t *Tool) ToActionDefinition() *coreTypes.ActionDefinition
ToActionDefinition converts this tool to an ActionDefinition
type ToolChoice ¶
type UsageInfo ¶
type UsageInfo struct { InputTokens int `json:"input_tokens"` InputTokensDetails TokenDetails `json:"input_tokens_details"` OutputTokens int `json:"output_tokens"` OutputTokensDetails TokenDetails `json:"output_tokens_details"` TotalTokens int `json:"total_tokens"` }
UsageInfo represents token usage information