Skip to content

Fix AsyncChat to handle unmapped models (fixes #42)#100

Merged
jph00 merged 1 commit intomainfrom
fix-asyncchat-unmapped-models
Feb 4, 2026
Merged

Fix AsyncChat to handle unmapped models (fixes #42)#100
jph00 merged 1 commit intomainfrom
fix-asyncchat-unmapped-models

Conversation

@PiotrCzapla
Copy link
Contributor

Apply the same fix from #68 to AsyncChat._call() method. Wraps get_model_info() in try-except to register unknown models before querying their info.

Apply the same fix from #68 to AsyncChat._call() method.
Wraps get_model_info() in try-except to register unknown models
before querying their info, allowing AsyncChat to work with new
OpenRouter models not yet in litellm's model registry.
@PiotrCzapla
Copy link
Contributor Author

The failed test are due to nbdev v3 not being released, I had the same issue in solveit, fixed it by pip installing main from nbdev.

The removal of settings.ini made cachy misbehave, it looks for the root of the project in settings.ini

@PiotrCzapla PiotrCzapla marked this pull request as draft January 28, 2026 16:01
@jph00
Copy link
Contributor

jph00 commented Jan 29, 2026

Thanks! What's needed to move this from draft? BTW want to see if there's some dupe code you can factor out across the 2 implementations?

@PiotrCzapla
Copy link
Contributor Author

PiotrCzapla commented Jan 29, 2026

It is ready, cachy wasn't working with nbdev3, I see that you fixed cachy already, make sense.
If you would release nbdev3 and run the pr it would run without cachy. To save some tokens and time I converted it to a draft.

I would love unify async and sync code, I'll make another pr.

Copy link

@nev-ball nev-ball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sync Chat._call method also has the following (just before calling completion):

        if self.api_base: kwargs['api_base'] = self.api_base
        if self.api_key: kwargs['api_key'] = self.api_key

You could include that in this PR too so that azure models are supported at the same time

@PiotrCzapla
Copy link
Contributor Author

@nev-ball good catch, thx for letting me know, the refactor is being developed here: #101

@PiotrCzapla PiotrCzapla marked this pull request as ready for review January 31, 2026 09:07
Comment on lines +516 to +517
try:
model_info = get_model_info(self.model)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
model_info = get_model_info(self.model)
try: model_info = get_model_info(self.model)

Minor FYI - no need to use 2 lines for stuff like this.

@jph00 jph00 merged commit a57d089 into main Feb 4, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants