From 5b62ecd0dda9837a6e4a4b7e0ab565ef85600a9a Mon Sep 17 00:00:00 2001 From: Paulo Santos Date: Wed, 4 Feb 2026 12:12:14 +0000 Subject: [PATCH] add temperature and top-p input parameters --- action.yml | 8 ++++++++ src/main.ts | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 0d6084d..ba19576 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,14 @@ inputs: description: The maximum number of tokens to generate required: false default: '200' + temperature: + description: The sampling temperature to use (0-1) + required: false + default: '' + top-p: + description: The nucleus sampling parameter to use (0-1) + required: false + default: '' token: description: The token to use required: false diff --git a/src/main.ts b/src/main.ts index ce0c135..ad1b472 100644 --- a/src/main.ts +++ b/src/main.ts @@ -65,6 +65,13 @@ export async function run(): Promise { const endpoint = core.getInput('endpoint') + // Get temperature and topP (prompt YAML modelParameters takes precedence over action inputs) + const temperatureInput = core.getInput('temperature') + const topPInput = core.getInput('top-p') + const temperature = + promptConfig?.modelParameters?.temperature ?? (temperatureInput !== '' ? parseFloat(temperatureInput) : undefined) + const topP = promptConfig?.modelParameters?.topP ?? (topPInput !== '' ? parseFloat(topPInput) : undefined) + // Parse custom headers const customHeadersInput = core.getInput('custom-headers') const customHeaders = parseCustomHeaders(customHeadersInput) @@ -75,8 +82,8 @@ export async function run(): Promise { systemPrompt, prompt, modelName, - promptConfig?.modelParameters?.temperature, - promptConfig?.modelParameters?.topP, + temperature, + topP, maxTokens, endpoint, token,