Open Z-oo883 opened 1 month ago
Hey @Z-oo883! I'm here to help you with any bugs, questions, or to assist you in becoming a contributor. Let's tackle this together!
To resolve the "RuntimeError: Task pending got Future attached to a different loop" in the Ragas executor, ensure the Executor
is using the correct event loop. This error often occurs when tasks are submitted to an executor running on a different loop than the one they were created on.
Here's how you can fix it:
Set the Event Loop:
Ensure the Executor
uses the current event loop:
import asyncio
# Get the current event loop
current_loop = asyncio.get_event_loop()
# Use the current loop in the Executor
exec = Executor(
"Generating Scenarios",
raise_exceptions=raise_exceptions,
run_config=run_config,
keep_progress_bar=False,
loop=current_loop # Pass the current event loop
)
Use nest_asyncio
in Jupyter-like Environments:
If you're running this in a Jupyter notebook or similar environment, apply nest_asyncio
to handle nested event loops:
import nest_asyncio
nest_asyncio.apply()
Make sure the Executor
class supports passing an event loop. If not, you may need to modify it to accept and use the loop parameter [1].
To continue talking to Dosu, mention @dosu.
Traceback (most recent call last):
File "D:\RA_LLM\pythonProject\generate_test_data.py", line 50, in
The ValidationError
you're encountering indicates issues with the ground_truth
field in the DataRow
class. The error suggests that the ground_truth
field is expected to be a list of strings, but it seems to be receiving incorrect types.
Here's how you can address this:
Check the Data Type: Ensure that the ground_truth
field is being populated with a list of strings. The expected structure is a list, like ["string1", "string2"]
[1][2].
Validate Input Data: Before creating a DataRow
, validate that the data being passed to ground_truth
is indeed a list of strings. You can add a check in your code to confirm this:
if not isinstance(ground_truth, list) or not all(isinstance(item, str) for item in ground_truth):
raise ValueError("ground_truth must be a list of strings")
Review Data Source: If the data is being transformed or loaded from an external source, ensure that the transformation process maintains the correct data type for ground_truth
.
By ensuring the ground_truth
field is correctly formatted, you should be able to resolve the validation errors.
To continue talking to Dosu, mention @dosu.
currently Ragas doesn't play well with local models sadly :(
python3.9.19 ; ragas 0.1.21 code:
error:
Please help me! Thank you !!