Skip to main content

Knowledge graph ingestion engine for automated rule generation

Project description

qortex

Graph-Enhanced Retrieval Engine

PyPI Python CI License: MIT

Transforms unstructured content into a knowledge graph. Typed edges encode semantic relationships (REQUIRES, REFINES, USES). Personalized PageRank scores results by graph structure, and feedback from consumers adjusts rankings over time.

Install · Quick Start · Framework Adapters · Docs

Features

  • Graph-enhanced retrieval: Vector similarity + PPR over typed edges (REQUIRES, REFINES, USES...)
  • Explore and navigate: Traverse typed edges, discover neighbors and linked rules from any search result
  • Rules auto-surfaced: Query results include linked rules with relevance scores; no separate rules request needed
  • Feedback-driven learning: Consumer outcomes adjust PPR teleportation factors; results improve over time
  • Framework adapters: Drop-in for LangChain, Mastra, and any MCP client
  • Flexible ingestion: PDF, Markdown, and text sources into a unified knowledge graph
  • Projection pipeline: Source, Enricher, Target architecture for rule generation
  • Multiple backends: InMemory (testing), Memgraph (production with MAGE algorithms)

Install

pip install qortex            # Core: numpy, fastmcp, typer, pyyaml
pip install qortex[vec]       # + sentence-transformers (text-level search)
pip install qortex[vec-sqlite] # + sqlite-vec (persistent vector index)
pip install qortex[memgraph]  # + neo4j driver (production graph backend)
pip install qortex[all]       # Everything

What's included where

Capability Install What you get
Vector-level MCP tools (qortex_vector_*) pip install qortex Create indexes, upsert/query raw vectors, metadata filters. Consumers provide their own embeddings.
Text-level search (qortex_query) pip install qortex[vec] qortex embeds your text with sentence-transformers. Adds ~2GB for PyTorch + model weights.
Persistent vectors pip install qortex[vec-sqlite] SqliteVec index survives restarts. Without this, vectors are in-memory only.
Production graph pip install qortex[memgraph] Memgraph backend with MAGE algorithms for real PPR. Default is in-memory.

For MCP consumers (Mastra, Claude Desktop, etc.) that provide their own embeddings: the base pip install qortex is sufficient. The [vec] extra is only needed if you want qortex to embed text for you.

Quick start

Search, explore, learn

from qortex.client import LocalQortexClient

client = LocalQortexClient(vector_index, backend, embedding, mode="graph")

# Search: vec + graph combined scoring, rules auto-surfaced
result = client.query("OAuth2 authorization", domains=["security"], top_k=5)

# Explore: traverse typed edges from any result
explore = client.explore(result.items[0].node_id)
for edge in explore.edges:
    print(f"{edge.source_id} --{edge.relation_type}--> {edge.target_id}")

# Feedback: close the learning loop
client.feedback(result.query_id, {result.items[0].id: "accepted"})

LangChain VectorStore

from langchain_qortex import QortexVectorStore

vs = QortexVectorStore.from_texts(texts, embedding, domain="security")
docs = vs.similarity_search("authentication", k=5)
retriever = vs.as_retriever()

See langchain-qortex for the standalone package.

Mastra MastraVector

import { QortexVector } from "@peleke.s/mastra-qortex";

const qortex = new QortexVector({ id: "qortex" });
await qortex.createIndex({ indexName: "docs", dimension: 384 });
await qortex.upsert({ indexName: "docs", vectors: embeddings, metadata });
const results = await qortex.query({ indexName: "docs", queryVector: q, topK: 10 });

See @peleke.s/mastra-qortex for the standalone package.

MCP server

qortex mcp-serve  # stdio transport, works with Claude Desktop / any MCP client

Tools: qortex_query, qortex_explore, qortex_rules, qortex_feedback, qortex_ingest, qortex_domains, qortex_status, plus 9 vector-level tools (qortex_vector_*).

Project rules

from qortex.projectors.projection import Projection
from qortex.projectors.sources.flat import FlatRuleSource
from qortex.projectors.targets.buildlog_seed import BuildlogSeedTarget

projection = Projection(
    source=FlatRuleSource(backend=backend),
    target=BuildlogSeedTarget(persona_name="my_rules"),
)
result = projection.project(domains=["my_domain"])

Framework adapters

Framework Package Language Interface
LangChain langchain-qortex Python VectorStore ABC
Mastra @peleke.s/mastra-qortex TypeScript MastraVector abstract class
Any MCP client Built-in MCP server Any MCP tools (JSON-RPC)

Architecture

Sources (PDF/MD/Text)
  -> Ingestion (LLM extraction -> concepts + typed edges + rules)
    -> Knowledge Graph (InMemoryBackend | Memgraph)
      -> VectorIndex (NumpyVectorIndex | SqliteVecIndex)
        -> Retrieval (PPR + cosine -> combined scoring)
          -> Consumers (LangChain, Mastra, MCP, buildlog, agents)

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qortex-0.3.7.tar.gz (9.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qortex-0.3.7-py3-none-any.whl (220.9 kB view details)

Uploaded Python 3

File details

Details for the file qortex-0.3.7.tar.gz.

File metadata

  • Download URL: qortex-0.3.7.tar.gz
  • Upload date:
  • Size: 9.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qortex-0.3.7.tar.gz
Algorithm Hash digest
SHA256 b5fc6fc3357e7dc5ab679884b3bb766cacf1063ab4e7883a932e7cdc19b3531f
MD5 cfe361551d5d71d05eaabe54718d802b
BLAKE2b-256 92c5a29585e0160e3ced9cbca2f22508badba8f6586c4e442510e9a78ce5af0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for qortex-0.3.7.tar.gz:

Publisher: publish.yml on Peleke/qortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qortex-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: qortex-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 220.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qortex-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 367d82d2e54463dbd4d3b6b20320111c9ae9e12e9372e7742c4b1319c79d5f2a
MD5 91ef9abcd5ca4bc8a1b1e5c98efdbdd6
BLAKE2b-256 4dd17e95b8f43c04f0bbf85b1ef199b2deb3e9960c8a33d760fcc777d71f81e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for qortex-0.3.7-py3-none-any.whl:

Publisher: publish.yml on Peleke/qortex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page