tools

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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"`
}

UnifiedTool represents a unified tool definition

func AnthropicToUnified

func AnthropicToUnified(tool *anthropic.ToolParam) (*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) 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) ToOpenAI

Jump to

Keyboard shortcuts

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