SciPhi-AI / R2R

The Elasticsearch for RAG. Build, scale, and deploy state of the art Retrieval-Augmented Generation applications
https://r2r-docs.sciphi.ai/
MIT License
3.25k stars 238 forks source link

R2RException: Not Found #841

Closed MehrCurry closed 1 month ago

MehrCurry commented 1 month ago

I wrote a little program to isolate the error. When calling client.agent(...) I got an exception:

poetry run python backend/r2rclient.py
{'response': 'ok'}
Traceback (most recent call last):
  File "/Users/gzo/wrk/scraper/backend/r2rclient.py", line 6, in <module>
    result = client.agent(
             ^^^^^^^^^^^^^
  File "/Users/gzo/miniconda3/envs/scraper/lib/python3.12/site-packages/r2r/main/api/client.py", line 413, in agent
    return self._make_request(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/gzo/miniconda3/envs/scraper/lib/python3.12/site-packages/r2r/main/api/client.py", line 104, in _make_request
    handle_request_error(response)
  File "/Users/gzo/miniconda3/envs/scraper/lib/python3.12/site-packages/r2r/main/api/client.py", line 65, in handle_request_error
    raise R2RException(
r2r.base.abstractions.exception.R2RException: Not Found

To Reproduce Here is my little test script

from r2r import R2RClient
import json

client = R2RClient("http://localhost:8000")
print(client.health())
result = client.agent(
    messages=[{"role": "user", "content": "Who was Aristotle?"}],
    vector_search_settings={"use_vector_search":True, "do_hybrid_search":True},
    kg_search_settings={"use_kg_search":False},
    rag_generation_config={"model":"openai/gpt-4o", "temperature":0.7}
)
print(result)

Desktop (please complete the following information):

Additional context

[tool.poetry]
name = "energieversorger-backend"
version = "0.1.0"
description = "Backend for Energieversorger chat application"
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = ">=3.11,<3.13"
flask = ">=2.0.1"
r2r = ">=0.2.78"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
NolanTrem commented 1 month ago

Hey @MehrCurry, would you be able to share the server side logs for this issue?

If you are using docker, you may need to prune the R2R container with a docker prune command. Docker caches images, so there might be a mismatch between your client and server versions.

MehrCurry commented 1 month ago

You are right. Client and server version do not match. As soon as you do it right, it works. So the problem was in front of the screen. Thank you.