give reasoning when expanding parameters

This commit is contained in:
Ettore Di Giacinto
2024-04-17 00:40:53 +02:00
parent 9d0dcf792a
commit 4a42ec0487
2 changed files with 17 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ func (a *Agent) decision(
}
if len(resp.Choices) != 1 {
return nil, fmt.Errorf("no choices")
return nil, fmt.Errorf("no choices: %d", len(resp.Choices))
}
msg := resp.Choices[0].Message
@@ -131,7 +131,10 @@ func (a *Agent) generateParameters(ctx context.Context, pickTemplate string, act
}
return a.decision(ctx,
conversation,
append(conversation, openai.ChatCompletionMessage{
Role: "system",
Content: fmt.Sprintf("The agent decided to use the tool %s with the following reasoning: %s", act.Definition().Name, reasoning),
}),
a.systemInternalActions().ToTools(),
openai.ToolChoice{
Type: openai.ToolTypeFunction,