feat: Add model listing functionality#3900
feat: Add model listing functionality#3900Zephyroam wants to merge 8 commits intocamel-ai:masterfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…l-list-for-providers
|
Due to the API key limitation, I only tested with the following providers: |
| _API_KEY_ENV_VAR: str = "INTERNLM_API_KEY" | ||
| _BASE_URL_ENV_VAR: str = "INTERNLM_API_BASE_URL" | ||
| _DEFAULT_BASE_URL: str = "https://internlm.intern-ai.org.cn/api/v1" | ||
|
|
There was a problem hiding this comment.
I think the default URL changed from https://internlm.intern-ai.org.cn/api/tokens to https://internlm.intern-ai.org.cn/api/v1 — why has this been changed?
There was a problem hiding this comment.
I believe the old one should be wrong, according to https://internlm.intern-ai.org.cn/api/document?lang=en.
…est-support-retrieve-model-list-for-providers
…ple model classes
…OpenAICompatibleModel, OpenAIModel, and SambaModel classes
|
API_KEY hardcoding and |
…l-list-for-providers
fengju0213
left a comment
There was a problem hiding this comment.
thanks @Zephyroam left some comments
| api_version = os.environ.get(cls._API_VERSION_ENV_VAR) | ||
| azure_ad_token = os.environ.get(cls._AZURE_AD_TOKEN_ENV_VAR) | ||
|
|
||
| client = AzureOpenAI( |
There was a problem hiding this comment.
i think we directly use the client we init when init?
| api_key: Optional[str], | ||
| url: Optional[str], |
There was a problem hiding this comment.
i think we don't need api_key and url here?
|
|
||
| return cast(AsyncStream[ChatCompletionChunk], _generate_chunks()) | ||
|
|
||
| @classmethod |
There was a problem hiding this comment.
I think an instance method would be a better fit here, since it can directly reuse the
client initialized in init.
|
Making @fengju0213 How do you think? |
…l-list-for-providers
Related Issue
Closes #3899
Description
What is the purpose of this pull request?
Checklist
pyproject.tomland runuv lockIf you are unsure about any of these, don't hesitate to ask. We are here to help!