diff --git a/backend/agents/create_list_agent.go b/backend/agents/create_list_agent.go index 86ab4ac..6abac40 100644 --- a/backend/agents/create_list_agent.go +++ b/backend/agents/create_list_agent.go @@ -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)