Documentation
¶
Index ¶
- func GetItemStatus(block *schema.ContentBlock) (string, bool)
- func GetToolSearchToolCall(block *schema.ContentBlock) bool
- func InvalidateMessageCaches(messages []*schema.AgenticMessage) error
- func WithCustomHeaders(headers map[string]string) model.Option
- func WithExtraFields(fields map[string]any) model.Option
- func WithHeadPreviousResponseID(id string) model.Option
- func WithResponsesMCPTools(tools []*responses.ToolMcpParam) model.Option
- func WithResponsesMaxToolCalls(maxToolCalls int) model.Option
- func WithResponsesParallelToolCalls(parallelToolCalls bool) model.Option
- func WithResponsesPromptCacheKey(key string) model.Option
- func WithResponsesReasoning(reasoning *responses.ReasoningParam) model.Option
- func WithResponsesServerTools(tools []*ResponsesServerToolConfig) model.Option
- func WithResponsesStore(store bool) model.Option
- func WithResponsesText(text *responses.ResponseTextConfigParam) model.Option
- func WithResponsesTruncation(truncation responses.ResponseNewParamsTruncation) model.Option
- type ChatConfig
- type ChatModel
- func (m *ChatModel) Generate(ctx context.Context, in []*schema.AgenticMessage, opts ...model.Option) (*schema.AgenticMessage, error)
- func (m *ChatModel) GetType() string
- func (m *ChatModel) IsCallbacksEnabled() bool
- func (m *ChatModel) Stream(ctx context.Context, in []*schema.AgenticMessage, opts ...model.Option) (*schema.StreamReader[*schema.AgenticMessage], error)
- type ChatResponseMetaExtension
- type CodeInterpreterArguments
- type CodeInterpreterOutput
- type CodeInterpreterOutputImage
- type CodeInterpreterOutputLogs
- type CodeInterpreterOutputType
- type CodeInterpreterResult
- type FileSearchArguments
- type FileSearchAttribute
- type FileSearchResult
- type FileSearchResultItem
- type ImageGenerationArguments
- type ImageGenerationResult
- type ResponsesConfig
- type ResponsesModel
- func (m *ResponsesModel) Generate(ctx context.Context, input []*schema.AgenticMessage, opts ...model.Option) (outMsg *schema.AgenticMessage, err error)
- func (m *ResponsesModel) GetType() string
- func (m *ResponsesModel) IsCallbacksEnabled() bool
- func (m *ResponsesModel) Stream(ctx context.Context, input []*schema.AgenticMessage, opts ...model.Option) (outStream *schema.StreamReader[*schema.AgenticMessage], err error)
- type ResponsesServerToolConfig
- type ServerToolCallArguments
- type ServerToolName
- type ServerToolResult
- type ShellAction
- type ShellArguments
- type ShellEnvironment
- type ShellEnvironmentContainerReference
- type ShellEnvironmentLocal
- type ShellEnvironmentLocalSkill
- type ShellEnvironmentType
- type ShellOutputItem
- type ShellOutputOutcome
- type ShellOutputOutcomeExit
- type ShellOutputOutcomeType
- type ShellResult
- type ToolSearchArguments
- type ToolSearchResult
- type WebSearchAction
- type WebSearchArguments
- type WebSearchFind
- type WebSearchOpenPage
- type WebSearchQuery
- type WebSearchQueryResult
- type WebSearchQuerySource
- type WebSearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetItemStatus ¶
func GetItemStatus(block *schema.ContentBlock) (string, bool)
func GetToolSearchToolCall ¶
func GetToolSearchToolCall(block *schema.ContentBlock) bool
func InvalidateMessageCaches ¶
func InvalidateMessageCaches(messages []*schema.AgenticMessage) error
InvalidateMessageCaches temporarily disables caching for the specified messages. When a message is modified or model is switched, OPENAI invalidates caches for that message and all subsequent ones. Call this to mark those message caches as invalid temporarily.
func WithCustomHeaders ¶
WithCustomHeaders sets custom HTTP headers for the request.
func WithExtraFields ¶
WithExtraFields sets extra fields to include in the request body. These fields will be merged into the top-level JSON request body, overriding any existing fields with the same key.
Example:
WithExtraFields(map[string]any{
"reasoning_effort": "high",
"service_tier": "default",
})
The resulting request body will be:
{
"model": "o1",
"input": [...],
"reasoning_effort": "high",
"service_tier": "default"
}
func WithHeadPreviousResponseID ¶
WithHeadPreviousResponseID sets a response ID from a previous Responses API call. This ID links the current request to a previous conversation context, enabling features like conversation continuation and prefix caching. In populateCache, an auto-discovered response ID from input messages takes priority over this option. The referenced response must be cached before use. Available only for Responses API.
func WithResponsesMCPTools ¶
func WithResponsesMCPTools(tools []*responses.ToolMcpParam) model.Option
WithResponsesMCPTools sets Model Context Protocol tools available to the model. Available only for Responses API.
func WithResponsesMaxToolCalls ¶
WithResponsesMaxToolCalls sets the maximum number of tool calls allowed in a single turn. Available only for Responses API.
func WithResponsesParallelToolCalls ¶
WithResponsesParallelToolCalls sets whether to allow multiple tool calls in a single turn. Available only for Responses API.
func WithResponsesPromptCacheKey ¶
WithResponsesPromptCacheKey sets the prompt cache key for the request. Available only for Responses API.
func WithResponsesReasoning ¶
func WithResponsesReasoning(reasoning *responses.ReasoningParam) model.Option
WithResponsesReasoning sets the reasoning configuration for the request. Available only for Responses API.
func WithResponsesServerTools ¶
func WithResponsesServerTools(tools []*ResponsesServerToolConfig) model.Option
WithResponsesServerTools sets server-side tools available to the model. Available only for Responses API.
func WithResponsesStore ¶
WithResponsesStore sets whether to store the response on the server. Available only for Responses API.
func WithResponsesText ¶
func WithResponsesText(text *responses.ResponseTextConfigParam) model.Option
WithResponsesText sets the text generation configuration for the request. Available only for Responses API.
func WithResponsesTruncation ¶
func WithResponsesTruncation(truncation responses.ResponseNewParamsTruncation) model.Option
WithResponsesTruncation sets how to handle context that exceeds the model's context window. Available only for Responses API.
Types ¶
type ChatConfig ¶
type ChatConfig struct {
// APIKey is your authentication key
// Required
APIKey string
// Timeout specifies the maximum duration to wait for API responses
// If HTTPClient is set, Timeout will not be used.
// Optional. Default: no timeout
Timeout time.Duration
// HTTPClient specifies the client to send HTTP requests.
// If HTTPClient is set, Timeout will not be used.
// Optional. Default &http.Client{Timeout: Timeout}
HTTPClient *http.Client
// ByAzure indicates whether to use Azure OpenAI Service
// Optional. Default: false
ByAzure bool
// AzureModelMapperFunc is used to map the model name to the deployment name for Azure OpenAI Service.
// Optional for Azure.
AzureModelMapperFunc func(model string) string
// APIVersion specifies the Azure OpenAI API version
// Required for Azure
APIVersion string
// BaseURL specifies the API endpoint URL
// Optional. Default: https://api.openai.com/v1
BaseURL string
// Model specifies the ID of the model to use
// Required
Model string
// MaxCompletionTokens specifies an upper bound for the number of tokens that can be generated
// for a completion, including visible output tokens and reasoning tokens.
// Optional.
MaxCompletionTokens *int
// Temperature specifies what sampling temperature to use
// Range: 0.0 to 2.0. Higher values make output more random
// Optional. Default: 1.0
Temperature *float32
// TopP controls diversity via nucleus sampling
// Range: 0.0 to 1.0. Lower values make output more focused
// Optional. Default: 1.0
TopP *float32
// Stop sequences where the API will stop generating further tokens
// Optional. Example: []string{"\n", "User:"}
Stop []string
// PresencePenalty prevents repetition by penalizing tokens based on presence
// Range: -2.0 to 2.0. Positive values increase likelihood of new topics
// Optional. Default: 0
PresencePenalty *float32
// FrequencyPenalty prevents repetition by penalizing tokens based on frequency
// Range: -2.0 to 2.0. Positive values decrease likelihood of repetition
// Optional. Default: 0
FrequencyPenalty *float32
// LogitBias modifies likelihood of specific tokens appearing in completion
// Optional. Map token IDs to bias values from -100 to 100
LogitBias map[string]int
// LogProbs specifies whether to return log probabilities of the output tokens.
// Optional. Default: false
LogProbs bool
// TopLogProbs specifies the number of most likely tokens to return at each token position.
// Optional.
TopLogProbs int
// CustomHeaders specifies custom HTTP headers to include in the request.
// Optional.
CustomHeaders map[string]string
// ExtraFields specifies extra fields to include in the request body.
// These fields will be merged into the top-level JSON request body, overriding any existing fields with the same key.
// Optional.
//
// Example:
//
// ExtraFields: map[string]any{
// "reasoning_effort": "high",
// "service_tier": "default",
// }
//
// The resulting request body will be:
//
// {
// "model": "o1",
// "messages": [...],
// "reasoning_effort": "high",
// "service_tier": "default"
// }
ExtraFields map[string]any
}
Config parameters detail see: https://platform.openai.com/docs/api-reference/chat/create
type ChatModel ¶
type ChatModel struct {
// contains filtered or unexported fields
}
func NewChatModel ¶
func NewChatModel(ctx context.Context, config *ChatConfig) (*ChatModel, error)
func (*ChatModel) Generate ¶
func (m *ChatModel) Generate(ctx context.Context, in []*schema.AgenticMessage, opts ...model.Option) ( *schema.AgenticMessage, error)
func (*ChatModel) IsCallbacksEnabled ¶
func (*ChatModel) Stream ¶
func (m *ChatModel) Stream(ctx context.Context, in []*schema.AgenticMessage, opts ...model.Option) ( *schema.StreamReader[*schema.AgenticMessage], error)
type CodeInterpreterArguments ¶
type CodeInterpreterArguments struct {
}
CodeInterpreterArguments represents the arguments for a code interpreter tool call.
type CodeInterpreterOutput ¶
type CodeInterpreterOutput struct {
// Type is the output type: "logs" or "image".
Type CodeInterpreterOutputType `json:"type,omitempty" mapstructure:"type,omitempty"`
// Logs is set when Type is "logs".
Logs *CodeInterpreterOutputLogs `json:"logs,omitempty" mapstructure:"logs,omitempty"`
// Image is set when Type is "image".
Image *CodeInterpreterOutputImage `json:"image,omitempty" mapstructure:"image,omitempty"`
}
CodeInterpreterOutput represents a single output from the code interpreter.
type CodeInterpreterOutputImage ¶
type CodeInterpreterOutputImage struct {
// URL is the URL of the generated image.
URL string `json:"url,omitempty" mapstructure:"url,omitempty"`
}
CodeInterpreterOutputImage represents the image output from the code interpreter.
type CodeInterpreterOutputLogs ¶
type CodeInterpreterOutputLogs struct {
// Logs is the log content from code execution.
Logs string `json:"logs,omitempty" mapstructure:"logs,omitempty"`
}
CodeInterpreterOutputLogs represents the logs output from the code interpreter.
type CodeInterpreterOutputType ¶
type CodeInterpreterOutputType string
const ( CodeInterpreterOutputTypeLogs CodeInterpreterOutputType = "logs" CodeInterpreterOutputTypeImage CodeInterpreterOutputType = "image" )
type CodeInterpreterResult ¶
type CodeInterpreterResult struct {
// Code is the code that was run.
Code string `json:"code,omitempty" mapstructure:"code,omitempty"`
// ContainerID is the ID of the container used to run the code.
ContainerID string `json:"container_id,omitempty" mapstructure:"container_id,omitempty"`
// Outputs are the outputs generated by the code interpreter.
Outputs []*CodeInterpreterOutput `json:"outputs,omitempty" mapstructure:"outputs,omitempty"`
}
CodeInterpreterResult represents the result of a code interpreter tool call.
type FileSearchArguments ¶
type FileSearchArguments struct {
// Queries are the queries used to search for files.
Queries []string `json:"queries,omitempty" mapstructure:"queries,omitempty"`
}
FileSearchArguments represents the arguments for a file search tool call.
type FileSearchAttribute ¶
type FileSearchAttribute struct {
// OfString is set when the attribute value is a string.
OfString *string `json:"of_string,omitempty" mapstructure:"of_string,omitempty"`
// OfFloat is set when the attribute value is a number.
OfFloat *float64 `json:"of_float,omitempty" mapstructure:"of_float,omitempty"`
// OfBool is set when the attribute value is a boolean.
OfBool *bool `json:"of_bool,omitempty" mapstructure:"of_bool,omitempty"`
}
FileSearchAttribute represents an attribute value, which can be string, float, or bool.
type FileSearchResult ¶
type FileSearchResult struct {
// Results contains the matched files.
Results []*FileSearchResultItem `json:"results,omitempty" mapstructure:"results,omitempty"`
}
FileSearchResult represents the result of a file search tool call.
type FileSearchResultItem ¶
type FileSearchResultItem struct {
// FileID is the unique ID of the file.
FileID string `json:"file_id,omitempty" mapstructure:"file_id,omitempty"`
// FileName is the name of the file.
FileName string `json:"file_name,omitempty" mapstructure:"file_name,omitempty"`
// Score is the relevance score, a value between 0 and 1.
Score float64 `json:"score,omitempty" mapstructure:"score,omitempty"`
// Text is the text content retrieved from the file.
Text string `json:"text,omitempty" mapstructure:"text,omitempty"`
// Attributes contains the metadata key-value pairs attached to the file.
Attributes map[string]*FileSearchAttribute `json:"attributes,omitempty" mapstructure:"attributes,omitempty"`
}
FileSearchResultItem represents a single matched file.
type ImageGenerationArguments ¶
type ImageGenerationArguments struct {
}
ImageGenerationArguments represents the arguments for an image generation tool call.
type ImageGenerationResult ¶
type ImageGenerationResult struct {
// ImageBase64 is the base64-encoded image data.
ImageBase64 string `json:"image_base64,omitempty" mapstructure:"image_base64,omitempty"`
}
ImageGenerationResult represents the result of an image generation tool call.
type ResponsesConfig ¶
type ResponsesConfig struct {
// ByAzure specifies whether to use Azure OpenAI service.
// Optional.
ByAzure bool
// BaseURL specifies the base URL for the OpenAI service endpoint.
// Optional. Default: https://api.openai.com/v1
BaseURL string
// APIKey specifies the API key for authentication.
// Required.
APIKey string
// Timeout specifies the maximum duration to wait for API responses.
// Optional.
Timeout *time.Duration
// HTTPClient specifies the HTTP client used to send requests.
// Optional.
HTTPClient *http.Client
// MaxRetries specifies the maximum number of retry attempts for failed requests.
// Optional.
MaxRetries *int
// Model specifies the ID of the model to use for the response.
// Required.
Model string
// MaxTokens specifies the maximum number of tokens to generate in the response.
// Optional.
MaxTokens *int
// Temperature controls the randomness of the model's output.
// Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more focused and deterministic.
// Range: 0.0 to 2.0.
// Optional.
Temperature *float32
// TopP controls diversity via nucleus sampling.
// It specifies the cumulative probability threshold for token selection.
// Recommended to use either Temperature or TopP, but not both.
// Range: 0.0 to 1.0.
// Optional.
TopP *float32
// ServiceTier specifies the latency tier for processing the request.
// Optional.
ServiceTier *responses.ResponseNewParamsServiceTier
// Text specifies configuration for text generation output.
// Optional.
Text *responses.ResponseTextConfigParam
// Reasoning specifies configuration for reasoning models.
// Optional.
Reasoning *responses.ReasoningParam
// Store specifies whether to store the response on the server.
// Optional.
Store *bool
// MaxToolCalls specifies the maximum number of tool calls allowed in a single turn.
// Optional.
MaxToolCalls *int
// ParallelToolCalls specifies whether to allow multiple tool calls in a single turn.
// Optional.
ParallelToolCalls *bool
// Include specifies a list of additional fields to include in the response.
// Optional.
Include []responses.ResponseIncludable
// Truncation specifies how to handle context that exceeds the model's context window.
// Optional.
Truncation *responses.ResponseNewParamsTruncation
// EnableAutoCache controls whether auto-caching for multi-turn conversations is active for the model.
// When enabled, conversation turns are stored, and the model automatically maintains context
// by locating the most recent cached message in the input (via Response ID in ResponseMeta).
// This cached message and all preceding inputs are excluded from the request.
// If the cached message becomes invalid, you can call InvalidateMessageCaches to temporarily invalidate the cache.
// Unless Store is set to false explicitly for a request, auto-cache forces Store to true.
// Optional.
EnableAutoCache bool
// PromptCacheRetention specifies the retention policy for the prompt cache.
// Optional.
PromptCacheRetention *responses.ResponseNewParamsPromptCacheRetention
// CustomHeaders specifies custom HTTP headers to include in API requests.
// CustomHeaders allows passing additional metadata or authentication information.
// Optional.
CustomHeaders map[string]string
// ExtraFields specifies extra fields to include in the request body.
// These fields will be merged into the top-level JSON request body, overriding any existing fields with the same key.
// Optional.
//
// Example:
//
// ExtraFields: map[string]any{
// "reasoning_effort": "high",
// "service_tier": "default",
// }
//
// The resulting request body will be:
//
// {
// "model": "o1",
// "messages": [...],
// "reasoning_effort": "high",
// "service_tier": "default"
// }
ExtraFields map[string]any
}
type ResponsesModel ¶
type ResponsesModel struct {
// contains filtered or unexported fields
}
func NewResponsesModel ¶
func NewResponsesModel(_ context.Context, config *ResponsesConfig) (*ResponsesModel, error)
func (*ResponsesModel) Generate ¶
func (m *ResponsesModel) Generate(ctx context.Context, input []*schema.AgenticMessage, opts ...model.Option) ( outMsg *schema.AgenticMessage, err error)
func (*ResponsesModel) GetType ¶
func (m *ResponsesModel) GetType() string
func (*ResponsesModel) IsCallbacksEnabled ¶
func (m *ResponsesModel) IsCallbacksEnabled() bool
func (*ResponsesModel) Stream ¶
func (m *ResponsesModel) Stream(ctx context.Context, input []*schema.AgenticMessage, opts ...model.Option) ( outStream *schema.StreamReader[*schema.AgenticMessage], err error)
type ResponsesServerToolConfig ¶
type ResponsesServerToolConfig struct {
WebSearch *responses.WebSearchToolParam
FileSearch *responses.FileSearchToolParam
CodeInterpreter *responses.ToolCodeInterpreterParam
Shell *responses.FunctionShellToolParam
}
type ServerToolCallArguments ¶
type ServerToolCallArguments struct {
WebSearch *WebSearchArguments `json:"web_search,omitempty" mapstructure:"web_search,omitempty"`
FileSearch *FileSearchArguments `json:"file_search,omitempty" mapstructure:"file_search,omitempty"`
CodeInterpreter *CodeInterpreterArguments `json:"code_interpreter,omitempty" mapstructure:"code_interpreter,omitempty"`
ImageGeneration *ImageGenerationArguments `json:"image_generation,omitempty" mapstructure:"image_generation,omitempty"`
Shell *ShellArguments `json:"shell,omitempty" mapstructure:"shell,omitempty"`
ToolSearch *ToolSearchArguments `json:"tool_search,omitempty" mapstructure:"-"`
}
type ServerToolName ¶
type ServerToolName string
const ( ServerToolNameWebSearch ServerToolName = "web_search" ServerToolNameFileSearch ServerToolName = "file_search" ServerToolNameCodeInterpreter ServerToolName = "code_interpreter" ServerToolNameImageGeneration ServerToolName = "image_generation" ServerToolNameShell ServerToolName = "shell" )
type ServerToolResult ¶
type ServerToolResult struct {
WebSearch *WebSearchResult `json:"web_search,omitempty" mapstructure:"web_search,omitempty"`
FileSearch *FileSearchResult `json:"file_search,omitempty" mapstructure:"file_search,omitempty"`
CodeInterpreter *CodeInterpreterResult `json:"code_interpreter,omitempty" mapstructure:"code_interpreter,omitempty"`
ImageGeneration *ImageGenerationResult `json:"image_generation,omitempty" mapstructure:"image_generation,omitempty"`
Shell *ShellResult `json:"shell,omitempty" mapstructure:"shell,omitempty"`
ToolSearch *ToolSearchResult `json:"tool_search,omitempty" mapstructure:"-"`
}
type ShellAction ¶
type ShellAction struct {
// Commands are the shell commands to run.
Commands []string `json:"commands,omitempty" mapstructure:"commands,omitempty"`
// TimeoutMs is the timeout in milliseconds for the commands.
TimeoutMs int64 `json:"timeout_ms,omitempty" mapstructure:"timeout_ms,omitempty"`
// MaxOutputLength is the maximum number of characters to return from each command.
MaxOutputLength int64 `json:"max_output_length,omitempty" mapstructure:"max_output_length,omitempty"`
}
ShellAction contains the shell commands and execution limits.
type ShellArguments ¶
type ShellArguments struct {
// Action contains the shell commands to execute.
Action *ShellAction `json:"action,omitempty" mapstructure:"action,omitempty"`
// Environment specifies where to run the commands.
Environment *ShellEnvironment `json:"environment,omitempty" mapstructure:"environment,omitempty"`
// CreatedBy is the ID of the entity that created this tool call.
CreatedBy string `json:"created_by,omitempty" mapstructure:"created_by,omitempty"`
}
ShellArguments represents the arguments for a shell tool call.
type ShellEnvironment ¶
type ShellEnvironment struct {
// Type is the environment type: "local" or "container_reference".
Type ShellEnvironmentType `json:"type,omitempty" mapstructure:"type,omitempty"`
// Local is set when Type is "local".
Local *ShellEnvironmentLocal `json:"local,omitempty" mapstructure:"local,omitempty"`
// ContainerReference is set when Type is "container_reference".
ContainerReference *ShellEnvironmentContainerReference `json:"container_reference,omitempty" mapstructure:"container_reference,omitempty"`
}
ShellEnvironment specifies the execution environment for shell commands.
type ShellEnvironmentContainerReference ¶
type ShellEnvironmentContainerReference struct {
// ContainerID is the ID of the container.
ContainerID string `json:"container_id,omitempty" mapstructure:"container_id,omitempty"`
}
ShellEnvironmentContainerReference identifies a container to run commands in.
type ShellEnvironmentLocal ¶
type ShellEnvironmentLocal struct {
// Skills is an optional list of skills available in the local environment.
Skills []*ShellEnvironmentLocalSkill `json:"skills,omitempty" mapstructure:"skills,omitempty"`
}
ShellEnvironmentLocal represents a local execution environment for shell commands.
type ShellEnvironmentLocalSkill ¶
type ShellEnvironmentLocalSkill struct {
// Name is the name of the skill.
Name string `json:"name,omitempty" mapstructure:"name,omitempty"`
// Description is the description of the skill.
Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
// Path is the path to the directory containing the skill.
Path string `json:"path,omitempty" mapstructure:"path,omitempty"`
}
ShellEnvironmentLocalSkill represents a skill available in a local environment.
type ShellEnvironmentType ¶
type ShellEnvironmentType string
const ( ShellEnvironmentTypeLocal ShellEnvironmentType = "local" ShellEnvironmentTypeContainerReference ShellEnvironmentType = "container_reference" )
type ShellOutputItem ¶
type ShellOutputItem struct {
// Stdout is the captured standard output.
Stdout string `json:"stdout,omitempty" mapstructure:"stdout,omitempty"`
// Stderr is the captured standard error.
Stderr string `json:"stderr,omitempty" mapstructure:"stderr,omitempty"`
// Outcome indicates how the command finished (exit or timeout).
Outcome *ShellOutputOutcome `json:"outcome,omitempty" mapstructure:"outcome,omitempty"`
// CreatedBy is the identifier of the actor that created this output.
CreatedBy string `json:"created_by,omitempty" mapstructure:"created_by,omitempty"`
}
ShellOutputItem represents the output from a single command.
type ShellOutputOutcome ¶
type ShellOutputOutcome struct {
// Type is the outcome type: "exit" or "timeout".
Type ShellOutputOutcomeType `json:"type,omitempty" mapstructure:"type,omitempty"`
// Exit is set when Type is "exit".
Exit *ShellOutputOutcomeExit `json:"exit,omitempty" mapstructure:"exit,omitempty"`
}
ShellOutputOutcome indicates how a shell command finished.
type ShellOutputOutcomeExit ¶
type ShellOutputOutcomeExit struct {
// ExitCode is the exit code from the shell process.
ExitCode int64 `json:"exit_code,omitempty" mapstructure:"exit_code,omitempty"`
}
ShellOutputOutcomeExit contains exit information for a completed command.
type ShellOutputOutcomeType ¶
type ShellOutputOutcomeType string
const ( ShellOutputOutcomeTypeTimeout ShellOutputOutcomeType = "timeout" ShellOutputOutcomeTypeExit ShellOutputOutcomeType = "exit" )
type ShellResult ¶
type ShellResult struct {
// MaxOutputLength is the maximum length of output returned per command.
MaxOutputLength int64 `json:"max_output_length,omitempty" mapstructure:"max_output_length,omitempty"`
// Outputs contains the output from each command.
Outputs []*ShellOutputItem `json:"outputs,omitempty" mapstructure:"outputs,omitempty"`
// CreatedBy is the identifier of the actor that created this result.
CreatedBy string `json:"created_by,omitempty" mapstructure:"created_by,omitempty"`
}
ShellResult represents the result of a shell tool call.
type ToolSearchArguments ¶
type ToolSearchArguments struct {
Arguments json.RawMessage `json:"arguments,omitempty"`
}
type ToolSearchResult ¶
type WebSearchAction ¶
type WebSearchAction string
const ( WebSearchActionSearch WebSearchAction = "search" WebSearchActionOpenPage WebSearchAction = "open_page" WebSearchActionFind WebSearchAction = "find" )
type WebSearchArguments ¶
type WebSearchArguments struct {
// ActionType is the type of action: search, open_page, or find.
ActionType WebSearchAction `json:"action_type,omitempty" mapstructure:"action_type,omitempty"`
// Search is the search query parameters. Present when ActionType is "search".
Search *WebSearchQuery `json:"search,omitempty" mapstructure:"search,omitempty"`
// OpenPage is the open page parameters. Present when ActionType is "open_page".
OpenPage *WebSearchOpenPage `json:"open_page,omitempty" mapstructure:"open_page,omitempty"`
// Find is the find in page parameters. Present when ActionType is "find".
Find *WebSearchFind `json:"find,omitempty" mapstructure:"find,omitempty"`
}
WebSearchArguments represents the arguments for a web search tool call.
type WebSearchFind ¶
type WebSearchFind struct {
// URL is the URL of the page.
URL string `json:"url,omitempty" mapstructure:"url,omitempty"`
// Pattern is the pattern to find in the page.
Pattern string `json:"pattern,omitempty" mapstructure:"pattern,omitempty"`
}
WebSearchFind represents find in page parameters.
type WebSearchOpenPage ¶
type WebSearchOpenPage struct {
// URL is the URL to open.
URL string `json:"url,omitempty" mapstructure:"url,omitempty"`
}
WebSearchOpenPage represents open page parameters.
type WebSearchQuery ¶
type WebSearchQuery struct {
// Queries are the search queries.
Queries []string `json:"queries,omitempty" mapstructure:"queries,omitempty"`
}
WebSearchQuery represents a web search query parameters.
type WebSearchQueryResult ¶
type WebSearchQueryResult struct {
// Sources are the sources returned from the search.
Sources []*WebSearchQuerySource `json:"sources,omitempty" mapstructure:"sources,omitempty"`
}
WebSearchQueryResult represents the result of a web search query.
type WebSearchQuerySource ¶
type WebSearchQuerySource struct {
// URL is the URL of the source.
URL string `json:"url,omitempty" mapstructure:"url,omitempty"`
}
WebSearchQuerySource represents a source returned from the search.
type WebSearchResult ¶
type WebSearchResult struct {
// ActionType is the type of action performed.
ActionType WebSearchAction `json:"action_type,omitempty" mapstructure:"action_type,omitempty"`
// Search contains the search query result. Present when ActionType is "search".
Search *WebSearchQueryResult `json:"search,omitempty" mapstructure:"search,omitempty"`
}
WebSearchResult represents the result of a web search tool call.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
chat_generate
command
|
|
|
chat_stream
command
|
|
|
responses_client_tool_search
command
|
|
|
responses_generate
command
|
|
|
responses_hosted_tool_search
command
|
|
|
responses_session_cache
command
|
|
|
responses_stream_with_mcp_tool
command
|
|