Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting ReadTimeoutError while trying the quickstart sample on the ReadMe #49

Open
vishnuprksh opened this issue Aug 27, 2024 · 1 comment

Comments

@vishnuprksh
Copy link

Getting ReadTimeoutError while trying the following code,

from ragrank import evaluate
from ragrank.dataset import from_dict
from ragrank.metric import response_relevancy

# Define your dataset
data = from_dict({
    "question": "What is the capital of France?",
    "context": ["France is famous for its iconic landmarks such as the Eiffel Tower and its rich culinary tradition."],
    "response": "The capital of France is Paris.",
})

# Evaluate the response relevance metric
result = evaluate(data, metrics=[response_relevancy])

# Display the evaluation results
result.to_dataframe()

output is like shown below

Evaluating : 100%|█████████████████████████████████████████████████| 1/1   remain: 00:00s,  1.42it/s
---------------------------------------------------------------------------
TimeoutError                              Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py](https://localhost:8080/#) in _make_request(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)
    535         try:
--> 536             response = conn.getresponse()
    537         except (BaseSSLError, OSError) as e:

26 frames
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

ReadTimeoutError                          Traceback (most recent call last)
ReadTimeoutError: HTTPSConnectionPool(host='ragrank-trace.onrender.com', port=443): Read timed out. (read timeout=10.0)

During handling of the above exception, another exception occurred:

ReadTimeout                               Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/requests/adapters.py](https://localhost:8080/#) in send(self, request, stream, timeout, verify, cert, proxies)
    711                 raise SSLError(e, request=request)
    712             elif isinstance(e, ReadTimeoutError):
--> 713                 raise ReadTimeout(e, request=request)
    714             elif isinstance(e, _InvalidHeader):
    715                 raise InvalidHeader(e, request=request)

ReadTimeout: HTTPSConnectionPool(host='ragrank-trace.onrender.com', port=443): Read timed out. (read timeout=10.0)

I used a google colab for running the code.

@Amanrai2004
Copy link

Amanrai2004 commented Oct 6, 2024

The ReadTimeoutError often indicates network issues or server-side delays

If you're running this on Google Colab and experiencing timeout issues, consider running the code on your local machine instead, if possible. Sometimes the cloud environment may have issues with network requests

from ragrank import evaluate
from ragrank.dataset import from_dict
from ragrank.metric import response_relevancy
from requests.exceptions import ReadTimeout

data = from_dict({
"question": "What is the capital of France?",
"context": ["France is famous for its iconic landmarks such as the Eiffel Tower and its rich culinary tradition."],
"response": "The capital of France is Paris.",
})

try:
# Evaluate the response relevance metric
result = evaluate(data, metrics=[response_relevancy])
# Display the evaluation results
df = result.to_dataframe()
print(df)
except ReadTimeout as e:
print(f"Request timed out: {e}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants