Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a custom OpenAI provider to use multiple models, resolve coupled input fields, add Embedding Fields to config #1264

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

srdas
Copy link
Collaborator

@srdas srdas commented Feb 27, 2025

Description

The OpenAI model interface has been widely adopted by many model providers (DeepSeek, vLLM, etc.) and this PR enables accessing these models using the OpenAI provider. Current OpenAI models are also accessible via the same interface.

This PR also updates related documentation on the use of these models that work via the OpenAI provider.

These updates work for selecting chat and embeddings models. Chat models are tested to work with models from OpenAI, DeepSeek, and models hosted by vLLM. Embedding models are tested for OpenAI models. DeepSeek does not have an API for embedding models, and OpenRouter also does not support as yet any embedding models.

Also, this PR corrects the coupled fields problem in the AI Settings page.

Finally, added the embedding fields to the config_scheme.json and made related changes to config_manager.py and test_ config_manager.py

Each of these changes is now described below in some more detail.

Demo of new features

See the new usage of models and the required settings shown below, note the new "OpenAI::general interface":
image

For any OpenAI model:
openai-chat-openai

For DeepSeek models:
openai-chat-deepseek

For models deployed with vLLM:
openai-chat-vllm

Embedding Models

First, tested to make sure that the OpenAI models are working as intended with no changes to the code:
image

Second, modified check that the interface takes any OpenAI embedding model as an input and test that it works with OpenAI models as before:

image

Fixed coupled model field inputs

We can see that the fields are not coupled any more as shown below:
image

Added embeddings_fields to config_schema.json

  • Updated config_manager.py to handle the new fields.
  • Also updated analogous code for continuation models.
  • Updated test_config_manager.py for the additional embedding field in config.

@srdas srdas added the enhancement New feature or request label Feb 27, 2025
@srdas srdas changed the title Create a custom OpenAI provider to use multiple model providers Create a custom OpenAI provider to use multiple models Feb 27, 2025
@srdas srdas marked this pull request as ready for review February 27, 2025 19:57
@dlqqq dlqqq linked an issue Feb 27, 2025 that may be closed by this pull request
@srdas srdas force-pushed the openai_generic_2 branch from 1ba53fd to f59026b Compare March 5, 2025 06:20
@srdas srdas requested a review from dlqqq March 5, 2025 15:38
@srdas srdas changed the title Create a custom OpenAI provider to use multiple models Create a custom OpenAI provider to use multiple models, resolve coupled input fields, add Embedding Fields to config Mar 10, 2025
srdas and others added 7 commits March 10, 2025 15:21
* make native chat handlers customizable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove-ci-error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add-disabled-check-and-sort-entrypoints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor Chat Handlers to Simplify Initialization (jupyterlab#1257)

* simplify-entrypoints-loading

* fix-lint

* fix-tests

* add-retriever-typing

* remove-retriever-from-base

* fix-circular-import(ydoc-import)

* fix-tests

* fix-type-check-failure

* refactor-retriever-init

* Allow chat handlers to be initialized in any order (jupyterlab#1268)

* lazy-initialize-retriever

* add-retriever-property

* rebase-into-main

* update-docs

* update-documentation

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants