tools

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleTool string

Functions

func ConvertAnthropicToOpenAI

func ConvertAnthropicToOpenAI(data []byte) (openai.ChatCompletionToolParam, error)

ConvertAnthropicToOpenAI converts Anthropic tool format to OpenAI format

func ConvertOpenAIToAnthropic

func ConvertOpenAIToAnthropic(data []byte) (anthropic.ToolParam, error)

ConvertOpenAIToAnthropic converts OpenAI tool format to Anthropic format

func ConvertUnifiedToAnthropic

func ConvertUnifiedToAnthropic(unifiedTool *UnifiedTool) (*anthropic.ToolParam, error)

ConvertUnifiedToAnthropic converts UnifiedTool to Anthropic format

func ConvertUnifiedToGemini added in v0.0.7

func ConvertUnifiedToGemini(unifiedTool *UnifiedTool) (*genai.FunctionDeclaration, error)

func ConvertUnifiedToOpenAI

func ConvertUnifiedToOpenAI(unifiedTool *UnifiedTool) (*openai.ChatCompletionToolParam, error)

ConvertUnifiedToOpenAI converts UnifiedTool to OpenAI format

func JsonschemaToMap

func JsonschemaToMap(schema *jsonschema.JsonSchema) map[string]any

func ParseToolForAnthropic

func ParseToolForAnthropic(data []byte) (*anthropic.ToolParam, error)

ParseToolForAnthropic parses Anthropic tool format directly

func ParseToolForOpenAI

func ParseToolForOpenAI(data []byte) (*openai.ChatCompletionToolParam, error)

ParseToolForOpenAI parses OpenAI tool format directly

Types

type UnifiedTool

type UnifiedTool struct {
	Format      string                 `json:"format,omitempty"`
	Name        string                 `json:"name"`
	Description string                 `json:"description,omitempty"`
	Parameters  *jsonschema.JsonSchema `json:"parameters,omitempty"`

	// command to be executed
	Command []string `json:"command"`
}

UnifiedTool represents a unified tool definition

func AnthropicToUnified

func AnthropicToUnified(tool *anthropic.ToolParam) (*UnifiedTool, error)

func GetAllPresetTools added in v0.0.7

func GetAllPresetTools() ([]*UnifiedTool, error)

func GetPresetTools

func GetPresetTools(toolPresets []string) ([]*UnifiedTool, error)

func OpenAIToUnified

func OpenAIToUnified(tool *openai.ChatCompletionToolParam) (*UnifiedTool, error)

func Parse

func Parse(data []byte) (*UnifiedTool, error)

Parse parses a unified tool definition from JSON bytes

func (*UnifiedTool) ToAnthropic

func (t *UnifiedTool) ToAnthropic() (*anthropic.ToolParam, error)

ToAnthropic converts UnifiedTool to Anthropic ToolParam

func (*UnifiedTool) ToGemini added in v0.0.7

func (t *UnifiedTool) ToGemini() (*genai.FunctionDeclaration, error)

ToGemini converts UnifiedTool to Gemini ToolParam

func (*UnifiedTool) ToOpenAI

func (t *UnifiedTool) ToOpenAI() (*openai.ChatCompletionToolParam, error)

ToOpenAI converts UnifiedTool to OpenAI ChatCompletionToolParam

type UnifiedTools

type UnifiedTools []*UnifiedTool

func ParseSchemaData

func ParseSchemaData(toolJSONs []string) (UnifiedTools, error)

func ParseSchemaFiles

func ParseSchemaFiles(toolFiles []string) (UnifiedTools, error)

func ParseSchemas

func ParseSchemas(toolFiles []string, toolJSONs []string) (UnifiedTools, error)

func (UnifiedTools) ToAnthropic

func (c UnifiedTools) ToAnthropic() ([]anthropic.ToolUnionParam, error)

func (UnifiedTools) ToGemini added in v0.0.7

func (c UnifiedTools) ToGemini() ([]*genai.Tool, error)

func (UnifiedTools) ToOpenAI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL