From 4b549017d2274d62f532c3ad00b7706f78fac824 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Tue, 3 Dec 2024 22:12:52 +0100 Subject: o1 support - max_completion_tokens --- py/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'py') diff --git a/py/utils.py b/py/utils.py index c54f2e5..604494c 100644 --- a/py/utils.py +++ b/py/utils.py @@ -51,12 +51,17 @@ def normalize_config(config): def make_openai_options(options): max_tokens = int(options['max_tokens']) - return { + max_completion_tokens = int(options['max_completion_tokens']) + result = { 'model': options['model'], - 'max_tokens': max_tokens if max_tokens > 0 else None, 'temperature': float(options['temperature']), 'stream': int(options['stream']) == 1, } + if max_tokens > 0: + result['max_tokens'] = max_tokens + if max_completion_tokens > 0: + result['max_completion_tokens'] = max_completion_tokens + return result def make_http_options(options): return { -- cgit v1.2.3