FidelusAleksander / FidelusAleksander/prompt-action

Add configurable max-tokens parameter

Open
#73 1 comment 0 reactions 0 assignees View on GitHub
enhancement feature
Dominant language
TypeScript
Stars
12
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Summary
Add support for configurable max tokens to control response length and manage costs. This feature would allow users to specify the maximum number of tokens the AI model should generate in its response.

## Background
Currently, the action doesn't provide control over response length, which can lead to:
- Unexpectedly long responses that exceed GitHub Actions output limits
- Higher costs for longer responses
- Inconsistent response lengths across different use cases

## Proposed Solution
Add a `max-tokens` input parameter that controls the maximum number of tokens in the AI response.

## Acceptance Criteria
- [ ] Add `max-tokens` input parameter with default value of 200 (matching `actions/ai-inference`)
- [ ] Update `action.yml` to include the new input parameter
- [ ] Update the AI function to pass the max-tokens parameter to the OpenAI API
- [ ] Add input validation to ensure max-tokens is a positive integer
- [ ] Add unit tests covering:
- Default max-tokens behavior
- Custom max-tokens values
- Input validation for invalid values
- [ ] Update README with examples showing max-tokens usage
- [ ] Document recommended max-tokens values for different use cases

## Examples
```yaml
# Short responses for quick answers
- uses: FidelusAleksander/prompt-action@v1
with:
prompt: "What is the capital of France?"
max-tokens: 50

# Longer responses for detailed explanations
- uses: FidelusAleksander/prompt-action@v1
with:
prompt: "Explain how to set up a CI/CD pipeline"
max-tokens: 500
```

## Implementation Notes
- Validate that max-tokens is a positive integer
- Consider adding a reasonable upper limit (e.g., 4000 tokens)
- Ensure backward compatibility with existing workflows
- Document the relationship between tokens and approximate word count

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.