Skip to content

Commit

Permalink
Modify return spec (#1206)
Browse files Browse the repository at this point in the history
* Feature/improve r2r telemetry (#1122)

* improve telemetry

* finish telemetry tweaks

* Feature/improve cli infra (#1123)

* improve telemetry

* finish telemetry tweaks

* up

* Feature/add serve fallback to main (#1125)

* improve telemetry

* finish telemetry tweaks

* up

* fallback to main

* Merge fragments (#1127)

* troubleshooting docs (#1128)

* troubleshooting docs (#1129)

* add system diagram (#1130)

* add system diagram

* rm multi

* fix overview

* cleanup and fix

* fix syntax

* change to fast strategy by default (#1133)

* Update parameter passing in js sdk (#1132)

* Docs changes + add entity and relationship types (#1134)

* up

* up

* up

* up

* reduce verbosity

* Feature/dev minor cleanups (#1135)

* cleanups

* bump pkg

* Update Tesseract OCR version in Dockerfile and change chunking strategy to "auto"

* Update chunking strategy to "auto" in r2r.toml

* up

* set response model

* add communities

* update docs

* revert

* chore: Remove unused 'reload' parameter in run_local_serve function

---------

Co-authored-by: emrgnt-cmplxty <68796651+emrgnt-cmplxty@users.noreply.github.com>
Co-authored-by: Nolan Tremelling <34580718+NolanTrem@users.noreply.github.com>
Co-authored-by: emrgnt-cmplxty <owen@algofi.org>
  • Loading branch information
4 people authored Sep 19, 2024
1 parent 3077327 commit 30dfd06
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/openapi.json

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions docs/cookbooks/graphrag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,17 @@ r2r create-graph --document-ids=9fbe403b-c11c-5aae-8ade-ef22980c3ad1
This step will create a knowledge graph with nodes and relationships. You can visualize the graph in two ways:


1. Using the `r2r inspect-knowledge-graph` command.
1. Using the neo4j browser on `http://localhost:7474`. The username and password are `neo4j` and `ineedastrongerpassword`. To visualize the graph, run the following command in the neo4j browser:

```
MATCH (a)
RETURN a
```

![Aristotle Graph](../images/aristotle.png)


2. Using the `r2r inspect-knowledge-graph` command.

```bash
r2r inspect-knowledge-graph
Expand Down Expand Up @@ -212,17 +222,6 @@ Number of connected components: 7
Nicomachus: 0.0189
```

2. Using the neo4j browser on `http://localhost:7474`. The username and password are `neo4j` and `ineedastrongerpassword`. To visualize the graph, run the following command in the neo4j browser:

```
MATCH (a)
RETURN a
```

![Aristotle Graph](../images/aristotle.png)



## Graph Enrichment

Now we have a graph, but this graph is not searchable yet. We need to perform the graph enrichment step.
Expand Down
11 changes: 0 additions & 11 deletions docs/documentation/deployment/troubleshooting/port_conflicts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,6 @@ Neo4j uses ports 7474 (HTTP) and 7687 (Bolt). If these are conflicting:
sudo lsof -i :7687
```

2. Modify the Neo4j service in docker-compose.yml:
```yaml
services:
neo4j:
ports:
- "7475:7474"
- "7688:7687"
```
3. Update Neo4j connection strings in your R2R configuration to use the new ports.
### Hatchet Engine Conflict

If the Hatchet engine (default port 7077) is conflicting:
Expand Down
1 change: 0 additions & 1 deletion py/cli/utils/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ async def run_local_serve(
await r2r_instance.orchestration_provider.start_worker()
r2r_instance.serve(host, available_port)


def run_docker_serve(
host: str,
port: int,
Expand Down
2 changes: 1 addition & 1 deletion py/compose.neo4j.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
neo4j:
image: neo4j:5.21.0
ports:
- "7475:7475" # HTTP
- "7474:7474" # HTTP
- "7687:7687" # Bolt
environment:
- NEO4J_AUTH=${NEO4J_AUTH:-neo4j/ineedastrongerpassword}
Expand Down
40 changes: 35 additions & 5 deletions py/core/base/abstractions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,49 @@ class KGEntityResult(BaseModel):
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Entity Name",
"description": "Entity Description",
"metadata": {},
}

class KGRelationshipResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Relationship Name",
"description": "Relationship Description",
"metadata": {},
}

class KGCommunityResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Community Name",
"description": "Community Description",
"metadata": {},
}

class KGGlobalResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None


class Config:
json_schema_extra = {
"name": "Global Result Name",
"description": "Global Result Description",
"metadata": {},
}

class KGSearchResult(BaseModel):
method: KGSearchMethod
content: Union[KGEntityResult, KGRelationshipResult, KGCommunityResult, KGGlobalResult]
Expand All @@ -95,11 +123,13 @@ class KGSearchResult(BaseModel):
class Config:
json_schema_extra = {
"method": "local",
"content": "",
"content": KGEntityResult.Config.json_schema_extra,
"result_type": "entity",
"fragment_ids": [],
"document_ids": [],
"metadata": {},
"fragment_ids": [ 'c68dc72e-fc23-5452-8f49-d7bd46088a96'],
"document_ids": [ '3e157b3a-8469-51db-90d9-52e7d896b49b'],
"metadata": {
"associated_query": "What is the capital of France?"
},
}

class AggregateSearchResult(BaseModel):
Expand Down
37 changes: 33 additions & 4 deletions py/sdk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,49 @@ class KGEntityResult(BaseModel):
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Entity Name",
"description": "Entity Description",
"metadata": {},
}

class KGRelationshipResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Relationship Name",
"description": "Relationship Description",
"metadata": {},
}

class KGCommunityResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Community Name",
"description": "Community Description",
"metadata": {},
}


class KGGlobalResult(BaseModel):
name: str
description: str
metadata: Optional[dict[str, Any]] = None

class Config:
json_schema_extra = {
"name": "Global Result Name",
"description": "Global Result Description",
"metadata": {},
}

class KGSearchResult(BaseModel):
method: KGSearchMethod
Expand All @@ -228,11 +257,11 @@ class KGSearchResult(BaseModel):
class Config:
json_schema_extra = {
"method": "local",
"content": "",
"content": KGEntityResult.Config.json_schema_extra,
"result_type": "entity",
"fragment_ids": [],
"document_ids": [],
"metadata": {},
"fragment_ids": [ 'c68dc72e-fc23-5452-8f49-d7bd46088a96'],
"document_ids": [ '3e157b3a-8469-51db-90d9-52e7d896b49b'],
"metadata": { "associated_query": "What is the capital of France?" },
}

class R2RException(Exception):
Expand Down

0 comments on commit 30dfd06

Please sign in to comment.