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.6.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.6-py3-none-any.whl (220.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qortex-0.3.6.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.6.tar.gz
Algorithm Hash digest
SHA256 e46041cc369d62c96cfbd13af94ae836900e1343a64fa7bae34bc7e6d453396f
MD5 c03469c45acd50014f883de13bd0bfb4
BLAKE2b-256 db39585bf8d175ab35f164dbf122a0a73033cbe552d04628a7601676fb02e89b

See more details on using hashes here.

Provenance

The following attestation bundles were made for qortex-0.3.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: qortex-0.3.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0b14d7fe831fd5632c779805679771304e63066f147ec8ab5f80b05ca9e5e307
MD5 1fe3bb9cc00be776e1b68897f428bae9
BLAKE2b-256 06e783c20be072710fde8a1c4f6f3b07b3b1480c9cbbcbadec1670d975bc7116

See more details on using hashes here.

Provenance

The following attestation bundles were made for qortex-0.3.6-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