add temperature and top-p input parameters

This commit is contained in:
Paulo Santos
2026-02-04 12:12:14 +00:00
committed by GitHub
parent a6101c89c6
commit 5b62ecd0dd
2 changed files with 17 additions and 2 deletions

View File

@@ -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

View File

@@ -65,6 +65,13 @@ export async function run(): Promise<void> {
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<void> {
systemPrompt,
prompt,
modelName,
promptConfig?.modelParameters?.temperature,
promptConfig?.modelParameters?.topP,
temperature,
topP,
maxTokens,
endpoint,
token,