-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V3 graph implmentations #1593
V3 graph implmentations #1593
Changes from 18 commits
d7791f2
370d947
6fdbd6c
547b9e9
a2dc253
1c2f877
e1b5443
db2cd77
541215b
819d6dd
110e87d
257bda8
deedf56
d6044b5
4655043
314ad01
c576ec7
623de53
3289e3d
ad1eada
68327e6
62252ed
0918944
7636c9d
1cb66cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,7 +229,7 @@ async def get_entities( | |
@click.option( | ||
"--collection-id", | ||
required=True, | ||
help="Collection ID to retrieve triples from.", | ||
help="Collection ID to retrieve relationships from.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the SDK, let's leave the CLI as is. I have a deprecation wrapper that we can add to these methods, and then we will point users to the new command. |
||
) | ||
@click.option( | ||
"--offset", | ||
|
@@ -244,31 +244,31 @@ async def get_entities( | |
help="Limit for pagination.", | ||
) | ||
@click.option( | ||
"--triple-ids", | ||
"--relationship-ids", | ||
multiple=True, | ||
help="Triple IDs to filter by.", | ||
help="Relationship IDs to filter by.", | ||
) | ||
@click.option( | ||
"--entity-names", | ||
multiple=True, | ||
help="Entity names to filter by.", | ||
) | ||
@pass_context | ||
async def get_triples( | ||
ctx, collection_id, offset, limit, triple_ids, entity_names | ||
async def get_relationships( | ||
ctx, collection_id, offset, limit, relationship_ids, entity_names | ||
): | ||
""" | ||
Retrieve triples from the knowledge graph. | ||
Retrieve relationships from the knowledge graph. | ||
""" | ||
client: R2RAsyncClient = ctx.obj | ||
|
||
with timer(): | ||
response = await client.get_triples( | ||
response = await client.get_relationships( | ||
collection_id, | ||
offset, | ||
limit, | ||
list(entity_names), | ||
list(triple_ids), | ||
list(relationship_ids), | ||
) | ||
|
||
click.echo(json.dumps(response, indent=2)) | ||
|
@@ -291,7 +291,7 @@ async def delete_graph_for_collection(ctx, collection_id, cascade): | |
""" | ||
Delete the graph for a given collection. | ||
|
||
NOTE: Setting the cascade flag to true will delete entities and triples for documents that are shared across multiple collections. Do not set this flag unless you are absolutely sure that you want to delete the entities and triples for all documents in the collection. | ||
NOTE: Setting the cascade flag to true will delete entities and relationships for documents that are shared across multiple collections. Do not set this flag unless you are absolutely sure that you want to delete the entities and relationships for all documents in the collection. | ||
""" | ||
client: R2RAsyncClient = ctx.obj | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,36 @@ | |
WrappedUpdateResponse, | ||
) | ||
from shared.api.models.kg.responses import ( | ||
KGCreationEstimationResponse, | ||
KGCreationResponse, | ||
KGDeduplicationEstimationResponse, | ||
KGEnrichmentEstimationResponse, | ||
KGEnrichmentResponse, | ||
KGEntityDeduplicationResponse, | ||
WrappedKGCommunitiesResponse, | ||
WrappedKGCreationResponse, | ||
WrappedKGEnrichmentResponse, | ||
WrappedKGEntitiesResponse, | ||
WrappedKGEntityDeduplicationResponse, | ||
WrappedKGTriplesResponse, | ||
WrappedKGRelationshipsResponse, | ||
WrappedKGTunePromptResponse, | ||
) | ||
|
||
|
||
from shared.api.models.kg.responses_v3 import ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to get ride of the validation on the v2 endpoints—it's there for legacy, and should work, but, no need to have two versions of this for legacy code. |
||
WrappedKGEntitiesResponse as WrappedKGEntitiesResponseV3, | ||
WrappedKGRelationshipsResponse as WrappedKGRelationshipsResponseV3, | ||
WrappedKGCommunitiesResponse as WrappedKGCommunitiesResponseV3, | ||
WrappedKGCreationResponse as WrappedKGCreationResponseV3, | ||
WrappedKGEnrichmentResponse as WrappedKGEnrichmentResponseV3, | ||
WrappedKGTunePromptResponse as WrappedKGTunePromptResponseV3, | ||
WrappedKGEntityDeduplicationResponse as WrappedKGEntityDeduplicationResponseV3, | ||
WrappedKGDeletionResponse as WrappedKGDeletionResponseV3, | ||
KGCreationResponse as KGCreationResponseV3, | ||
KGEnrichmentResponse as KGEnrichmentResponseV3, | ||
KGEntityDeduplicationResponse as KGEntityDeduplicationResponseV3, | ||
KGTunePromptResponse as KGTunePromptResponseV3, | ||
KGDeletionResponse as KGDeletionResponseV3, | ||
) | ||
|
||
|
||
from shared.api.models.management.responses import ( | ||
AnalyticsResponse, | ||
AppSettingsResponse, | ||
|
@@ -96,17 +112,29 @@ | |
"WrappedMetadataUpdateResponse", | ||
"WrappedListVectorIndicesResponse", | ||
"UpdateResponse", | ||
# Knowledge Graph Responses | ||
# Knowledge Graph Responses for V2 | ||
# will be removed eventually | ||
"KGCreationResponse", | ||
"WrappedKGCreationResponse", | ||
"KGEnrichmentResponse", | ||
"WrappedKGEnrichmentResponse", | ||
"KGEntityDeduplicationResponse", | ||
"WrappedKGEntityDeduplicationResponse", | ||
"WrappedKGTunePromptResponse", | ||
"KGCreationEstimationResponse", | ||
"KGDeduplicationEstimationResponse", | ||
"KGEnrichmentEstimationResponse", | ||
# Knowledge Graph Responses for V3 | ||
"WrappedKGEntitiesResponseV3", | ||
"WrappedKGRelationshipsResponseV3", | ||
"WrappedKGCommunitiesResponseV3", | ||
"WrappedKGCreationResponseV3", | ||
"WrappedKGEnrichmentResponseV3", | ||
"WrappedKGTunePromptResponseV3", | ||
"WrappedKGEntityDeduplicationResponseV3", | ||
"KGCreationResponseV3", | ||
"KGEnrichmentResponseV3", | ||
"KGEntityDeduplicationResponseV3", | ||
"KGTunePromptResponseV3", | ||
"WrappedKGDeletionResponseV3", | ||
"KGDeletionResponseV3", | ||
# Management Responses | ||
"PromptResponse", | ||
"ServerStats", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the SDK methods here to getTriples, as not to break any current implementation. We can also add an
@deprecated
warning to this such that it warns users to switch to the v3 SDK methods