Data source entities
Entities are the nodes of the graph. Each one is a
class decorated with @graph_entity, extending DataSourceEntity, whose fields are
typed properties. Virgo uses those types to index, embed, and canonicalize the
entity.
Private preview
The Python SDK is in private preview, so APIs may still change. Email sales@virgo.fyi for early access.
@graph_entity(name="pull_request", aliases=["PR", "MR"])
class PullRequest(DataSourceEntity):
pr_id = EntityIdProperty(description="Pull request ID")
title = EntityStringProperty(index=True, vectorize=True)
status = EntityStringProperty(index=True)
created_at = EntityDateTimeProperty()
repository = EntityRelationshipProperty(relation="in_repository")
reviewers = EntityRelationshipProperty(relation="reviewed_by", multiple=True)Field types
Properties carry the type and intent of each field. The common ones are
EntityIdProperty, EntityStringProperty, EntityEmailProperty,
EntityUrlProperty, EntityDateTimeProperty, EntityIntegerProperty,
EntityBooleanProperty, and EntityArrayProperty.
Field flags
Flags tell Virgo how to use a field:
EntityIdPropertymarks the identifier Virgo uses to canonicalize records, so the same pull request collapses into one node no matter how often it is seen.index=Truemakes a field filterable in the graph.vectorize=Trueembeds it for semantic retrieval.keywords=Trueadds it to keyword search.EntityRelationshipProperty(relation=..., multiple=...)points the entity at other entities through a named relation.
Register the entity on your connector's entities list. See
Defining your data source.
Related
- Entities: the concept behind the nodes.
- Entity relationships: connect the entities you declare.