diff --git a/backend/pkg/ai/ai.go b/backend/pkg/ai/ai.go index ed45732..f0ec27c 100644 --- a/backend/pkg/ai/ai.go +++ b/backend/pkg/ai/ai.go @@ -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(), diff --git a/backend/pkg/ai/ai_tools.go b/backend/pkg/ai/ai_tools.go index 01b96e6..84055e0 100644 --- a/backend/pkg/ai/ai_tools.go +++ b/backend/pkg/ai/ai_tools.go @@ -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{