mirror of
https://github.com/sudoxreboot/groqd
synced 2026-04-14 11:36:49 +00:00
Coerce max_tokens to int
This commit is contained in:
parent
595c3ba9cf
commit
c0018e2241
1 changed files with 9 additions and 1 deletions
|
|
@ -257,6 +257,14 @@ class GroqdConversationEntity(
|
|||
{"type": "json_object"} if response_format == "json_object" else NOT_GIVEN
|
||||
)
|
||||
|
||||
max_tokens_value = options.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS)
|
||||
try:
|
||||
max_tokens_value = int(max_tokens_value)
|
||||
except (TypeError, ValueError):
|
||||
max_tokens_value = DEFAULT_MAX_TOKENS
|
||||
if max_tokens_value <= 0:
|
||||
max_tokens_value = DEFAULT_MAX_TOKENS
|
||||
|
||||
for _iteration in range(MAX_TOOL_ITERATIONS):
|
||||
try:
|
||||
result = await client.chat.completions.create(
|
||||
|
|
@ -267,7 +275,7 @@ class GroqdConversationEntity(
|
|||
parallel_tool_calls=options.get(
|
||||
CONF_PARALLEL_TOOL_CALLS, DEFAULT_PARALLEL_TOOL_CALLS
|
||||
),
|
||||
max_tokens=options.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS),
|
||||
max_tokens=max_tokens_value,
|
||||
top_p=options.get(CONF_TOP_P, DEFAULT_TOP_P),
|
||||
temperature=options.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE),
|
||||
frequency_penalty=options.get(
|
||||
|
|
|
|||
Loading…
Reference in a new issue