Skip to content

Commit

Permalink
add more model params
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Oct 26, 2024
1 parent 7837e52 commit 3b08537
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
openai_base_url: ${{ secrets.OPENAI_BASE_URL }}
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
openai_model: ${{ vars.OPENAI_MODEL }}
openai_temperature: ${{ vars.OPENAI_TEMPERATURE }}
openai_top_p: ${{ vars.OPENAI_TOP_P }}
openai_frequency_penalty: ${{ vars.OPENAI_FREQUENCY_PENALTY }}
openai_presence_penalty: ${{ vars.OPENAI_PRESENCE_PENALTY }}
system_prompt: ${{ vars.ISSUES_SYSTEM_PROMPT }}
available_tools: ${{ vars.ISSUES_AVAILABLE_TOOLS }}
user_input: |
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ openai_api_key: # OpenAI API Key
openai_model: # OpenAI Model
# Default Value is "gpt-4o-mini"

openai_temperature: # OpenAI Temperature
# Default not set

openai_top_p: # OpenAI Top P
# Default not set

openai_frequency_penalty: # OpenAI Frequency Penalty
# Default not set

openai_presence_penalty: # OpenAI Presence Penalty
# Default not set

system_prompt: # System Prompt for the assistant

user_input: # User Input for the assistant
Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ inputs:
description: "OpenAI Model"
required: false
default: "gpt-4o-mini"
openai_temperature:
description: "OpenAI Temperature"
required: false
openai_top_p:
description: "OpenAI Top P"
required: false
openai_frequency_penalty:
description: "OpenAI Frequency Penalty"
required: false
openai_presence_penalty:
description: "OpenAI Presence Penalty"
required: false
system_prompt:
description: "System Prompt for the assistant"
required: true
Expand Down
28 changes: 28 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { RunnableToolFunctionWithParse } from "openai/lib/RunnableFunction";
export let openai_base_url: string;
export let openai_api_key: string;
export let openai_model: string;
export let openai_temperature: number | undefined;
export let openai_top_p: number | undefined;
export let openai_frequency_penalty: number | undefined;
export let openai_presence_penalty: number | undefined;
export let system_prompt: string;
export let user_input: string;
export let github_token: string;
Expand All @@ -24,6 +28,18 @@ async function checkInput() {
if (!openai_model) {
openai_model = "gpt-4o-mini";
}
if (isNaN(openai_temperature || NaN)) {
openai_temperature = undefined;
}
if (isNaN(openai_top_p || NaN)) {
openai_top_p = undefined;
}
if (isNaN(openai_frequency_penalty || NaN)) {
openai_frequency_penalty = undefined;
}
if (isNaN(openai_presence_penalty || NaN)) {
openai_presence_penalty = undefined;
}
if (!system_prompt) {
throw new Error("system_prompt is required");
}
Expand All @@ -49,6 +65,14 @@ async function main() {
openai_base_url = core.getInput("openai_base_url");
openai_api_key = core.getInput("openai_api_key");
openai_model = core.getInput("openai_model");
openai_temperature = parseFloat(core.getInput("openai_temperature"));
openai_top_p = parseFloat(core.getInput("openai_top_p"));
openai_frequency_penalty = parseFloat(
core.getInput("openai_frequency_penalty")
);
openai_presence_penalty = parseFloat(
core.getInput("openai_presence_penalty")
);
system_prompt = core.getInput("system_prompt");
user_input = core.getInput("user_input");
github_token = core.getInput("github_token");
Expand All @@ -61,6 +85,10 @@ async function main() {
});
const runner = openai.beta.chat.completions.runTools({
model: openai_model,
temperature: openai_temperature,
frequency_penalty: openai_frequency_penalty,
top_p: openai_top_p,
presence_penalty: openai_presence_penalty,
messages: [
{
role: "system",
Expand Down

0 comments on commit 3b08537

Please sign in to comment.