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
4 changes: 2 additions & 2 deletions examples/amazon_s3_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def amazon_s3_text_embedding_flow(

doc_embeddings.export(
"doc_embeddings",
cocoindex.storages.Postgres(),
cocoindex.targets.Postgres(),
primary_key_fields=["filename", "location"],
vector_indexes=[
cocoindex.VectorIndexDef(
Expand All @@ -74,7 +74,7 @@ def amazon_s3_text_embedding_flow(

def search(pool: ConnectionPool, query: str, top_k: int = 5):
# Get the table name, for the export target in the amazon_s3_text_embedding_flow above.
table_name = cocoindex.utils.get_target_storage_default_name(
table_name = cocoindex.utils.get_target_default_name(
amazon_s3_text_embedding_flow, "doc_embeddings"
)
# Evaluate the transform flow defined above with the input query, to get the embedding.
Expand Down
2 changes: 1 addition & 1 deletion examples/amazon_s3_embedding/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "amazon-s3-text-embedding"
version = "0.1.0"
description = "Simple example for cocoindex: build embedding index based on Amazon S3 files."
requires-python = ">=3.11"
dependencies = ["cocoindex>=0.1.42", "python-dotenv>=1.0.1"]
dependencies = ["cocoindex>=0.1.52", "python-dotenv>=1.0.1"]

[tool.setuptools]
packages = []
4 changes: 2 additions & 2 deletions examples/code_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def code_embedding_flow(

code_embeddings.export(
"code_embeddings",
cocoindex.storages.Postgres(),
cocoindex.targets.Postgres(),
primary_key_fields=["filename", "location"],
vector_indexes=[
cocoindex.VectorIndexDef(
Expand All @@ -73,7 +73,7 @@ def code_embedding_flow(

def search(pool: ConnectionPool, query: str, top_k: int = 5):
# Get the table name, for the export target in the code_embedding_flow above.
table_name = cocoindex.utils.get_target_storage_default_name(
table_name = cocoindex.utils.get_target_default_name(
code_embedding_flow, "code_embeddings"
)
# Evaluate the transform flow defined above with the input query, to get the embedding.
Expand Down
2 changes: 1 addition & 1 deletion examples/code_embedding/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "code-embedding"
version = "0.1.0"
description = "Simple example for cocoindex: build embedding index based on source code."
requires-python = ">=3.11"
dependencies = ["cocoindex>=0.1.42", "python-dotenv>=1.0.1"]
dependencies = ["cocoindex>=0.1.52", "python-dotenv>=1.0.1"]

[tool.setuptools]
packages = []
6 changes: 3 additions & 3 deletions examples/docs_to_knowledge_graph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Please drop [Cocoindex on Github](https://github.com/cocoindex-io/cocoindex) a s

## Prerequisite
* [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one.
* Install [Neo4j](https://cocoindex.io/docs/ops/storages#neo4j-dev-instance) or [Kuzu](https://cocoindex.io/docs/ops/storages#kuzu-dev-instance) if you don't have one.
* Install [Neo4j](https://cocoindex.io/docs/ops/targets#neo4j-dev-instance) or [Kuzu](https://cocoindex.io/docs/ops/targets#kuzu-dev-instance) if you don't have one.
* The example uses Neo4j by default for now. If you want to use Kuzu, find out the "SELECT ONE GRAPH DATABASE TO USE" section and switch the active branch.
* [Configure your OpenAI API key](https://cocoindex.io/docs/ai/llm#openai).

## Documentation
You can read the official CocoIndex Documentation for Property Graph Targets [here](https://cocoindex.io/docs/ops/storages#property-graph-targets).
You can read the official CocoIndex Documentation for Property Graph Targets [here](https://cocoindex.io/docs/ops/targets#property-graph-targets).

## Run

Expand Down Expand Up @@ -48,7 +48,7 @@ cocoindex update main.py
After the knowledge graph is built, you can explore the knowledge graph.

* If you're using Neo4j, you can open the explorer at [http://localhost:7474](http://localhost:7474), with username `neo4j` and password `cocoindex`.
* If you're using Kuzu, you can start a Kuzu explorer locally. See [Kuzu dev instance](https://cocoindex.io/docs/ops/storages#kuzu-dev-instance) for more details.
* If you're using Kuzu, you can start a Kuzu explorer locally. See [Kuzu dev instance](https://cocoindex.io/docs/ops/targets#kuzu-dev-instance) for more details.

You can run the following Cypher query to get all relationships:

Expand Down
38 changes: 19 additions & 19 deletions examples/docs_to_knowledge_graph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

neo4j_conn_spec = cocoindex.add_auth_entry(
"Neo4jConnection",
cocoindex.storages.Neo4jConnection(
cocoindex.targets.Neo4jConnection(
uri="bolt://localhost:7687",
user="neo4j",
password="cocoindex",
),
)
kuzu_conn_spec = cocoindex.add_auth_entry(
"KuzuConnection",
cocoindex.storages.KuzuConnection(
cocoindex.targets.KuzuConnection(
api_server_url="http://localhost:8123",
),
)
Expand All @@ -25,15 +25,15 @@
# Please make sure only one branch is live and others are commented out.

# Use Neo4j
GraphDbSpec = cocoindex.storages.Neo4j
GraphDbConnection = cocoindex.storages.Neo4jConnection
GraphDbDeclaration = cocoindex.storages.Neo4jDeclaration
GraphDbSpec = cocoindex.targets.Neo4j
GraphDbConnection = cocoindex.targets.Neo4jConnection
GraphDbDeclaration = cocoindex.targets.Neo4jDeclaration
conn_spec = neo4j_conn_spec

# Use Kuzu
# GraphDbSpec = cocoindex.storages.Kuzu
# GraphDbConnection = cocoindex.storages.KuzuConnection
# GraphDbDeclaration = cocoindex.storages.KuzuDeclaration
# GraphDbSpec = cocoindex.targets.Kuzu
# GraphDbConnection = cocoindex.targets.KuzuConnection
# GraphDbDeclaration = cocoindex.targets.KuzuDeclaration
# conn_spec = kuzu_conn_spec


Expand Down Expand Up @@ -134,7 +134,7 @@ def docs_to_kg_flow(
document_node.export(
"document_node",
GraphDbSpec(
connection=conn_spec, mapping=cocoindex.storages.Nodes(label="Document")
connection=conn_spec, mapping=cocoindex.targets.Nodes(label="Document")
),
primary_key_fields=["filename"],
)
Expand All @@ -150,20 +150,20 @@ def docs_to_kg_flow(
"entity_relationship",
GraphDbSpec(
connection=conn_spec,
mapping=cocoindex.storages.Relationships(
mapping=cocoindex.targets.Relationships(
rel_type="RELATIONSHIP",
source=cocoindex.storages.NodeFromFields(
source=cocoindex.targets.NodeFromFields(
label="Entity",
fields=[
cocoindex.storages.TargetFieldMapping(
cocoindex.targets.TargetFieldMapping(
source="subject", target="value"
),
],
),
target=cocoindex.storages.NodeFromFields(
target=cocoindex.targets.NodeFromFields(
label="Entity",
fields=[
cocoindex.storages.TargetFieldMapping(
cocoindex.targets.TargetFieldMapping(
source="object", target="value"
),
],
Expand All @@ -176,16 +176,16 @@ def docs_to_kg_flow(
"entity_mention",
GraphDbSpec(
connection=conn_spec,
mapping=cocoindex.storages.Relationships(
mapping=cocoindex.targets.Relationships(
rel_type="MENTION",
source=cocoindex.storages.NodeFromFields(
source=cocoindex.targets.NodeFromFields(
label="Document",
fields=[cocoindex.storages.TargetFieldMapping("filename")],
fields=[cocoindex.targets.TargetFieldMapping("filename")],
),
target=cocoindex.storages.NodeFromFields(
target=cocoindex.targets.NodeFromFields(
label="Entity",
fields=[
cocoindex.storages.TargetFieldMapping(
cocoindex.targets.TargetFieldMapping(
source="entity", target="value"
)
],
Expand Down
2 changes: 1 addition & 1 deletion examples/docs_to_knowledge_graph/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "manuals-to-kg"
version = "0.1.0"
description = "Simple example for cocoindex: extract triples from files and build knowledge graph."
requires-python = ">=3.11"
dependencies = ["cocoindex>=0.1.42"]
dependencies = ["cocoindex>=0.1.52"]

[tool.setuptools]
packages = []
4 changes: 2 additions & 2 deletions examples/fastapi_server_docker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def markdown_embedding_flow(

doc_embeddings.export(
"doc_embeddings",
cocoindex.storages.Postgres(),
cocoindex.targets.Postgres(),
primary_key_fields=["filename", "location"],
vector_indexes=[
cocoindex.VectorIndexDef(
Expand All @@ -67,7 +67,7 @@ def markdown_embedding_flow(

def search(pool: ConnectionPool, query: str, top_k: int = 5):
# Get the table name, for the export target in the text_embedding_flow above.
table_name = cocoindex.utils.get_target_storage_default_name(
table_name = cocoindex.utils.get_target_default_name(
markdown_embedding_flow, "doc_embeddings"
)
# Evaluate the transform flow defined above with the input query, to get the embedding.
Expand Down
2 changes: 1 addition & 1 deletion examples/fastapi_server_docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cocoindex>=0.1.42
cocoindex>=0.1.52
python-dotenv>=1.0.1
fastapi==0.115.12
fastapi-cli==0.0.7
Expand Down
4 changes: 2 additions & 2 deletions examples/gdrive_text_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def gdrive_text_embedding_flow(

doc_embeddings.export(
"doc_embeddings",
cocoindex.storages.Postgres(),
cocoindex.targets.Postgres(),
primary_key_fields=["filename", "location"],
vector_indexes=[
cocoindex.VectorIndexDef(
Expand All @@ -73,7 +73,7 @@ def gdrive_text_embedding_flow(

def search(pool: ConnectionPool, query: str, top_k: int = 5):
# Get the table name, for the export target in the gdrive_text_embedding_flow above.
table_name = cocoindex.utils.get_target_storage_default_name(
table_name = cocoindex.utils.get_target_default_name(
gdrive_text_embedding_flow, "doc_embeddings"
)
# Evaluate the transform flow defined above with the input query, to get the embedding.
Expand Down
2 changes: 1 addition & 1 deletion examples/gdrive_text_embedding/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "gdrive-text-embedding"
version = "0.1.0"
description = "Simple example for cocoindex: build embedding index based on Google Drive files."
requires-python = ">=3.11"
dependencies = ["cocoindex>=0.1.42", "python-dotenv>=1.0.1"]
dependencies = ["cocoindex>=0.1.52", "python-dotenv>=1.0.1"]

[tool.setuptools]
packages = []
2 changes: 1 addition & 1 deletion examples/image_search/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def image_object_embedding_flow(

img_embeddings.export(
"img_embeddings",
cocoindex.storages.Qdrant(collection_name=QDRANT_COLLECTION),
cocoindex.targets.Qdrant(collection_name=QDRANT_COLLECTION),
primary_key_fields=["id"],
)

Expand Down
2 changes: 1 addition & 1 deletion examples/image_search/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
description = "Simple example for cocoindex: build embedding index based on images."
requires-python = ">=3.11"
dependencies = [
"cocoindex>=0.1.42",
"cocoindex>=0.1.52",
"python-dotenv>=1.0.1",
"fastapi>=0.100.0",
"torch>=2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/image_search/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cocoindex>=0.1.42
cocoindex>=0.1.52
python-dotenv>=1.0.1
requests>=2.31.0
uvicorn>=0.29.0
Expand Down
2 changes: 1 addition & 1 deletion examples/manuals_llm_extraction/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ def manual_extraction_flow(

modules_index.export(
"modules",
cocoindex.storages.Postgres(table_name="modules_info"),
cocoindex.targets.Postgres(table_name="modules_info"),
primary_key_fields=["filename"],
)
2 changes: 1 addition & 1 deletion examples/manuals_llm_extraction/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "manuals-llm-extraction"
version = "0.1.0"
description = "Simple example for cocoindex: extract structured information from a Markdown file using LLM."
requires-python = ">=3.11"
dependencies = ["cocoindex>=0.1.42", "marker-pdf>=1.5.2"]
dependencies = ["cocoindex>=0.1.52", "marker-pdf>=1.5.2"]

[tool.setuptools]
packages = []
4 changes: 2 additions & 2 deletions examples/pdf_embedding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def pdf_embedding_flow(

pdf_embeddings.export(
"pdf_embeddings",
cocoindex.storages.Postgres(),
cocoindex.targets.Postgres(),
primary_key_fields=["id"],
vector_indexes=[
cocoindex.VectorIndexDef(
Expand All @@ -99,7 +99,7 @@ def pdf_embedding_flow(

def search(pool: ConnectionPool, query: str, top_k: int = 5):
# Get the table name, for the export target in the pdf_embedding_flow above.
table_name = cocoindex.utils.get_target_storage_default_name(
table_name = cocoindex.utils.get_target_default_name(
pdf_embedding_flow, "pdf_embeddings"
)
# Evaluate the transform flow defined above with the input query, to get the embedding.
Expand Down
2 changes: 1 addition & 1 deletion examples/pdf_embedding/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
description = "Simple example for cocoindex: build embedding index based on local PDF files."
requires-python = ">=3.11"
dependencies = [
"cocoindex>=0.1.42",
"cocoindex>=0.1.52",
"python-dotenv>=1.0.1",
"marker-pdf>=1.5.2",
]
Expand Down
6 changes: 3 additions & 3 deletions examples/product_recommendation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Please drop [CocoIndex on Github](https://github.com/cocoindex-io/cocoindex) a s

## Prerequisite
* [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one.
* Install [Neo4j](https://cocoindex.io/docs/ops/storages#neo4j-dev-instance) or [Kuzu](https://cocoindex.io/docs/ops/storages#kuzu-dev-instance) if you don't have one.
* Install [Neo4j](https://cocoindex.io/docs/ops/targets#neo4j-dev-instance) or [Kuzu](https://cocoindex.io/docs/ops/targets#kuzu-dev-instance) if you don't have one.
* The example uses Neo4j by default for now. If you want to use Kuzu, find out the "SELECT ONE GRAPH DATABASE TO USE" section and switch the active branch.
* [Configure your OpenAI API key](https://cocoindex.io/docs/ai/llm#openai).

## Documentation
You can read the official CocoIndex Documentation for Property Graph Targets [here](https://cocoindex.io/docs/ops/storages#property-graph-targets).
You can read the official CocoIndex Documentation for Property Graph Targets [here](https://cocoindex.io/docs/ops/targets#property-graph-targets).

## Run

Expand Down Expand Up @@ -43,7 +43,7 @@ cocoindex update main.py
After the knowledge graph is built, you can explore the knowledge graph.

* If you're using Neo4j, you can open the explorer at [http://localhost:7474](http://localhost:7474), with username `neo4j` and password `cocoindex`.
* If you're using Kuzu, you can start a Kuzu explorer locally. See [Kuzu dev instance](https://cocoindex.io/docs/ops/storages#kuzu-dev-instance) for more details.
* If you're using Kuzu, you can start a Kuzu explorer locally. See [Kuzu dev instance](https://cocoindex.io/docs/ops/targets#kuzu-dev-instance) for more details.

You can run the following Cypher query to get all relationships:

Expand Down
Loading