Skip to content
Open
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
185 changes: 142 additions & 43 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ members = [
"web3-utils",
"grc20-core",
"grc20-macros",
"grc20-sdk", "mcp-server",
"grc20-sdk", "mcp-server", "ai-search",
]
23 changes: 23 additions & 0 deletions ai-search/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "ai-search"
version = "0.1.0"
edition = "2024"

[dependencies]
axum= "0.8.4"
anyhow = "1.0.89"
clap = { version = "4.5.39", features = ["derive", "env"] }
fastembed = "4.8.0"
futures = "0.3.31"
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread"] }

grc20-core = { version = "0.1.0", path = "../grc20-core" }
grc20-sdk = { version = "0.1.0", path = "../grc20-sdk" }

rand = "0.8"
regex = "1.10"
rig-core = "0.17.1"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
15 changes: 15 additions & 0 deletions ai-search/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# README ai-search

## API
ai-search is a REST API that can be queried at the adress 0.0.0.0:3000.
The are 2 available routes to query the knowledge graph using natural language.

The first route is /question that takes a question in the body as a String and give the anser back quicker. It uses less Gemini calls and is faster.
The second route is /question_ai that takes a question in the body as a String and gives an answer back. It rellies more on Gemini calls and is slower, but has more precision.


## Start command
```
cargo run --bin ai-search -- --neo4j-uri neo4j://localhost:7687 --neo4j-user neo4j --neo4j-pass neo4j --gemini-api-key <Your gemini api key>

```
11 changes: 11 additions & 0 deletions ai-search/ressources/traversal_prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
You are a Knowledge Graph traversal agent. Your goal is to answer the user’s question using the fewest steps possible.
You may:

<explore>ID</explore> to discover an unexplored neighbor’s details.

<answer>…</answer> to give a partial answer if you have some important information.

<end> if no path can yield the answer.

Never re-explore a node. Always choose the neighbor(s) most likely to contain the answer or get some more relevant information. Try to expand until you have an answer. You can explore multiple nodes and expansions at the same time with multiple explore.

Loading