Documentation
¶
Index ¶
- Constants
- type Browser
- type BrowserCrawler
- type BrowserFind
- type BrowserOpen
- type BrowserSearch
- type BrowserState
- type BrowserWebSearch
- type CrawlContent
- type CrawlExtras
- type CrawlLink
- type CrawlResponse
- type CrawlResult
- type FetchRequest
- type FetchResponse
- type PageType
- type Registry
- func (r *Registry) AvailableTools() []map[string]any
- func (r *Registry) Execute(ctx context.Context, name string, args map[string]any) (any, string, error)
- func (r *Registry) Get(name string) (Tool, bool)
- func (r *Registry) List() []Tool
- func (r *Registry) Register(tool Tool)
- func (r *Registry) SetWorkingDir(dir string)
- func (r *Registry) ToolNames() []string
- type SearchRequest
- type SearchResponse
- type SearchResult
- type Tool
- type ToolCall
- type ToolFunction
- type ToolResult
- type WebFetch
- type WebSearch
- type WebSearchContent
- type WebSearchMetadata
- type WebSearchResponse
- type WebSearchResult
Constants ¶
const DefaultViewTokens = 1024
DefaultViewTokens is the number of tokens to show to the model used when calling displayPage
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
func NewBrowser ¶
func NewBrowser(state *responses.BrowserStateData) *Browser
func (*Browser) State ¶
func (b *Browser) State() *responses.BrowserStateData
State is only accessed in a single thread, as each chat has its own browser state
type BrowserCrawler ¶
type BrowserCrawler struct{}
BrowserCrawler tool for crawling web pages using ollama.com crawl API
func (*BrowserCrawler) Description ¶
func (g *BrowserCrawler) Description() string
func (*BrowserCrawler) Execute ¶
func (g *BrowserCrawler) Execute(ctx context.Context, args map[string]any) (*CrawlResponse, error)
func (*BrowserCrawler) Name ¶
func (g *BrowserCrawler) Name() string
func (*BrowserCrawler) Prompt ¶
func (g *BrowserCrawler) Prompt() string
func (*BrowserCrawler) Schema ¶
func (g *BrowserCrawler) Schema() map[string]any
type BrowserFind ¶
type BrowserFind struct {
Browser
}
func NewBrowserFind ¶
func NewBrowserFind(bb *Browser) *BrowserFind
func (*BrowserFind) Description ¶
func (b *BrowserFind) Description() string
func (*BrowserFind) Name ¶
func (b *BrowserFind) Name() string
func (*BrowserFind) Prompt ¶
func (b *BrowserFind) Prompt() string
func (*BrowserFind) Schema ¶
func (b *BrowserFind) Schema() map[string]any
type BrowserOpen ¶
type BrowserOpen struct {
Browser
// contains filtered or unexported fields
}
func NewBrowserOpen ¶
func NewBrowserOpen(bb *Browser) *BrowserOpen
func (*BrowserOpen) Description ¶
func (b *BrowserOpen) Description() string
func (*BrowserOpen) Name ¶
func (b *BrowserOpen) Name() string
func (*BrowserOpen) Prompt ¶
func (b *BrowserOpen) Prompt() string
func (*BrowserOpen) Schema ¶
func (b *BrowserOpen) Schema() map[string]any
type BrowserSearch ¶
type BrowserSearch struct {
Browser
// contains filtered or unexported fields
}
func NewBrowserSearch ¶
func NewBrowserSearch(bb *Browser) *BrowserSearch
NewBrowserSearch creates a new browser search instance
func (*BrowserSearch) Description ¶
func (b *BrowserSearch) Description() string
func (*BrowserSearch) Name ¶
func (b *BrowserSearch) Name() string
func (*BrowserSearch) Prompt ¶
func (b *BrowserSearch) Prompt() string
func (*BrowserSearch) Schema ¶
func (b *BrowserSearch) Schema() map[string]any
type BrowserState ¶
type BrowserState struct {
Data *responses.BrowserStateData
// contains filtered or unexported fields
}
BrowserState manages the browsing session on a per-chat basis
type BrowserWebSearch ¶
type BrowserWebSearch struct{}
BrowserWebSearch tool for searching the web using ollama.com search API
func (*BrowserWebSearch) Description ¶
func (w *BrowserWebSearch) Description() string
func (*BrowserWebSearch) Name ¶
func (w *BrowserWebSearch) Name() string
func (*BrowserWebSearch) Prompt ¶
func (w *BrowserWebSearch) Prompt() string
func (*BrowserWebSearch) Schema ¶
func (w *BrowserWebSearch) Schema() map[string]any
type CrawlContent ¶
CrawlContent represents the content of a crawled page
type CrawlExtras ¶
type CrawlExtras struct {
Links []CrawlLink `json:"links"`
}
CrawlExtras represents additional data from the crawl API
type CrawlLink ¶
type CrawlLink struct {
URL string `json:"url"`
Href string `json:"href"`
Text string `json:"text"`
}
CrawlLink represents a link found on a crawled page
type CrawlResponse ¶
type CrawlResponse struct {
Results map[string][]CrawlResult `json:"results"`
}
CrawlResponse represents the complete response from the crawl API
type CrawlResult ¶
type CrawlResult struct {
Title string `json:"title"`
URL string `json:"url"`
Content CrawlContent `json:"content"`
Extras CrawlExtras `json:"extras"`
}
CrawlResult represents a single crawl result
type FetchRequest ¶
type FetchRequest struct {
URL string `json:"url"`
}
type FetchResponse ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the available tools and their execution
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new tool registry with no tools
func (*Registry) AvailableTools ¶
ToolSchemas returns all tools as schema maps suitable for API calls
func (*Registry) Execute ¶
func (r *Registry) Execute(ctx context.Context, name string, args map[string]any) (any, string, error)
Execute runs a tool with the given name and arguments
func (*Registry) SetWorkingDir ¶
SetWorkingDir sets the working directory for all tool operations
type SearchRequest ¶
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult `json:"results"`
}
type SearchResult ¶
type Tool ¶
type Tool interface {
// Name returns the unique identifier for the tool
Name() string
// Description returns a human-readable description of what the tool does
Description() string
// Schema returns the JSON schema for the tool's parameters
Schema() map[string]any
// Execute runs the tool with the given arguments and returns result to store in db, and a string result for the model
Execute(ctx context.Context, args map[string]any) (any, string, error)
// Prompt returns a prompt for the tool
Prompt() string
}
Tool defines the interface that all tools must implement
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function ToolFunction `json:"function"`
}
ToolCall represents a request to execute a tool
type ToolFunction ¶
type ToolFunction struct {
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments"`
}
ToolFunction represents the function call details
type ToolResult ¶
type ToolResult struct {
ToolCallID string `json:"tool_call_id"`
Content any `json:"content"`
Error string `json:"error,omitempty"`
}
ToolResult represents the result of a tool execution
type WebSearch ¶
type WebSearch struct{}
func (*WebSearch) Description ¶
type WebSearchContent ¶
WebSearchContent represents the content of a search result
type WebSearchMetadata ¶
WebSearchMetadata represents metadata for a search result
type WebSearchResponse ¶
type WebSearchResponse struct {
Results map[string][]WebSearchResult `json:"results"`
}
WebSearchResponse represents the complete response from the websearch API
type WebSearchResult ¶
type WebSearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Content WebSearchContent `json:"content"`
Metadata WebSearchMetadata `json:"metadata"`
}
WebSearchResult represents a single search result