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

Various warnings due to Pydantic protected namespaces, such as UserWarning: Field "model_name" in JinaEmbeddings has conflict with protected namespace "model_". #27609

Open
5 tasks done
gawbul opened this issue Oct 24, 2024 · 2 comments

Comments

@gawbul
Copy link
Contributor

gawbul commented Oct 24, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_community.embeddings import JinaEmbeddings, LlamaCppEmbeddings, TensorflowHubEmbeddings, GooglePalmEmbeddings

Error Message and Stack Trace (if applicable)

/app_venv/lib/python3.10/site-packages/pydantic/_internal/_fields.py:132: UserWarning: Field "model_name" in JinaEmbeddings has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app_venv/lib/python3.10/site-packages/pydantic/_internal/_fields.py:132: UserWarning: Field "model_path" in LlamaCppEmbeddings has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app_venv/lib/python3.10/site-packages/pydantic/_internal/_fields.py:132: UserWarning: Field "model_url" in TensorflowHubEmbeddings has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/app_venv/lib/python3.10/site-packages/pydantic/_internal/_fields.py:132: UserWarning: Field "model_name" in GooglePalmEmbeddings has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(

Description

I am trying to use the langchain library to develop an AI application, however, when importing certain libraries I am getting warnings regarding protected namespaces.

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 23.6.0: Wed Jul 31 20:48:52 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6020
Python Version: 3.10.14 (main, May 3 2024, 16:41:18) [Clang 15.0.0 (clang-1500.3.9.4)]

Package Information

langchain_core: 0.3.12
langchain: 0.3.4
langchain_community: 0.3.3
langsmith: 0.1.137
langchain_google_vertexai: 2.0.5
langchain_text_splitters: 0.3.0

Optional packages not installed

langgraph
langserve

Other Dependencies

aiohttp: 3.10.10
anthropic[vertexai]: Installed. No version info available.
async-timeout: 4.0.3
dataclasses-json: 0.6.7
google-cloud-aiplatform: 1.70.0
google-cloud-storage: 2.18.2
httpx: 0.27.2
httpx-sse: 0.4.0
jsonpatch: 1.33
langchain-mistralai: Installed. No version info available.
numpy: 1.26.4
orjson: 3.10.10
packaging: 24.1
pydantic: 2.9.2
pydantic-settings: 2.6.0
PyYAML: 6.0.1
requests: 2.32.3
requests-toolbelt: 1.0.0
SQLAlchemy: 2.0.21
tenacity: 8.5.0
typing-extensions: 4.12.2

@gawbul
Copy link
Contributor Author

gawbul commented Oct 24, 2024

I'm working on a PR for this now 👍

eyurtsev pushed a commit that referenced this issue Oct 25, 2024
- [x] **PR message**:
- **Description:** Fixes warning messages raised due to missing
`protected_namespaces` parameter in `ConfigDict`.
    - **Issue:** #27609
    - **Dependencies:** No dependencies
    - **Twitter handle:** @gawbul
@gawbul
Copy link
Contributor Author

gawbul commented Oct 25, 2024

The PR has been merged. Just waiting for a new release version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant