Skip to content

Commit 9d263ec

Browse files
committed
Add a --max-tokens option
1 parent 5999a78 commit 9d263ec

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn generate(input: impl AsRef<str>, options: &Options) -> Result<Vec<String>
3636
});
3737

3838
if let Some(max_tokens) = options.max_tokens {
39-
req["max_output_tokens"] = max_tokens.into();
39+
req["max_completion_tokens"] = max_tokens.into();
4040
}
4141

4242
let mut resp = ureq::Agent::config_builder()

src/prompter/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ struct Options {
1515
#[clap(flatten)]
1616
flags: StandardOptions,
1717

18+
/// Choose which model to use.
1819
#[clap(long, short = 'm')]
1920
model: Option<String>,
2021

22+
/// Maximum number of tokens to generate.
23+
#[clap(long)]
24+
max_tokens: Option<usize>,
25+
2126
input: Option<String>,
2227
output: Option<String>,
2328
}
@@ -99,6 +104,7 @@ pub fn main() -> Result<SysexitsError> {
99104
.endpoint(endpoint)
100105
.model(model)
101106
.api_key(api_key)
107+
.maybe_max_tokens(options.max_tokens)
102108
.build();
103109

104110
let response =

0 commit comments

Comments
 (0)