Skip to content

Commit

Permalink
docs: Improve neo4j semantic templates (langchain-ai#23939)
Browse files Browse the repository at this point in the history
I made some changes based on the issues I stumbled on while following
the README of neo4j-semantic-ollama.
I made the changes to the ollama variant, and can also port the relevant
ones to the layer variant once this is approved.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
  • Loading branch information
namin and efriis committed Jul 12, 2024
1 parent 6b47c73 commit 3f1cf00
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions templates/neo4j-semantic-ollama/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,26 @@ NEO4J_USERNAME=<YOUR_NEO4J_USERNAME>
NEO4J_PASSWORD=<YOUR_NEO4J_PASSWORD>
```

Typically for a local Ollama installation:

```shell
export OLLAMA_BASE_URL="http://127.0.0.1:11434"
```

## Populating with data

If you want to populate the DB with an example movie dataset, you can run `python ingest.py`.
The script import information about movies and their rating by users.
Additionally, the script creates two [fulltext indices](https://neo4j.com/docs/cypher-manual/current/indexes-for-full-text-search/), which are used to map information from user input to the database.

As an aternative, you can use the demo neo4j recommendations database:
```shell
export NEO4J_URI="neo4j+s://demo.neo4jlabs.com"
export NEO4J_USERNAME="recommendations"
export NEO4J_PASSWORD="recommendations"
export NEO4J_DATABASE="recommendations"
```

## Usage

To use this package, you should first have the LangChain CLI installed:
Expand All @@ -65,7 +79,7 @@ If you want to add this to an existing project, you can just run:
langchain app add neo4j-semantic-ollama
```

And add the following code to your `server.py` file:
And, from within the project, add the following code to your `app/server.py` file, replacing the `add_routes(app, NotImplemented)` section:
```python
from neo4j_semantic_ollama import agent_executor as neo4j_semantic_agent

Expand All @@ -83,7 +97,7 @@ export LANGCHAIN_API_KEY=<your-api-key>
export LANGCHAIN_PROJECT=<your-project> # if not specified, defaults to "default"
```

If you are inside this directory, then you can spin up a LangServe instance directly by:
If you are inside the top-level project directory, then you can spin up a LangServe instance directly by:

```shell
langchain serve
Expand Down

0 comments on commit 3f1cf00

Please sign in to comment.