Skip to content

Commit 0e2c4e4

Browse files
Added help text fields for embedding providers in the AI Setting page (#1288)
* Update `/learn.py` to log missing vector store * Added help text for embeddings providers that use a registry * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Adds HF and OpenAI help for embeddings providers --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b4f4369 commit 0e2c4e4

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

packages/jupyter-ai-magics/jupyter_ai_magics/embedding_providers.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import ClassVar, List
1+
from typing import ClassVar, List, Optional
22

33
from jupyter_ai_magics.providers import (
44
AuthStrategy,
@@ -31,6 +31,10 @@ class BaseEmbeddingsProvider(BaseModel):
3131
"""List of supported models by their IDs. For registry providers, this will
3232
be just ["*"]."""
3333

34+
help: ClassVar[Optional[str]] = None
35+
"""Text to display in lieu of a model list for a registry provider that does
36+
not provide a list of models."""
37+
3438
model_id_key: ClassVar[str] = ...
3539
"""Kwarg expected by the upstream LangChain provider."""
3640

@@ -70,6 +74,10 @@ class HfHubEmbeddingsProvider(BaseEmbeddingsProvider, HuggingFaceHubEmbeddings):
7074
name = "Hugging Face Hub"
7175
models = ["*"]
7276
model_id_key = "repo_id"
77+
help = (
78+
"See [https://huggingface.co/docs/chat-ui/en/configuration/embeddings](https://huggingface.co/docs/chat-ui/en/configuration/embeddings) for reference. "
79+
"Pass an embedding model's name; for example, `sentence-transformers/all-MiniLM-L6-v2`."
80+
)
7381
# ipywidgets needed to suppress tqdm warning
7482
# https://stackoverflow.com/questions/67998191
7583
# tqdm is a dependency of huggingface_hub

packages/jupyter-ai-magics/jupyter_ai_magics/partner_providers/ollama.py

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class OllamaEmbeddingsProvider(BaseEmbeddingsProvider, OllamaEmbeddings):
2424
name = "Ollama"
2525
# source: https://ollama.com/library
2626
model_id_key = "model"
27+
help = (
28+
"See [https://ollama.com/search?c=embedding](https://ollama.com/search?c=embedding) for a list of models. "
29+
"Pass an embedding model's name; for example, `mxbai-embed-large`."
30+
)
2731
models = ["*"]
2832
registry = True
2933
fields = [

packages/jupyter-ai-magics/jupyter_ai_magics/partner_providers/openai.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ChatOpenAICustomProvider(BaseProvider, ChatOpenAI):
9393
),
9494
TextField(key="openai_proxy", label="Proxy (optional)", format="text"),
9595
]
96-
help = "Supports non-OpenAI model that use the OpenAI API interface. Replace the OpenAI API key with the API key for the chosen provider."
96+
help = "Supports non-OpenAI models that use the OpenAI API interface. Replace the OpenAI API key with the API key for the chosen provider."
9797
registry = True
9898

9999

@@ -143,6 +143,7 @@ class OpenAIEmbeddingsCustomProvider(BaseEmbeddingsProvider, OpenAIEmbeddings):
143143
key="openai_api_base", label="Base API URL (optional)", format="text"
144144
),
145145
]
146+
help = "Supports non-OpenAI embedding models that use the OpenAI API interface. Replace the OpenAI API key with the API key for the chosen provider."
146147

147148

148149
class AzureOpenAIEmbeddingsProvider(BaseEmbeddingsProvider, AzureOpenAIEmbeddings):

packages/jupyter-ai/jupyter_ai/handlers.py

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def get(self):
140140
id=provider.id,
141141
name=provider.name,
142142
models=provider.models,
143+
help=provider.help,
143144
auth_strategy=provider.auth_strategy,
144145
registry=provider.registry,
145146
fields=provider.fields,

0 commit comments

Comments
 (0)