From 9860dd2dc59cbf409cc138803c35b929a692f374 Mon Sep 17 00:00:00 2001 From: John Costa Date: Sat, 3 May 2025 17:31:55 +0100 Subject: [PATCH] feat(agents): providing a seed so it has more predictable results --- backend/agents/client/client.go | 4 ++++ backend/agents/contact_agent.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/agents/client/client.go b/backend/agents/client/client.go index ed260d0..1158abb 100644 --- a/backend/agents/client/client.go +++ b/backend/agents/client/client.go @@ -25,6 +25,8 @@ type AgentRequestBody struct { Tools *any `json:"tools,omitempty"` ToolChoice *string `json:"tool_choice,omitempty"` + RandomSeed *int `json:"random_seed,omitempty"` + EndToolCall string `json:"-"` Chat *Chat `json:"messages"` @@ -238,11 +240,13 @@ func (client *AgentClient) RunAgent(userId uuid.UUID, imageId uuid.UUID, imageNa } toolChoice := "any" + seed := 42 request := AgentRequestBody{ Tools: &tools, ToolChoice: &toolChoice, Model: "pixtral-12b-2409", + RandomSeed: &seed, Temperature: 0.3, EndToolCall: client.Options.EndToolCall, ResponseFormat: ResponseFormat{ diff --git a/backend/agents/contact_agent.go b/backend/agents/contact_agent.go index ba3e419..a57d286 100644 --- a/backend/agents/contact_agent.go +++ b/backend/agents/contact_agent.go @@ -80,15 +80,15 @@ const contactTools = ` }, "phoneNumber": { "type": "string", - "description": "The contact's primary phone number, including area or country code if available. Provide this if extracted from the image." + "description": "The contact's primary phone number, including area or country code if available. Provide this if extracted from the image. Only include this if you see a phone number, do not make it up." }, "address": { "type": "string", - "description": "The complete physical mailing address of the contact (e.g., street number, street name, city, state/province, postal code, country). Provide this if extracted from the image." + "description": "The complete physical mailing address of the contact (e.g., street number, street name, city, state/province, postal code, country). Provide this if extracted from the image. Only include this if you see an address. No not make it up." }, "email": { "type": "string", - "description": "The contact's primary email address. Provide this if extracted from the image." + "description": "The contact's primary email address. Provide this if extracted from the image. Only include this if you see an email, do not make it up." } }, "required": ["name"]