langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.52k stars 15.51k forks source link

community.llms init Xinference fail :pydantic_core._pydantic_core.ValidationError:client [ type=missing] #27295

Open windcandle opened 1 month ago

windcandle commented 1 month ago

Checked other resources

Example Code

Code looks like this: this code referecence xinference examples,but error. https://github.com/langchain-ai/langchain/blob/master/docs/docs/integrations/llms/xinference.ipynb

from langchain_community.llms import Xinference
xinference_llm = Xinference(
    server_url="http://0.0.0.0:9997",
    model_uid="qwen2-instruct",
)

Error Message and Stack Trace (if applicable)

Run this code with error

/root/miniconda3/bin/conda run -n llm_service_3.10 --no-capture-output python llm-service/xinference/xinference_qa.py 
Traceback (most recent call last):
  File "llm-service/xinference/xinference_qa.py", line 63, in <module>
    xinference_llm = Xinference(
  File "/root/miniconda3/envs/llm_service_3.10/lib/python3.10/site-packages/langchain_community/llms/xinference.py", line 111, in __init__
    super().__init__(
  File "/root/miniconda3/envs/llm_service_3.10/lib/python3.10/site-packages/langchain_core/load/serializable.py", line 111, in __init__
    super().__init__(*args, **kwargs)
  File "/root/miniconda3/envs/llm_service_3.10/lib/python3.10/site-packages/pydantic/main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Xinference
client
  Field required [type=missing, input_value={'server_url': 'http://10...ct', 'model_kwargs': {}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/missing
ERROR conda.cli.main_run:execute(125): `conda run python llm-service/xinference/xinference_qa.py` failed. (See above for error)

Description

Xinference run ok, I use client call endpiont ,above error I don't know what happened.

System Info

ubuntu20.04 CUDA:12.0 python3.10.15

Package Version


aiohappyeyeballs 2.4.3 aiohttp 3.10.10 aiosignal 1.3.1 annotated-types 0.7.0 anyio 4.6.0 async-timeout 4.0.3 attrs 24.2.0 certifi 2024.8.30 charset-normalizer 3.4.0 dataclasses-json 0.6.7 exceptiongroup 1.2.2 frozenlist 1.4.1 greenlet 3.1.1 h11 0.14.0 httpcore 1.0.6 httpx 0.27.2 idna 3.10 jsonpatch 1.33 jsonpointer 3.0.0 langchain 0.3.3 langchain-community 0.3.2 langchain-core 0.3.10 langchain-text-splitters 0.3.0 langsmith 0.1.134 marshmallow 3.22.0 multidict 6.1.0 mypy-extensions 1.0.0 numpy 1.26.4 orjson 3.10.7 packaging 24.1 pip 24.2 propcache 0.2.0 pydantic 2.9.2 pydantic_core 2.23.4 pydantic-settings 2.5.2 python-dotenv 1.0.1 PyYAML 6.0.2 requests 2.32.3 requests-toolbelt 1.0.0 setuptools 75.1.0 sniffio 1.3.1 SQLAlchemy 2.0.35 tenacity 8.5.0 typing_extensions 4.12.2 typing-inspect 0.9.0 urllib3 2.2.3 wheel 0.44.0 xinference-client 0.15.3 yarl 1.14.0

windcandle commented 1 month ago

Please help me!

Harsimran-19 commented 1 month ago

Can I work on this issue?

windcandle commented 1 month ago

@Harsimran-19 you can?

Pan-Binghong commented 1 month ago

I'm having the same problem. Did you solve it? @windcandle

AI-Surfing commented 1 month ago

similar question! The error messages as followed:

pydantic_core._pydantic_core.ValidationError: 1 validation error for Xinference
client
  Field required [type=missing, input_value={'server_url': 'http://0....Tl', 'model_kwargs': {}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/missing

how to solve it?

spark-ws commented 4 weeks ago

same problem here!

fz5400 commented 3 weeks ago

pip install langchain_community==0.2 problem solved