Documentation
¶
Index ¶
- Constants
- type APIErrorResponse
- type BraveSearchResponse
- type BraveWebResult
- type CalculatorTool
- type FunctionCallOutput
- type FunctionParameters
- type FunctionTool
- type InputImage
- type InputMessage
- type InputText
- type OutputContent
- type OutputItem
- type Plugin
- type Property
- type Reasoning
- type Request
- type Response
- type SearchResultsTool
- type Service
- type Tool
- type WebfetchTool
- type WebsearchTool
Constants ¶
View Source
const ( ApiURL = "https://api.openai.com/v1/responses" Model = "gpt-5.4-mini" TypeInputText = "input_text" TypeInputImage = "input_image" TypeMessage = "message" TypeOutputText = "output_text" TypeFunctionCall = "function_call" TypeFunctionCallOutput = "function_call_output" RoleUser = "user" )
View Source
const ( MaxRetries = 3 MaxOutputTokens = 2000 MaxToolCallRounds = 3 DefaultSystemInstruction = "" /* 244-byte string literal not displayed */ )
View Source
const ( MaxFetchedContentLength = 50_000 FetchTimeout = 30 * time.Second )
View Source
const ( BraveSearchURL = "https://api.search.brave.com/res/v1/web/search" MaxSourceLinks = 10 BraveDefaultCount = 5 BraveMaxCount = 20 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIErrorResponse ¶
type BraveSearchResponse ¶
type BraveSearchResponse struct {
Web struct {
Results []BraveWebResult `json:"results"`
} `json:"web"`
}
type BraveWebResult ¶
type CalculatorTool ¶
type CalculatorTool struct{}
func NewCalculatorTool ¶
func NewCalculatorTool() *CalculatorTool
func (*CalculatorTool) Definition ¶
func (t *CalculatorTool) Definition() FunctionTool
func (*CalculatorTool) Emoji ¶
func (t *CalculatorTool) Emoji() string
type FunctionCallOutput ¶
type FunctionParameters ¶
type FunctionTool ¶
type FunctionTool struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Parameters FunctionParameters `json:"parameters"`
Strict bool `json:"strict"`
}
type InputImage ¶
type InputMessage ¶
type OutputContent ¶
type OutputItem ¶
type OutputItem struct {
Type string `json:"type"`
// "message" fields
Role string `json:"role,omitempty"`
Content []OutputContent `json:"content,omitempty"`
// "function_call" fields
CallID string `json:"call_id,omitempty"`
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
}
OutputItem handles both "message" and "function_call" output types.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) Commands ¶
func (p *Plugin) Commands() []gotgbot.BotCommand
type Request ¶
type Request struct {
Model string `json:"model"`
Input []any `json:"input"`
Instructions string `json:"instructions"`
Store bool `json:"store"`
MaxOutputTokens int `json:"max_output_tokens"`
PreviousResponseID string `json:"previous_response_id,omitempty"`
Tools []FunctionTool `json:"tools,omitempty"`
Reasoning Reasoning `json:"reasoning"`
}
type Response ¶
type Response struct {
ID string `json:"id"`
Output []OutputItem `json:"output"`
}
type SearchResultsTool ¶
type SearchResultsTool interface {
Tool
SearchResults() []BraveWebResult // this kinda sucks but we need the links at the end and the parse mode
}
type Tool ¶
type Tool interface {
Definition() FunctionTool
Execute(arguments string) (string, error)
Emoji() string
}
type WebfetchTool ¶
type WebfetchTool struct {
// contains filtered or unexported fields
}
func NewWebfetchTool ¶
func NewWebfetchTool(chatID int64) *WebfetchTool
func (*WebfetchTool) Definition ¶
func (t *WebfetchTool) Definition() FunctionTool
func (*WebfetchTool) Emoji ¶
func (t *WebfetchTool) Emoji() string
type WebsearchTool ¶
type WebsearchTool struct {
// contains filtered or unexported fields
}
func NewWebsearchTool ¶
func NewWebsearchTool(apiKey string, chatID int64) *WebsearchTool
func (*WebsearchTool) Definition ¶
func (t *WebsearchTool) Definition() FunctionTool
func (*WebsearchTool) Emoji ¶
func (t *WebsearchTool) Emoji() string
func (*WebsearchTool) SearchResults ¶
func (t *WebsearchTool) SearchResults() []BraveWebResult
Click to show internal directories.
Click to hide internal directories.