Skip to content

Commit

Permalink
feat: add util functions for setting Anthropic defined tools
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowpigy committed Dec 12, 2024
1 parent af2596e commit 86739f4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,30 @@ type ToolDefinition struct {
CacheControl *MessageCacheControl `json:"cache_control,omitempty"`
}

func NewComputerUseToolDefinition(name string, displayWidthPx int, displayHeightPx int, displayNumber *int) ToolDefinition {
return ToolDefinition{
Type: "computer_20241022",
Name: name,
DisplayWidthPx: displayWidthPx,
DisplayHeightPx: displayHeightPx,
DisplayNumber: displayNumber,
}
}

func NewTextEditorToolDefinition(name string) ToolDefinition {
return ToolDefinition{
Type: "text_editor_20241022",
Name: name,
}
}

func NewBashToolDefinition(name string) ToolDefinition {
return ToolDefinition{
Type: "bash_20241022",
Name: name,
}
}

type ToolChoice struct {
// oneof: auto(default) any tool
Type string `json:"type"`
Expand Down

0 comments on commit 86739f4

Please sign in to comment.