langchain/libs/community/langchain_community/llms
Tao Wang 25a1031871
community: Fix a validation error for MoonshotChat (#27801)
- **Description:** Change `MoonshotCommon.client` type from
`_MoonshotClient` to `Any`.
- **Issue:** Fix the issue #27058
- **Dependencies:** No
- **Twitter handle:** TaoWang2218

In PR #17100, the implementation for Moonshot was added, which defined
two classes:

- `MoonshotChat(MoonshotCommon, ChatOpenAI)` in
`langchain_community.chat_models.moonshot`;
- Here, `validate_environment()` assigns **client** as
`openai.OpenAI().chat.completions`
- Note that **client** here is actually a member variable defined in
`ChatOpenAI`;
- `MoonshotCommon` in `langchain_community.llms.moonshot`;
- And here, `validate_environment()` assigns **_client** as
`_MoonshotClient`;
- Note that this is the underscored **_client**, which is defined within
`MoonshotCommon` itself;

At this time, there was no conflict between the two, one being `client`
and the other `_client`.

However, in PR #25878 which fixed #24390, `_client` in `MoonshotCommon`
was changed to `client`. Since then, a conflict in the definition of
`client` has arisen between `MoonshotCommon` and `MoonshotChat`, which
caused `pydantic` validation error.

To fix this issue, the type of `client` in `MoonshotCommon` should be
changed to `Any`.

Signed-off-by: Tao Wang <twang2218@gmail.com>
2024-10-31 14:00:16 -04:00
..
grammars
__init__.py
ai21.py
aleph_alpha.py
amazon_api_gateway.py
anthropic.py
anyscale.py
aphrodite.py
arcee.py
aviary.py
azureml_endpoint.py
baichuan.py
baidu_qianfan_endpoint.py
bananadev.py
baseten.py
beam.py
bedrock.py
bigdl_llm.py
bittensor.py
cerebriumai.py
chatglm3.py
chatglm.py
clarifai.py
cloudflare_workersai.py
cohere.py
ctransformers.py
ctranslate2.py
databricks.py
deepinfra.py
deepsparse.py
edenai.py
exllamav2.py
fake.py
fireworks.py
forefrontai.py
friendli.py
gigachat.py
google_palm.py
gooseai.py
gpt4all.py
gradient_ai.py
huggingface_endpoint.py
huggingface_hub.py
huggingface_pipeline.py
huggingface_text_gen_inference.py
human.py
ipex_llm.py
javelin_ai_gateway.py
koboldai.py
konko.py
layerup_security.py
llamacpp.py
llamafile.py
loading.py
manifest.py
minimax.py
mlflow_ai_gateway.py
mlflow.py
mlx_pipeline.py
modal.py
moonshot.py community: Fix a validation error for MoonshotChat (#27801) 2024-10-31 14:00:16 -04:00
mosaicml.py
nlpcloud.py
oci_data_science_model_deployment_endpoint.py
oci_generative_ai.py
octoai_endpoint.py
ollama.py
opaqueprompts.py
openai.py
openllm.py
openlm.py
pai_eas_endpoint.py
petals.py
pipelineai.py
predibase.py
predictionguard.py
promptlayer_openai.py
replicate.py
rwkv.py
sagemaker_endpoint.py
sambanova.py
self_hosted_hugging_face.py
self_hosted.py
solar.py
sparkllm.py
stochasticai.py
symblai_nebula.py
textgen.py
titan_takeoff.py
together.py
tongyi.py
utils.py
vertexai.py
vllm.py
volcengine_maas.py
watsonxllm.py
weight_only_quantization.py
writer.py
xinference.py
yandex.py
yi.py
you.py
yuan2.py