Skip to content

angee.knowledge_graph_pgvector.schema

GraphQL contributions for the knowledge pgvector plugin.

Two seams onto the knowledge schema, neither editing it:

  • type_extensions — :class:PageGraphPgvectorExtension adds a related_pages projection onto knowledge's PageType (mirrors iam_integrate_oidc's OAuthClientOidcExtension). The composer has already folded the type by name, so the extra field reads as native.
  • query — :class:GraphPgvectorQuery adds a semantic_search root field that forces this plugin's pgvector retrieval backend, resolved through the vault's public retrieval_for seam (so the strategy stays swappable, not hard-wired, and the plugin never touches knowledge's model internals).

Both buckets carry the same parts into public and console, the schema names knowledge exposes PageType on. The provider is a lexical stub today (see :mod:~angee.knowledge_graph_pgvector.retrieval); the GraphQL shape is what a real semantic backend drops into.

PageGraphPgvectorExtension

python
@strawberry_django.type(Page, name="PageType", extend=True)
class PageGraphPgvectorExtension()

Contributes related_pages onto knowledge's PageType.

The projection seam a graph-RAG plugin uses to surface neighbours on the page read. The skeleton returns actor-visible sibling pages in the same vault as a structural placeholder — REBAC row scope is applied (apply_ambient_scope, like PageType.backlinks); a real plugin ranks by embedding distance over the column it adds to knowledge.Page.

python
@strawberry_django.field(only=["vault_id"])
def related_pages() -> list[PageType]

Return up to a handful of actor-visible related pages in the same vault.

GraphPgvectorQuery

python
@strawberry.type
class GraphPgvectorQuery()

Semantic content queries this plugin adds to the knowledge surface.

python
@strawberry.field
def semantic_search(vault: PublicID,
                    query: str,
                    first: int = 10) -> list[PageType]

Return actor-visible pages in vault semantically matching query.

Unlike knowledge's search_pages (which honours the vault's configured default), this forces the plugin's pgvector backend — resolved through the vault's public :meth:~angee.knowledge.models.Vault.retrieval_for seam, so the plugin selects its strategy by key without reaching into knowledge's model internals. Row scope is the backend's responsibility (apply_ambient_scope). The backend is a lexical stub until embeddings exist.

schemas

GraphQL contributions installed by the knowledge pgvector plugin.

Released under the AGPL-3.0 License.