Skip to content

Commit

Permalink
wip integrate falkordb (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
AviAvni authored and cybermaggedon committed Dec 19, 2024
1 parent 8c1b468 commit 848040c
Show file tree
Hide file tree
Showing 21 changed files with 664 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN pip3 install anthropic boto3 cohere openai google-cloud-aiplatform ollama go
langchain langchain-core langchain-huggingface langchain-text-splitters \
langchain-community pymilvus sentence-transformers transformers \
huggingface-hub pulsar-client cassandra-driver pyyaml \
neo4j tiktoken && \
neo4j tiktoken falkordb && \
pip3 cache purge

# ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TEMPLATES=azure bedrock claude cohere mix llamafile ollama openai vertexai \
DCS=$(foreach template,${TEMPLATES},${template:%=tg-launch-%.yaml})

MODELS=azure bedrock claude cohere llamafile ollama openai vertexai
GRAPHS=cassandra neo4j
GRAPHS=cassandra neo4j falkordb

# tg-launch-%.yaml: templates/%.jsonnet templates/components/version.jsonnet
# jsonnet -Jtemplates \
Expand Down
2 changes: 1 addition & 1 deletion docs/README.quickstart-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
> [!TIP]
> If using `Podman`, the only change will be to substitute `podman` instead of `docker` in all commands.
All `TrustGraph` components are deployed through a `Docker Compose` file. There are **16** `Docker Compose` files to choose from, depending on the desired model deployment and choosing between the graph stores `Cassandra` or `Neo4j`:
All `TrustGraph` components are deployed through a `Docker Compose` file. There are **16** `Docker Compose` files to choose from, depending on the desired model deployment and choosing between the graph stores `Cassandra` or `Neo4j` or `FalkorDB`:

- `AzureAI` serverless endpoint for deployed models in Azure
- `Bedrock` API for models deployed in AWS Bedrock
Expand Down
1 change: 1 addition & 0 deletions templates/all-patterns.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import "patterns/grafana.jsonnet",
import "patterns/triple-store-cassandra.jsonnet",
import "patterns/triple-store-neo4j.jsonnet",
import "patterns/triple-store-falkordb.jsonnet",
import "patterns/graph-rag.jsonnet",
import "patterns/llm-azure.jsonnet",
import "patterns/llm-azure-openai.jsonnet",
Expand Down
2 changes: 2 additions & 0 deletions templates/components.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"graph-rag": import "components/graph-rag.jsonnet",
"triple-store-cassandra": import "components/cassandra.jsonnet",
"triple-store-neo4j": import "components/neo4j.jsonnet",
"triple-store-falkordb": import "components/falkordb.jsonnet",
"triple-store-memgraph": import "components/memgraph.jsonnet",
"llamafile": import "components/llamafile.jsonnet",
"ollama": import "components/ollama.jsonnet",
Expand Down Expand Up @@ -39,6 +40,7 @@
"qdrant": import "components/qdrant.jsonnet",
"pinecone": import "components/pinecone.jsonnet",
"milvus": import "components/milvus.jsonnet",
"falkordb": import "components/falkordb.jsonnet",
"trustgraph": import "components/trustgraph.jsonnet",

}
76 changes: 76 additions & 0 deletions templates/components/falkordb.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local falkordb = import "stores/falkordb.jsonnet";

falkordb + {

"falkordb-url":: "falkor://falkordb:6379",

"store-triples" +: {

create:: function(engine)

local container =
engine.container("store-triples")
.with_image(images.trustgraph)
.with_command([
"triples-write-falkordb",
"-p",
url.pulsar,
"-g",
$["falkordb-url"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");

local containerSet = engine.containers(
"store-triples", [ container ]
);

local service =
engine.internalService(containerSet)
.with_port(8080, 8080, "metrics");

engine.resources([
containerSet,
service,
])

},

"query-triples" +: {

create:: function(engine)

local container =
engine.container("query-triples")
.with_image(images.trustgraph)
.with_command([
"triples-query-falkordb",
"-p",
url.pulsar,
"-g",
$["falkordb-url"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");

local containerSet = engine.containers(
"query-triples", [ container ]
);

local service =
engine.internalService(containerSet)
.with_port(8080, 8080, "metrics");

engine.resources([
containerSet,
service,
])


}

}

2 changes: 1 addition & 1 deletion templates/generate-all
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def generate_all(output, version):
"azure", "azure-openai", "bedrock", "claude", "cohere",
"googleaistudio", "llamafile", "ollama", "openai", "vertexai",
]:
for graph in [ "cassandra", "neo4j" ]:
for graph in [ "cassandra", "neo4j", "falkordb" ]:

y = generate_config(
llm=model, graph_store=graph, platform=platform,
Expand Down
13 changes: 13 additions & 0 deletions templates/patterns/triple-store-falkordb.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
pattern: {
name: "triple-store-falkordb",
icon: "🖇️🙋‍♀️",
title: "Adds a FalkorDB store configured to act as a triple store.",
description: "GraphRAG processing needs a triple store. This pattern adds a FalkorDB store, along with plumbing so that FalkorDB is integrated with GraphRag indexing and querying.",
requires: ["pulsar", "trustgraph"],
features: ["falkordb", "triple-store"],
args: [],
category: [ "knowledge-graph" ],
},
module: "components/falkordb.jsonnet",
}
2 changes: 1 addition & 1 deletion templates/patterns/triple-store-neo4j.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: "triple-store-neo4j",
icon: "🖇️🙋‍♀️",
title: "Adds a Neo4j store configured to act as a triple store.",
description: "GraphRAG processing needs a triple store. This pattern adds a Cassandra store, along with plumbing so that Cassandra is integrated with GraphRag indexing and querying.",
description: "GraphRAG processing needs a triple store. This pattern adds a Neo4j store, along with plumbing so that Neo4j is integrated with GraphRag indexing and querying.",
requires: ["pulsar", "trustgraph"],
features: ["neo4j", "triple-store"],
args: [],
Expand Down
39 changes: 39 additions & 0 deletions templates/stores/falkordb.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";

{

"falkordb" +: {

create:: function(engine)

local vol = engine.volume("falkordb").with_size("20G");

local container =
engine.container("falkordb")
.with_image(images.falkordb)
.with_limits("1.0", "768M")
.with_reservations("0.5", "768M")
.with_port(6379, 6379, "api")
.with_port(3000, 3000, "ui")
.with_volume_mount(vol, "/data");

local containerSet = engine.containers(
"falkordb", [ container ]
);

local service =
engine.service(containerSet)
.with_port(6379, 6379, "api")
.with_port(3000, 3000, "ui");

engine.resources([
vol,
containerSet,
service,
])

},

}

1 change: 1 addition & 0 deletions templates/values/images.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ local version = import "version.jsonnet";
qdrant: "docker.io/qdrant/qdrant:v1.11.1",
memgraph_mage: "docker.io/memgraph/memgraph-mage:1.22-memgraph-2.22",
memgraph_lab: "docker.io/memgraph/lab:2.19.1",
falkordb: "falkordb/falkordb:latest"
}
6 changes: 6 additions & 0 deletions trustgraph-flow/scripts/triples-query-falkordb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3

from trustgraph.query.triples.falkordb import run

run()

6 changes: 6 additions & 0 deletions trustgraph-flow/scripts/triples-write-falkordb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3

from trustgraph.storage.triples.falkordb import run

run()

3 changes: 3 additions & 0 deletions trustgraph-flow/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"jsonschema",
"aiohttp",
"pinecone[grpc]",
"falkordb",
],
scripts=[
"scripts/api-gateway",
Expand Down Expand Up @@ -104,9 +105,11 @@
"scripts/triples-query-cassandra",
"scripts/triples-query-neo4j",
"scripts/triples-query-memgraph",
"scripts/triples-query-falkordb",
"scripts/triples-write-cassandra",
"scripts/triples-write-neo4j",
"scripts/triples-write-memgraph",
"scripts/triples-write-falkordb",
"scripts/wikipedia-lookup",
]
)
3 changes: 3 additions & 0 deletions trustgraph-flow/trustgraph/query/triples/falkordb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

from . service import *

7 changes: 7 additions & 0 deletions trustgraph-flow/trustgraph/query/triples/falkordb/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3

from . hf import run

if __name__ == '__main__':
run()

Loading

0 comments on commit 848040c

Please sign in to comment.