Update main.ts

Always enforce json mode
This commit is contained in:
jdriscoll98 2024-07-26 12:00:35 -07:00 committed by GitHub
parent a9a064dfa1
commit 8dcc039385
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,9 +127,7 @@ async function getAIResponse(prompt: string): Promise<Array<{
const response = await openai.chat.completions.create({
...queryConfig,
// return JSON if the model supports it:
...(OPENAI_API_MODEL === "gpt-4-1106-preview"
? { response_format: { type: "json_object" } }
: {}),
response_format: { type: "json_object" },
messages: [
{
role: "system",