hfhoffman1144 / langchain_neo4j_rag_app

A knowledge graph RAG app using LangChain and Neo4j.
173 stars 50 forks source link

ConnectionError to chatbot api? please kindly help #1

Open bombond opened 7 months ago

bombond commented 7 months ago

Everything seems fine util I start to chat with the chatbot UI. An ConnectionError occurs. Here's the tracelog. Could you please kindly help?

ConnectionError: HTTPConnectionPool(host='host.docker.internal', port=8000): Max retries exceeded with url: /hospital-rag-agent (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f84e026d1d0>: Failed to resolve 'host.docker.internal' ([Errno -2] Name or service not known)")) Traceback: File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script exec(code, module.dict) File "/app/main.py", line 102, in response = requests.post(CHATBOT_URL, json=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request)

prasanth-ra commented 7 months ago

Everything seems fine util I start to chat with the chatbot UI. An ConnectionError occurs. Here's the tracelog. Could you please kindly help?

ConnectionError: HTTPConnectionPool(host='host.docker.internal', port=8000): Max retries exceeded with url: /hospital-rag-agent (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f84e026d1d0>: Failed to resolve 'host.docker.internal' ([Errno -2] Name or service not known)")) Traceback: File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script exec(code, module.dict) File "/app/main.py", line 102, in response = requests.post(CHATBOT_URL, json=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request)

Facing same issue

hfhoffman1144 commented 7 months ago

Hey @bombond and @prasanth-ra - I'm sorry y'all are running into issues. Unfortunately, I wasn't able to reproduce the error locally. Could you provide me with the detailed steps you're taking to run the project? It would also be helpful to know which version of docker you're running because I suspect this is a docker issue.

prasanth-ra commented 7 months ago

I am using Docker version 25.0.4, build 1a576c5. When I try to access the chat api through UI , it doesn't work. Throws the below Error. image Whereas I can access the API directly with docs endpoint. image Great repo anyway. thanks for sharing!

bombond commented 7 months ago

Yes, we face exactly the same issue. Calling through API works fine, but connection fail when trigger from chatbot UI. BTW, my docker version 23.0.5

hfhoffman1144 commented 7 months ago

Okay I see. Just to confirm, you have CHATBOT_URL=http://host.docker.internal:8000/hospital-rag-agent set in your .env file?

bombond commented 7 months ago

Yes, I set CHATBOT_URL=http://host.docker.internal:8000/hospital-rag-agent I guess prasanth may set it to http://localhost:8000/hospital-rag-agent, as I also tried and end with exactly the same log as his

Sandy4321 commented 6 months ago

so what is solution pls

asanmateu commented 6 months ago

Make sure your AuraDB instance is running. I believe trial instances go on standby after not too long.

asanmateu commented 6 months ago

It could also be that you need to use the scc certificate:

Note: By default, your NEO4J_URI should be similar to neo4j+s://.databases.neo4j.io. The URL scheme neo4j+s uses CA-signed certificates only, which might not work for you. If this is the case, change your URI to use the neo4j+ssc URL scheme - neo4j+ssc://.databases.neo4j.io. You can read more about what this means in the Neo4j documentation on connection protocols and security.

hfhoffman1144 commented 6 months ago

Thank you @asanmateu ! @Sandy4321 I've been trying to replicate the issue locally, but everything still runs successfully for me. I encountered this error when developing this project, and it was because CHATBOT_URL wasn't set correctly. If CHATBOT_URL is correct, then I'm not sure what might be causing the issue at this point.

Stefen-Taime commented 5 months ago

If you're experiencing issues with host.docker.internal, such as connection errors or networking problems in your Docker containers, a practical solution is to use the IP address of your host machine instead of the internal hostname.

To find your host machine’s IP address, you can use the following commands depending on your operating system:

Linux and macOS: Open a terminal and type ifconfig. Look for your active network interface (often eth0 for Ethernet or wlan0 for Wi-Fi on Linux, and en0 or en1 on macOS). The IP address will be listed under inet.

Windows: Open the Command Prompt by typing cmd in the start menu, then enter ipconfig. You will find the IP address listed under IPv4 Address for the network interface you are using.

Once you have your host’s IP address, you can replace host.docker.internal with this IP in your Docker configuration or scripts, which should resolve any connectivity issues.

asanmateu commented 4 months ago

Found this useful in case anyone has problems connecting to Aura locally: https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate