mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 14:18:52 +00:00
docs: Improve neo4j semantic templates (#23939)
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>
This commit is contained in:
parent
6b47c7361e
commit
3f1cf00d97
@ -39,12 +39,26 @@ NEO4J_USERNAME=<YOUR_NEO4J_USERNAME>
|
|||||||
NEO4J_PASSWORD=<YOUR_NEO4J_PASSWORD>
|
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
|
## Populating with data
|
||||||
|
|
||||||
If you want to populate the DB with an example movie dataset, you can run `python ingest.py`.
|
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.
|
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.
|
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
|
## Usage
|
||||||
|
|
||||||
To use this package, you should first have the LangChain CLI installed:
|
To use this package, you should first have the LangChain CLI installed:
|
||||||
@ -65,7 +79,7 @@ If you want to add this to an existing project, you can just run:
|
|||||||
langchain app add neo4j-semantic-ollama
|
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
|
```python
|
||||||
from neo4j_semantic_ollama import agent_executor as neo4j_semantic_agent
|
from neo4j_semantic_ollama import agent_executor as neo4j_semantic_agent
|
||||||
|
|
||||||
@ -83,7 +97,7 @@ export LANGCHAIN_API_KEY=<your-api-key>
|
|||||||
export LANGCHAIN_PROJECT=<your-project> # if not specified, defaults to "default"
|
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
|
```shell
|
||||||
langchain serve
|
langchain serve
|
||||||
|
Loading…
Reference in New Issue
Block a user