Skip to content

Commit

Permalink
Tool for closed time
Browse files Browse the repository at this point in the history
  • Loading branch information
kozaktomas committed Dec 13, 2024
1 parent 1a4d740 commit 0978ebc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/pkg/ai/ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewAi(ctx context.Context, conf *config.Config, s *scale.Scale, m *promethe
ai.currentTimeTool(),
ai.isOpenTool(),
ai.pubOpenedAtTool(),
ai.pubClosedAtTool(),
ai.currentKegTools(),
ai.beersLeftTool(),
ai.kegTappedAtTool(),
Expand Down
22 changes: 22 additions & 0 deletions backend/pkg/ai/ai_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ func (ai *Ai) pubOpenedAtTool() tool {
}
}

func (ai *Ai) pubClosedAtTool() tool {
return tool{
Definition: anthropic.ToolDefinition{
Name: "pub_close_at",
Description: "Returns the date and time when the pub was closed last.",
InputSchema: jsonschema.Definition{
Type: jsonschema.Object,
Properties: map[string]jsonschema.Definition{},
Required: []string{""},
},
},
Fn: func(_ string) (string, error) {
data := ai.scale.GetScale()
if data.Pub.IsOpen {
return "The pub is open.", nil
}

return data.Pub.ClosedAt, nil
},
}
}

func (ai *Ai) currentKegTools() tool {
return tool{
Definition: anthropic.ToolDefinition{
Expand Down

0 comments on commit 0978ebc

Please sign in to comment.