Closed miaoxiaolv closed 3 weeks ago
Hey there, @miaoxiaolv! I'm here to help you with bugs, questions, and becoming a contributor. Let's get that issue sorted out together!
The ValidationError
you're encountering with the ChatMessage
role likely stems from an incorrect or missing type
attribute in your message objects. In the Ragas library, the ChatMessage
role is represented by specific message classes like HumanMessage
, ToolMessage
, and AIMessage
. Each of these classes requires a type
attribute to be set to a specific literal value to avoid validation errors:
HumanMessage:
type
: Must be "human"
.ToolMessage:
type
: Must be "tool"
.AIMessage:
type
: Must be "ai"
.Ensure that the type
attribute is correctly set for each message class you are using. Additionally, when using ToolMessage
, it must be preceded by an AIMessage
with tool_calls
defined [1].
Regarding the Hugging Face Hub authentication warning, you need to set up your HF_TOKEN
in Google Colab. You can do this by creating a token in your Hugging Face account settings and then adding it to your Colab environment using the following command:
from google.colab import output
output.enable_custom_widget_manager()
# Set your Hugging Face token
import os
os.environ["HF_TOKEN"] = "your_huggingface_token"
This will help you authenticate and access the datasets without warnings.
To continue talking to Dosu, mention @dosu.
I have checked the dataset and there are no issues. Could it be a compatibility issue with some module versions?
The Ragas library requires Pydantic version 2 or higher (pydantic>=2
) for compatibility [1]. There are no specific version requirements mentioned for Langchain, so it should be compatible with any version available at the time. However, given the deprecation warning you encountered, it seems there might be some compatibility issues with the versions of Langchain and Pydantic you are using.
To address potential compatibility issues, ensure that your environment is set up correctly. You can create a virtual environment and install the necessary dependencies using:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -e ".[dev]"
This setup helps manage dependencies and reduces the risk of compatibility issues [2]. If the problem persists, consider checking for updates or patches in the Ragas library that might address compatibility with the latest versions of Langchain or Pydantic.
To continue talking to Dosu, mention @dosu.
@miaoxiaolv this could be because of a json decoding error - do you use any tracing tools?
I'm really sorry, but this error was mainly due to some issues with my OpenAI API key. After changing the API key, the error is gone. Thank you for your help.
@miaoxiaolv glad to hear it is solved - closing this now 🙂
[ ] I checked the documentation and related resources and couldn't find an answer to my question.
Your Question Requesting help. I started running ragas last week and encountered errors. Later, when I used the example from the ragas documentation at "https://docs.ragas.io/en/stable/getstarted/rag_evaluation/" for evaluation testing, I encountered the same error. The error is as follows:
Code Examples Here is the sample code I ran:
Additional context The version I used is: langchain 0.3.4 langchain-community 0.3.3 langchain-core 0.3.12 langchain-openai 0.2.3 langchain-text-splitters 0.3.0 ragas 0.2.1 pydantic 2.9.2 pydantic_core 2.23.4 pydantic-settings 2.6.0