Merge pull request #1 from jdriscoll98/jdriscoll98/always-support-json-mode

Update main.ts
This commit is contained in:
jdriscoll98 2024-07-26 15:00:58 -04:00 committed by GitHub
commit 4dc001ac8f
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",