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

Validation error for FastEmbedEmbeddings - extra fields not permitted #24039

Closed
5 tasks done
saikaryekar opened this issue Jul 9, 2024 · 14 comments · Fixed by #24462
Closed
5 tasks done

Validation error for FastEmbedEmbeddings - extra fields not permitted #24039

saikaryekar opened this issue Jul 9, 2024 · 14 comments · Fixed by #24462
Assignees
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature help wanted Good issue for contributors Ɑ: pydantic Related to pydantic or pydantic migration

Comments

@saikaryekar
Copy link

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

%pip install --upgrade --quiet  fastembed
%pip install --upgrade --quiet langchain_community
%pip install --upgrade --quiet langchain 

from langchain_community.embeddings.fastembed import FastEmbedEmbeddings 
embeddings = FastEmbedEmbeddings()

Error Message and Stack Trace (if applicable)

`---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
in <cell line: 1>()
----> 1 embeddings = FastEmbedEmbeddings()

/usr/local/lib/python3.10/dist-packages/pydantic/v1/main.py in init(pydantic_self, **data)
339 values, fields_set, validation_error = validate_model(pydantic_self.class, data)
340 if validation_error:
--> 341 raise validation_error
342 try:
343 object_setattr(pydantic_self, 'dict', values)

ValidationError: 1 validation error for FastEmbedEmbeddings
_model
extra fields not permitted (type=value_error.extra)

Description

Unable to Instantie FastEmbed model. It raises validation error for extra fields while none are provided. Issue seems to be arising from pydantic.

Code was working well on langchain == 0.2.6 and langchain-core == 0.2.11. Tried installing older versions but still getting the error.

Followed the tutorial here: https://python.langchain.com/v0.2/docs/integrations/text_embedding/fastembed/

System Info

langchain==0.2.7
langchain-community==0.2.7
langchain-core==0.2.12
langchain-text-splitters==0.2.2

Google-colab
Python 3.10.12

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jul 9, 2024
@eyurtsev
Copy link
Collaborator

eyurtsev commented Jul 9, 2024

Could you check if downgrading to langchain-community==0.2.6 helps solve the issue?

@eyurtsev eyurtsev self-assigned this Jul 9, 2024
@eyurtsev eyurtsev added the Ɑ: pydantic Related to pydantic or pydantic migration label Jul 9, 2024
@saikaryekar
Copy link
Author

Nope, downgrading to langchain-community==0.2.6 does not solve the issue.

@JonathanLoscalzo
Copy link

Same here, on colab

!pip -q install langchain langchain_community pypdf fastembed chromadb

from langchain_community.embeddings.fastembed import FastEmbedEmbeddings
# supported models: https://qdrant.github.io/fastembed/examples/Supported_Models/
model_name = "thenlper/gte-large"
embedding_model = FastEmbedEmbeddings(model_name=model_name)

langchain_community.__version__, fastembed.__version__ # ('0.2.7', '0.3.3')

@JonathanLoscalzo
Copy link

For versions
langchain_community.__version__, fastembed.__version__ # ('0.2.6', '0.3.2')
it works, just a workaround @saikaryekar

@saikaryekar
Copy link
Author

@JonathanLoscalzo downgrading both lanchain_community==0.2.6 and fastembed==0.3.2 worked, Thanks! I
They should fix issues for compatibility with newer version as well!

@Zizo-Vi
Copy link
Contributor

Zizo-Vi commented Jul 10, 2024

same issue.

@eyurtsev
Copy link
Collaborator

Could someone help isolate whether the issue comes from a change in langchain_community or from fastembed?

@eyurtsev eyurtsev added help wanted Good issue for contributors investigate Flagged for investigation. and removed investigate Flagged for investigation. labels Jul 10, 2024
@saikaryekar
Copy link
Author

@eyurtsev the issue comes from the new release of langchain_community v0.2.7 which was released 2 days ago.

@Likhith904
Copy link

For versions langchain_community.__version__, fastembed.__version__ # ('0.2.6', '0.3.2') it works, just a workaround @saikaryekar

thanks for that it works
i dont know why there is no proper documentation when they release a new version

@Shyamnath-Sankar
Copy link

th

For versions langchain_community.__version__, fastembed.__version__ # ('0.2.6', '0.3.2') it works, just a workaround @saikaryekar

Thanks Man This finally works thanks very much

@Anush008
Copy link
Contributor

Hey @eyurtsev. Could you please take a look at #24462 that resolves this?

ccurme pushed a commit that referenced this issue Jul 30, 2024
## Description

This PR:
- Fixes the validation error in `FastEmbedEmbeddings`.
- Adds support for `batch_size`, `parallel` params.
- Removes support for very old FastEmbed versions.
- Updates the FastEmbed doc with the new params.

Associated Issues:
- Resolves #24039
- Resolves #qdrant/fastembed#296
olgamurraft pushed a commit to olgamurraft/langchain that referenced this issue Aug 16, 2024
## Description

This PR:
- Fixes the validation error in `FastEmbedEmbeddings`.
- Adds support for `batch_size`, `parallel` params.
- Removes support for very old FastEmbed versions.
- Updates the FastEmbed doc with the new params.

Associated Issues:
- Resolves langchain-ai#24039
- Resolves #qdrant/fastembed#296
@Fernando7181
Copy link

weird, im getting the same error here

@Anush008
Copy link
Contributor

@Fernando7181, can you update the Langchain community package to the latest version?

@Fernando7181
Copy link

@Fernando7181, can you update the Langchain community package to the latest version?
error
sorry, its not the right topic im just new to it. Im getting this issue but not sure how to solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature help wanted Good issue for contributors Ɑ: pydantic Related to pydantic or pydantic migration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants