Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for maxTokens option in CLI and run functions #288

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/content/docs/reference/cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Options:
-t, --temperature <number> temperature for the run
-tp, --top-p <number> top-p for the run
-m, --model <string> model for the run
-mt, --max-tokens <number> maximum tokens for the run
-se, --seed <number> seed for the run
--no-cache disable LLM result cache
--cs, --csv-separator <string> csv separator (default: "\t")
Expand Down Expand Up @@ -73,6 +74,7 @@ Options:
-t, --temperature <number> temperature for the run
-tp, --top-p <number> top-p for the run
-m, --model <string> model for the run
-mt, --max-tokens <number> maximum tokens for the run
-se, --seed <number> seed for the run
--no-cache disable LLM result cache
-ae, --apply-edits apply file edits
Expand Down
10 changes: 9 additions & 1 deletion packages/cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async function batch(
temperature: string
topP: string
seed: string
maxTokens: string
model: string
cache: boolean
applyEdits: boolean
Expand Down Expand Up @@ -183,6 +184,7 @@ async function batch(
const temperature = normalizeFloat(options.temperature)
const topP = normalizeFloat(options.topP)
const seed = normalizeFloat(options.seed)
const maxTokens = normalizeInt(options.maxTokens)

const toolFiles: string[] = []
if (scriptRx.test(tool)) toolFiles.push(tool)
Expand Down Expand Up @@ -262,6 +264,7 @@ async function batch(
temperature,
topP,
seed,
maxTokens,
model,
retry,
retryDelay,
Expand Down Expand Up @@ -392,6 +395,7 @@ async function run(
temperature: string
topP: string
seed: string
maxTokens: string
model: string
csvSeparator: string
cache: boolean
Expand All @@ -417,6 +421,7 @@ async function run(
const temperature = normalizeFloat(options.temperature)
const topP = normalizeFloat(options.topP)
const seed = normalizeFloat(options.seed)
const maxTokens = normalizeInt(options.maxTokens)
const cache = !!options.cache
const applyEdits = !!options.applyEdits
const model = options.model
Expand All @@ -439,7 +444,7 @@ async function run(
if (scriptRx.test(tool)) toolFiles.push(tool)

if (!specs?.length) {
specContent = (await getStdin() || "\n")
specContent = (await getStdin()) || "\n"
spec = "stdin.gpspec.md"
} else if (specs.length === 1 && gpspecRx.test(specs[0])) {
spec = specs[0]
Expand Down Expand Up @@ -520,6 +525,7 @@ ${Array.from(files)
temperature,
topP,
seed,
maxTokens,
model,
retry,
retryDelay,
Expand Down Expand Up @@ -886,6 +892,7 @@ async function main() {
.option("-t, --temperature <number>", "temperature for the run")
.option("-tp, --top-p <number>", "top-p for the run")
.option("-m, --model <string>", "model for the run")
.option("-mt, --max-tokens <number>", "maximum tokens for the run")
.option("-se, --seed <number>", "seed for the run")
.option("--no-cache", "disable LLM result cache")
.option("--cs, --csv-separator <string>", "csv separator", "\t")
Expand Down Expand Up @@ -922,6 +929,7 @@ async function main() {
.option("-t, --temperature <number>", "temperature for the run")
.option("-tp, --top-p <number>", "top-p for the run")
.option("-m, --model <string>", "model for the run")
.option("-mt, --max-tokens <number>", "maximum tokens for the run")
.option("-se, --seed <number>", "seed for the run")
.option("--no-cache", "disable LLM result cache")
.option("-ae, --apply-edits", "apply file edits")
Expand Down
Loading