Merge pull request #168 from GitPaulo/gitpaulo/fork-add-temperature-topp-params
Add model parameters temperature and topP to action inputs
This commit is contained in:
@@ -288,6 +288,8 @@ the action:
|
||||
| `model` | The model to use for inference. Must be available in the [GitHub Models](https://github.com/marketplace?type=models) catalog | `openai/gpt-4o` |
|
||||
| `endpoint` | The endpoint to use for inference. If you're running this as part of an org, you should probably use the org-specific Models endpoint | `https://models.github.ai/inference` |
|
||||
| `max-tokens` | The max number of tokens to generate | 200 |
|
||||
| `temperature` | The sampling temperature to use (0-1) | `""` |
|
||||
| `top-p` | The nucleus sampling parameter to use (0-1) | `""` |
|
||||
| `enable-github-mcp` | Enable Model Context Protocol integration with GitHub tools | `false` |
|
||||
| `github-mcp-token` | Token to use for GitHub MCP server (defaults to the main token if not specified). | `""` |
|
||||
| `custom-headers` | Custom HTTP headers to include in API requests. Supports both YAML format (`header1: value1`) and JSON format (`{"header1": "value1"}`). Useful for API Management platforms, rate limiting, and request tracking. | `""` |
|
||||
|
||||
@@ -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
|
||||
|
||||
+6
-1
@@ -61548,11 +61548,16 @@ async function run() {
|
||||
const githubMcpToken = coreExports.getInput('github-mcp-token') || token;
|
||||
const githubMcpToolsets = coreExports.getInput('github-mcp-toolsets');
|
||||
const endpoint = coreExports.getInput('endpoint');
|
||||
// Get temperature and topP (prompt YAML modelParameters takes precedence over action inputs)
|
||||
const temperatureInput = coreExports.getInput('temperature');
|
||||
const topPInput = coreExports.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 = coreExports.getInput('custom-headers');
|
||||
const customHeaders = parseCustomHeaders(customHeadersInput);
|
||||
// Build the inference request with pre-processed messages and response format
|
||||
const inferenceRequest = buildInferenceRequest(promptConfig, systemPrompt, prompt, modelName, promptConfig?.modelParameters?.temperature, promptConfig?.modelParameters?.topP, maxTokens, endpoint, token, customHeaders);
|
||||
const inferenceRequest = buildInferenceRequest(promptConfig, systemPrompt, prompt, modelName, temperature, topP, maxTokens, endpoint, token, customHeaders);
|
||||
const enableMcp = coreExports.getBooleanInput('enable-github-mcp') || false;
|
||||
let modelResponse = null;
|
||||
if (enableMcp) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+9
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user