tomasonjo / llm-movieagent

Semantic layer on top of a graph database to provide an LLM with a set of robust tools to interact with the database
MIT License
205 stars 37 forks source link

getting neo4j url connection error while docker compose #4

Open ssfd7 opened 7 months ago

ssfd7 commented 7 months ago

Here is the error: llm-movieagent-api-1 | File "/code/packages/neo4j-semantic-layer/neo4j_semantic_layer/utils.py", line 5, in llm-movieagent-api-1 | graph = Neo4jGraph() llm-movieagent-api-1 | ^^^^^^^^^^^^ llm-movieagent-api-1 | File "/usr/local/lib/python3.11/site-packages/langchain_community/graphs/neo4j_graph.py", line 207, in init llm-movieagent-api-1 | raise ValueError( llm-movieagent-api-1 | ValueError: Could not connect to Neo4j database. Please ensure that the url is correct

my .env is like: NEO4J_URI=neo4j://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=* OPENAI_API_KEY=sk-

tomasonjo commented 7 months ago

Yeah, localhost will not work inside docker. Use NEO4J_URI=neo4j://neo4j:7687 if you are using the provided neo4j in docker

ssfd7 commented 7 months ago

ok - i have made the change above and re-ran docker compose and got the following output: ... ✔ Network llm-movieagent_net Created 0.1s ✔ Container llm-movieagent-neo4j-1 Created 0.2s ✔ Container llm-movieagent-ui-1 Created 0.2s ✔ Container llm-movieagent-api-1 Created 0.2s Attaching to llm-movieagent-api-1, llm-movieagent-neo4j-1, llm-movieagent-ui-1 llm-movieagent-neo4j-1 | Installing Plugin 'apoc' from /var/lib/neo4j/labs/apoc-*-core.jar to /var/lib/neo4j/plugins/apoc.jar llm-movieagent-neo4j-1 | Applying default values for plugin apoc to neo4j.conf llm-movieagent-neo4j-1 | Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time. llm-movieagent-neo4j-1 | 2024-04-25 19:55:32.163+0000 INFO Logging config in use: File '/var/lib/neo4j/conf/user-logs.xml' llm-movieagent-neo4j-1 | 2024-04-25 19:55:32.205+0000 INFO Starting... llm-movieagent-neo4j-1 | 2024-04-25 19:55:33.860+0000 INFO This instance is ServerId{9d2576fa} (9d2576fa-b773-4c09-86c3-beadea306446) llm-movieagent-neo4j-1 | 2024-04-25 19:55:35.294+0000 INFO ======== Neo4j 5.19.0 ======== llm-movieagent-neo4j-1 | 2024-04-25 19:55:39.499+0000 INFO Bolt enabled on 0.0.0.0:7687. dependency failed to start: container llm-movieagent-neo4j-1 is unhealthy

ssfd7 commented 7 months ago

If I try to run from my docker desktop I am getting this error: image

tomasonjo commented 7 months ago

Just do

docker-compose down

and then restart it with

docker-compose up --build