tomasonjo / NeoGPT-Recommender

Context-aware knowledge-graph based chatbot using GPT4 and Neo4j
https://medium.com/neo4j/context-aware-knowledge-graph-chatbot-with-gpt-4-and-neo4j-d3a99e8ae21e
MIT License
147 stars 49 forks source link

"Cannot resolve address {}".format(address)) chatbot | ValueError: Cannot resolve address URL:7687 #2

Closed miriam-z closed 1 year ago

miriam-z commented 1 year ago

Hi @tomasonjo

Cloned the project:

git clone https://github.com/tomasonjo/NeoGPT-Recommender.git

and do have: .env OPENAI_KEY= NEO4J_URL=bolt://URL:7687 NEO4J_USER="neo4j" NEO4J_PASS=

neo start

Running locally in a Mac OSX host machine

But after docker-compose up

raise ValueError("Cannot resolve address {}".format(address)) chatbot | ValueError: Cannot resolve address URL:7687

  1. Are you manually creating the database up front via Cypher commands and then using GPT4 to translate user queries into Cypher commands?

or:

  1. Using user queries for both the database creation as well as the queries?

Also don't see anywhere entities are actually created with for example:

CREATE (pfiz: Company {name: 'Pfizer'})

as I would like to create my own dataset

tomasonjo commented 1 year ago

I am not creating the database, only querying it, so its the

Manually creating the database up front via Cypher commands and then using GPT4 to translate user queries into Cypher commands

You will need to instantiate a Neo4j database and then set the correct URL in the .env file.

miriam-z commented 1 year ago

@tomasonjo Thanks, because I already have pharmacological dataset so I only need to populate it in my non-dockerized jupyter notebook entity-relationship creation as I have already done so and change the example training string to something that is more closely aligned with my dataset.

Although it my app it is not dockerized, but your repo is? So is that the reason for the:

Cannot resolve address URL:7687

tomasonjo commented 1 year ago

If you are using jupyter notebook i suggest you take a look at langchain: https://towardsdatascience.com/langchain-has-added-cypher-search-cb9d821120d5

miriam-z commented 1 year ago

Could you point out why ValueError: Cannot resolve address URL:7687 as it is?

tomasonjo commented 1 year ago

Because URL is not valid address. Where is your Neo4j instance anyway?

miriam-z commented 1 year ago

It is local, so to make it work I need to spin out https:// i.e cloud, so is your neo4j local or cloud? So would a local juypter notebook running be able to link to this dockerized app can link to the same cluster.

miriam-z commented 1 year ago

Would a local juypter notebook running be able to link to this dockerized app can link to the same cluster.

tomasonjo commented 1 year ago

I have no idea where does Jupyter Notebook comes into play. I don't have any Jupyter notebook here.

Changing the url to something like:

bolt://localhost:7687

should work and adding

network_mode: host

in the docker-compose.yml file if you have a local instance of Neo4j

miriam-z commented 1 year ago

Thanks @tomasonjo , can populate user defined dataaset into a blank sandbox from neo4j now at:

bolt://MY_IP:7687

But the streamlit UI:

http://localhost:8501/

Screenshot 2023-08-03 at 12.38.45.pdf

In this case change gpt4 to gpt3.5?

Tried:

    completions = openai.ChatCompletion.create(
        model="gpt-4-0613",

Also:

InvalidRequestError: The model gpt-4 does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.

Also, Is there any way to anchor user defined entities on the graph such that these default X-Y coordinates are at a preferred location and let other entities flow around them.