hack: to get response format to work properly

I think this might be a bug with requesty
This commit is contained in:
2025-10-05 15:35:09 +01:00
parent bd86ad499b
commit 38bda46dcf

View File

@ -22,7 +22,7 @@ and add a good description for each one.
You can add fields if you think they make a lot of sense.
You can remove fields if they are not correct, but be sure before you do this.
You must respond in json format
You must respond in json format, do not add backticks to the json. ONLY valid json.
`
const listJsonSchema = `
@ -86,7 +86,7 @@ func (agent *CreateListAgent) CreateList(log *log.Logger, userID uuid.UUID, stac
Model: "policy/images",
Temperature: 0.3,
ResponseFormat: client.ResponseFormat{
Type: "json_object",
Type: "json_schema",
JsonSchema: listJsonSchema,
},
Chat: &client.Chat{
@ -107,7 +107,9 @@ func (agent *CreateListAgent) CreateList(log *log.Logger, userID uuid.UUID, stac
ctx := context.Background()
structuredOutput := resp.Choices[0].Message.Content
content := resp.Choices[0].Message.Content
structuredOutput := content[len("```json") : len(content)-3]
log.Info("", "res", structuredOutput)