simonw / simonw/llm

Can't get AsyncModel from extra-openai-models.yaml?

Open
#963 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
12.5k
Forks
998
Avg merge
3d 13h
Merged PRs (30d)
10

Description

It looks like currently there is no way to get an AsyncModel from a custom model defined via extra-openai-models.yaml?

Looking at register_models in https://github.com/simonw/llm/blob/main/llm/default_plugins/openai_models.py , the standard OpenAI models all get both Chat and AsyncChat versions (or Completion, for gpt-3.5-instruct); however models defined in extra_models only get a Chat (or Completion) version, no Async.

It is not immediately clear to me whether it would be correct to set up an AsyncChat model version for all OpenAI chat completion API-compatible models, or whether there are some API-compatible models for which only a sync Chat model should be created. If there's a reason to only support synchronous calls for some API-compatible models, perhaps add an optional syncOnly: True flag in the yaml definition? Otherwise, it would be nice to create both Chat and AsyncChat versions for all extra OpenAI compatible models, as is currently done for the standard OpenAI models.

I'm using the python API to access several different models from multiple providers, including some locally-hosted models served through vllm's OpenAI compatible API. The best way I have found so far to access these vllm models is by defining them in extra-openai-models.yaml, but right now this seems to keep me restricted to using only the synchronous API.

Thanks much!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in llm/default_plugins/openai_models.py at register_models and compare how standard OpenAI models receive Chat and AsyncChat variants with how extra-openai-models.yaml entries are registered. Use the Python API examples in the issue to verify that custom OpenAI-compatible models expose the intended asynchronous access, while deciding whether synchronous-only models need an explicit configuration option.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.