Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Bug: cannot call unmapped models without setting max_tokens #114

Description

@nev-ball

When using an unmapped model (e.g. any Azure model), if max_tokens is not set when calling a type error is raised:

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Traceback:

File .../lisette/core.py:541, in AsyncChat._call(self, msg, prefill, temp, think, search, stream, max_steps, step, final_prompt, tool_choice, max_tokens, **kwargs)
    538 if step>max_steps+1: return
    539 prefill, max_tokens = self._prep_call(prefill, search, max_tokens, kwargs)
    540 res = await acompletion(model=self.model, messages=self._prep_msg(msg, prefill), stream=stream,
--> 541                  tools=self.tool_schemas, reasoning_effort=effort.get(think), tool_choice=tool_choice, max_tokens=int(max_tokens),
    542                  # temperature is not supported when reasoning
    543                  temperature=None if think else ifnone(temp,self.temp), 
    544                  caching=self.cache and 'claude' not in self.model,
    545                  **kwargs)
    546 if stream:
    547     if prefill: yield _mk_prefill(prefill)

It looks like Chat._prep_call does the following:
if max_tokens is None: max_tokens = model_info.get('max_output_tokens')
After which it is assumed max_tokens is not None, but this is only true for mapped models.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions