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

fix: A bug fix Update models.py #3484

Closed
wants to merge 1 commit into from
Closed

Conversation

haozheng95
Copy link

@haozheng95 haozheng95 commented Nov 18, 2024

fix error

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
I ran into this problem when I wanted to run the project. This was an issue(https://github.com/pydantic/pydantic/issues/3320) with pydantic, I fixed it by changing the properties of the models and my project was successfully running locally

My Python 3.11.9

Checklist before requesting a review

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code

Screenshots (if appropriate):

File "/Users/baizhe/PycharmProjects/myquivr/.venv1/lib/python3.11/site-packages/pydantic/v1/validators.py", line 765, in find_validators
    raise RuntimeError(f'no validator found for {type_}, see `arbitrary_types_allowed` in Config')
RuntimeError: no validator found for <class 'langchain_core.documents.base.Document'>, see `arbitrary_types_allowed` in Config

fix error
File "/Users/baizhe/PycharmProjects/myquivr/.venv1/lib/python3.11/site-packages/pydantic/v1/validators.py", line 765, in find_validators
    raise RuntimeError(f'no validator found for {type_}, see `arbitrary_types_allowed` in Config')
RuntimeError: no validator found for <class 'langchain_core.documents.base.Document'>, see `arbitrary_types_allowed` in Config
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 18, 2024
@haozheng95 haozheng95 changed the title Update models.py A bug fix Update models.py Nov 18, 2024
@haozheng95 haozheng95 changed the title A bug fix Update models.py fix: A bug fix Update models.py Nov 18, 2024
@StanGirard
Copy link
Collaborator

@jacopo-chevallard can you check this one please ?

@jacopo-chevallard jacopo-chevallard self-requested a review December 4, 2024 21:35
@jacopo-chevallard
Copy link
Collaborator

Hi @haozheng95, thanks for the PR. Could you, please, provide additional information on the error that triggered your fix so that I can try to reproduce it locally?

@haozheng95
Copy link
Author

haozheng95 commented Dec 6, 2024

Hi @haozheng95, thanks for the PR. Could you, please, provide additional information on the error that triggered your fix so that I can try to reproduce it locally?

Python 3.11.9
pydantic 2.9.2 pydantic_core 2.23.4

Apple M1 Max
MAcOs Version 14.5 Beta(23F5059e)

My python Code

llm = ChatGoogleGenerativeAI(model='gemini-1.5-flash', temperature=0.9)
if __name__ == "__main__":
    with tempfile.NamedTemporaryFile(mode="w", suffix=".txt") as temp_file:
        temp_file.write("Gold is a liquid of blue-like colour.")
        temp_file.flush()

        brain = Brain.from_files(
            name="test_brain",
            file_paths=[temp_file.name],
            llm=llm,
        )

        answer = brain.ask(
            "what is gold? asnwer in french"
        )
        print("answer:", answer)

@jacopo-chevallard
Copy link
Collaborator

@haozheng95 I cannot reproduce the error, the issue is likely related to your package versions, in particular of LangChain.

You should be able to fix this be runnig rye sync -f from examples/simple_question, if not feel free to open an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants