Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:\codes\AIGC\scientificProject\llm.py", line 56, in
solution = code_gen_chain_oai.invoke(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\base.py", line 3024, in invoke
input = context.run(step.invoke, input, config)
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\base.py", line 193, in invoke
return self._call_with_config(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\base.py", line 1927, in _call_with_config
context.run(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\config.py", line 396, in call_func_with_variable_args
return func(input, kwargs) # type: ignore[call-arg]
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\base.py", line 194, in
lambda inner_input: self.parse_result(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\openai_tools.py", line 298, in parse_result
raise e
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\openai_tools.py", line 293, in parse_result
pydantic_objects.append(name_dict[res["type"]](res["args"]))
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\pydantic\main.py", line 212, in init
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 3 validation errors for code
prefix
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
imports
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
code
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
Checked other resources
Example Code
我运行官方文档给出的示例代码出现报错,代码链接:https://langchain-ai.github.io/langgraph/tutorials/code_assistant/langgraph_code_assistant/#code-solution 环境信息: langchain 0.3.7 langgraph 0.2.45 pydantic 2.9.2 pydantic_core 2.23.4 pydantic-settings 2.6.1
Error Message and Stack Trace (if applicable)
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:\codes\AIGC\scientificProject\llm.py", line 56, in
solution = code_gen_chain_oai.invoke(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\base.py", line 3024, in invoke
input = context.run(step.invoke, input, config)
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\base.py", line 193, in invoke
return self._call_with_config(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\base.py", line 1927, in _call_with_config
context.run(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\runnables\config.py", line 396, in call_func_with_variable_args
return func(input, kwargs) # type: ignore[call-arg]
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\base.py", line 194, in
lambda inner_input: self.parse_result(
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\openai_tools.py", line 298, in parse_result
raise e
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\langchain_core\output_parsers\openai_tools.py", line 293, in parse_result
pydantic_objects.append(name_dict[res["type"]]( res["args"]))
File "C:\Users\anaconda3\envs\langchain_env2\lib\site-packages\pydantic\main.py", line 212, in init
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 3 validation errors for code
prefix
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
imports
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
code
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
Description
我想要学习运行官网中给出的langgrapg RAG相关代码,但出现了pydantic相关的包的报错请问我要如何解决
System Info
aiohappyeyeballs==2.4.3 aiohttp==3.10.10 aiosignal==1.3.1 annotated-types==0.7.0 anthropic==0.38.0 anyio==4.6.2.post1 async-timeout==4.0.3 attrs==24.2.0 beautifulsoup4==4.12.3 bs4==0.0.2 certifi==2024.8.30 charset-normalizer==3.4.0 colorama==0.4.6 dataclasses-json==0.6.7 defusedxml==0.7.1 distro==1.9.0 exceptiongroup==1.2.2 filelock==3.16.1 frozenlist==1.5.0 fsspec==2024.10.0 greenlet==3.1.1 h11==0.14.0 httpcore==1.0.6 httpx==0.27.2 httpx-sse==0.4.0 huggingface-hub==0.26.2 idna==3.10 jiter==0.7.0 jsonpatch==1.33 jsonpointer==3.0.0 langchain==0.3.7 langchain-anthropic==0.2.4 langchain-community==0.3.5 langchain-core==0.3.15 langchain-openai==0.2.5 langchain-text-splitters==0.3.2 langgraph==0.2.45 langgraph-checkpoint==2.0.2 langgraph-sdk==0.1.35 langsmith==0.1.139 marshmallow==3.23.1 msgpack==1.1.0 multidict==6.1.0 mypy-extensions==1.0.0 numpy==1.26.4 openai==1.53.0 orjson==3.10.11 packaging==24.1 propcache==0.2.0 pydantic==2.9.2 pydantic-settings==2.6.1 pydantic_core==2.23.4 python-dotenv==1.0.1 PyYAML==6.0.2 regex==2024.9.11 requests==2.32.3 requests-toolbelt==1.0.0 sniffio==1.3.1 soupsieve==2.6 SQLAlchemy==2.0.35 tenacity==9.0.0 tiktoken==0.8.0 tokenizers==0.20.1 tqdm==4.66.6 typing-inspect==0.9.0 typing_extensions==4.12.2 urllib3==2.2.3 yarl==1.17.1