Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 6 additions & 25 deletions docs/docs/examples/examples/docs_to_knowledge_graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ and then build a knowledge graph.
## Setup
* [Install PostgreSQL](https://cocoindex.io/docs/getting_started/installation#-install-postgres). CocoIndex uses PostgreSQL internally for incremental processing.
* [Install Neo4j](https://cocoindex.io/docs/targets/neo4j#neo4j-dev-instance), a graph database.

<DocumentationButton url="https://cocoindex.io/docs/targets/neo4j" text="Neo4j" margin="0 0 16px 0" />
* [Configure your OpenAI API key](https://cocoindex.io/docs/ai/llm#openai). Alternatively, we have native support for Gemini, Ollama, LiteLLM. You can choose your favorite LLM provider and work completely on-premises.

<DocumentationButton url="https://cocoindex.io/docs/ai/llm" text="LLM" margin="0 0 16px 0" />
Expand Down Expand Up @@ -357,6 +359,9 @@ And then open the url `https://cocoindex.io/cocoinsight`. It just connects to y
## Browse the knowledge graph
After the knowledge graph is built, you can explore the knowledge graph you built in Neo4j Browser.

<DocumentationButton url="https://cocoindex.io/docs/targets/neo4j" text="Neo4j" margin="0 0 16px 0" />


For the dev environment, you can connect to Neo4j browser using credentials:
- username: `Neo4j`
- password: `cocoindex`
Expand All @@ -368,28 +373,4 @@ You can open it at [http://localhost:7474](http://localhost:7474), and run the f
MATCH p=()-->() RETURN p
```

## Kuzu
Cocoindex natively supports Kuzu - a high performant, embedded open source graph database.

<DocumentationButton url="https://cocoindex.io/docs/targets/kuzu" text="Kuzu" margin="0 0 16px 0" />

The GraphDB interface in CocoIndex is standardized, you just need to **switch the configuration** without any additional code changes. CocoIndex supports exporting to Kuzu through its API server. You can bring up a Kuzu API server locally by running:

``` sh
KUZU_DB_DIR=$HOME/.kuzudb
KUZU_PORT=8123
docker run -d --name kuzu -p ${KUZU_PORT}:8000 -v ${KUZU_DB_DIR}:/database kuzudb/api-server:latest
```

In your CocoIndex flow, you need to add the Kuzu connection spec to your flow.

```python
kuzu_conn_spec = cocoindex.add_auth_entry(
"KuzuConnection",
cocoindex.storages.KuzuConnection(
api_server_url="http://localhost:8123",
),
)
```

<GitHubButton url="https://github.com/cocoindex-io/cocoindex/blob/30761f8ab674903d742c8ab2e18d4c588df6d46f/examples/docs_to_knowledge_graph/main.py#L33-L37" margin="0 0 16px 0" />
![Neo4j Browser](/img/examples/docs_to_knowledge_graph/neo4j_browser.png)
12 changes: 11 additions & 1 deletion docs/docs/targets/neo4j.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,14 @@ You can access the Neo4j browser at [http://localhost:7474](http://localhost:747
href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph"
text="Docs to Knowledge Graph"
margin="16px 0 24px 0"
/>
/>

## Data Clean up between different projects
If you are building multiple CocoIndex flows from different projects to neo4j, we recommend you to

- bring up separate container for each flow if you are on community edition, or
- setup different databases within one container if you are on enterprise edition.

This way, you can clean up the data for each flow independently.

In case you need to clean up the data in the same database, you can do it manually by running `cocoindex drop <APP_TARGET>` from the project you want to clean up.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.