mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-21 01:56:47 +00:00
Allows to set OPENAI_JSON_MODE
This commit is contained in:
parent
a9a064dfa1
commit
784cc55d5d
1 changed files with 2 additions and 1 deletions
|
@ -8,6 +8,7 @@ import minimatch from "minimatch";
|
|||
const GITHUB_TOKEN: string = core.getInput("GITHUB_TOKEN");
|
||||
const OPENAI_API_KEY: string = core.getInput("OPENAI_API_KEY");
|
||||
const OPENAI_API_MODEL: string = core.getInput("OPENAI_API_MODEL");
|
||||
const OPENAI_JSON_MODE: string = core.getInput("OPENAI_JSON_MODE");
|
||||
|
||||
const octokit = new Octokit({ auth: GITHUB_TOKEN });
|
||||
|
||||
|
@ -127,7 +128,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"
|
||||
...(OPENAI_JSON_MODE === "true"
|
||||
? { response_format: { type: "json_object" } }
|
||||
: {}),
|
||||
messages: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue