Documentation
¶
Overview ¶
Package hosted 提供托管工具与远程服务接入能力。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSearchResult ¶
type FileSearchResult struct {
FileID string `json:"file_id"`
FileName string `json:"file_name"`
Content string `json:"content"`
Score float64 `json:"score"`
Metadata map[string]any `json:"metadata,omitempty"`
}
FileSearchResult代表文件搜索结果.
type FileSearchTool ¶
type FileSearchTool struct {
// contains filtered or unexported fields
}
FileSearchTool 执行文件搜索功能.
func NewFileSearchTool ¶
func NewFileSearchTool(store VectorStore, maxResults int) *FileSearchTool
NewFileSearchTool创建了一个新的文件搜索工具.
func (*FileSearchTool) Description ¶
func (t *FileSearchTool) Description() string
func (*FileSearchTool) Execute ¶
func (t *FileSearchTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
func (*FileSearchTool) Name ¶
func (t *FileSearchTool) Name() string
func (*FileSearchTool) Schema ¶
func (t *FileSearchTool) Schema() llm.ToolSchema
func (*FileSearchTool) Type ¶
func (t *FileSearchTool) Type() HostedToolType
type HostedTool ¶
type HostedTool interface {
Type() HostedToolType
Name() string
Description() string
Schema() llm.ToolSchema
Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
}
HostToole 代表由提供者托管的工具.
type HostedToolType ¶
type HostedToolType string
Hosted ToolType 定义了主机工具的类型.
const ( ToolTypeWebSearch HostedToolType = "web_search" ToolTypeFileSearch HostedToolType = "file_search" ToolTypeCodeExec HostedToolType = "code_execution" ToolTypeRetrieval HostedToolType = "retrieval" )
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry 管理主机工具 。
func NewToolRegistry ¶
func NewToolRegistry(logger *zap.Logger) *ToolRegistry
NewToolRegistry创建了新的主机工具注册.
func (*ToolRegistry) GetSchemas ¶
func (r *ToolRegistry) GetSchemas() []llm.ToolSchema
GetSchemas 返回所有工具的策略 。
type VectorStore ¶
type VectorStore interface {
Search(ctx context.Context, query string, limit int) ([]FileSearchResult, error)
Index(ctx context.Context, fileID string, content []byte) error
}
用于文件搜索的矢量Store接口.
type WebSearchArgs ¶
type WebSearchArgs struct {
Query string `json:"query"`
MaxResults int `json:"max_results,omitempty"`
}
WebSearchArgs 代表网络搜索参数.
type WebSearchConfig ¶
WebSearchConfig 配置了网络搜索工具.
type WebSearchResult ¶
type WebSearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
}
WebSearchResult代表搜索结果.
type WebSearchTool ¶
type WebSearchTool struct {
// contains filtered or unexported fields
}
WebSearchTool执行网络搜索功能.
func NewWebSearchTool ¶
func NewWebSearchTool(config WebSearchConfig) *WebSearchTool
新WebSearchTooll创建了新的网络搜索工具.
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Schema ¶
func (t *WebSearchTool) Schema() llm.ToolSchema
func (*WebSearchTool) Type ¶
func (t *WebSearchTool) Type() HostedToolType
Click to show internal directories.
Click to hide internal directories.