You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
messages = [
SystemMessage(
content="You are a helpful assistant that translates English to French."
),
HumanMessage(
content="Translate this sentence from English to French. I love programming."
),
]
chat.invoke(messages)
Error Message and Stack Trace (if applicable)
ValidationError Traceback (most recent call last)
Cell In[5], line 6
2 from langchain_community.chat_models.moonshot import MoonshotChat
3 from langchain_core.messages import HumanMessage, SystemMessage
----> 6 chat = MoonshotChat()
8 messages = [
9 SystemMessage(
10 content="You are a helpful assistant that translates English to French."
(...)
14 ),
15 ]
17 response = chat.invoke(messages)
File c:\Users\eric\miniconda3\envs\myai\Lib\site-packages\pydantic\main.py:212, in BaseModel.init(self, **data)
...
ValidationError: 1 validation error for MoonshotChat
client
Input should be a valid dictionary or instance of _MoonshotClient [type=model_type, input_value=<openai.resources.chat.co...t at 0x000001B3AB6F9220>, input_type=Completions]
For further information visit https://errors.pydantic.dev/2.9/v/model_type
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Description
I executed simple use cases from the official documentation, but they didn't work.
System Info
System Information
OS: Windows
OS Version: 10.0.22631
Python Version: 3.12.6 | packaged by conda-forge | (main, Sep 30 2024, 17:48:58) [MSC v.1941 64 bit (AMD64)]
Checked other resources
Example Code
from langchain_community.chat_models.moonshot import MoonshotChat
from langchain_core.messages import HumanMessage, SystemMessage
import os
Generate your api key from: https://platform.moonshot.cn/console/api-keys
os.environ["MOONSHOT_API_KEY"] = "xxxxx"
chat = MoonshotChat()
messages = [
SystemMessage(
content="You are a helpful assistant that translates English to French."
),
HumanMessage(
content="Translate this sentence from English to French. I love programming."
),
]
chat.invoke(messages)
Error Message and Stack Trace (if applicable)
ValidationError Traceback (most recent call last)
Cell In[5], line 6
2 from langchain_community.chat_models.moonshot import MoonshotChat
3 from langchain_core.messages import HumanMessage, SystemMessage
----> 6 chat = MoonshotChat()
8 messages = [
9 SystemMessage(
10 content="You are a helpful assistant that translates English to French."
(...)
14 ),
15 ]
17 response = chat.invoke(messages)
File c:\Users\eric\miniconda3\envs\myai\Lib\site-packages\langchain_core_api\deprecation.py:213, in deprecated..deprecate..finalize..warn_if_direct_instance(self, *args, **kwargs)
211 warned = True
212 emit_warning()
--> 213 return wrapped(self, *args, **kwargs)
File c:\Users\eric\miniconda3\envs\myai\Lib\site-packages\langchain_core\load\serializable.py:111, in Serializable.init(self, *args, **kwargs)
109 def init(self, *args: Any, **kwargs: Any) -> None:
110 """"""
--> 111 super().init(*args, **kwargs)
File c:\Users\eric\miniconda3\envs\myai\Lib\site-packages\pydantic\main.py:212, in BaseModel.init(self, **data)
...
ValidationError: 1 validation error for MoonshotChat
client
Input should be a valid dictionary or instance of _MoonshotClient [type=model_type, input_value=<openai.resources.chat.co...t at 0x000001B3AB6F9220>, input_type=Completions]
For further information visit https://errors.pydantic.dev/2.9/v/model_type
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Description
I executed simple use cases from the official documentation, but they didn't work.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: