Skip to content

Commit d655307

Browse files
committed
bug: fixed the UserWarning: Field "model_name" has conflict with protected namespace "model_".
1 parent f27f12e commit d655307

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

embeddings.ipynb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,7 @@
3232
"execution_count": 1,
3333
"id": "0be1af71",
3434
"metadata": {},
35-
"outputs": [
36-
{
37-
"name": "stderr",
38-
"output_type": "stream",
39-
"text": [
40-
"/home/limcheekin/ws/py/open-text-embeddings/venv/lib/python3.10/site-packages/pydantic/_internal/_fields.py:127: UserWarning: Field \"model_name\" has conflict with protected namespace \"model_\".\n",
41-
"\n",
42-
"You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
43-
" warnings.warn(\n"
44-
]
45-
}
46-
],
35+
"outputs": [],
4736
"source": [
4837
"from open.text.embeddings.openai import OpenAIEmbeddings"
4938
]

open/text/embeddings/openai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Config:
4444
"""Configuration for this pydantic object."""
4545

4646
extra = Extra.forbid
47+
protected_namespaces = ()
4748

4849
def embed_documents(self, texts: List[str]) -> List[List[float]]:
4950
"""Compute doc embeddings using underlying model of llama-cpp-python.

0 commit comments

Comments
 (0)