From 838fc48abe5b5c05a06e983646362b1fc59ba9bb Mon Sep 17 00:00:00 2001 From: "L.F. Severgnini" Date: Fri, 7 Jul 2023 17:35:48 -0300 Subject: [PATCH] add 'OPENAI_API_MODEL' parameter --- README.md | 1 + action.yml | 4 ++++ src/main.ts | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ff62cb..ffad823 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_API_MODEL: "gpt-4" # Optional: defaults to "gpt-4" exclude: "**/*.json, **/*.md" # Optional: exclude patterns separated by commas ``` diff --git a/action.yml b/action.yml index 6efc5a6..976aed7 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,10 @@ inputs: OPENAI_API_KEY: description: "OpenAI API key for GPT." required: true + OPENAI_API_MODEL: + description: "OpenAI API model." + required: false + default: "gpt-4" exclude: description: "Glob patterns to exclude files from the diff analysis" required: false diff --git a/src/main.ts b/src/main.ts index c9f7144..b3b0b9e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,6 +7,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 octokit = new Octokit({ auth: GITHUB_TOKEN }); @@ -132,7 +133,7 @@ async function getAIResponse(prompt: string): Promise | null> { const queryConfig = { - model: "gpt-4", + model: OPENAI_API_MODEL, temperature: 0.2, max_tokens: 700, top_p: 1,