Skip to content

graphify: optional Fabric delegation for the RAG pre-stage#1

Merged
JasonDD merged 1 commit into
mainfrom
feature/platform-integration
May 26, 2026
Merged

graphify: optional Fabric delegation for the RAG pre-stage#1
JasonDD merged 1 commit into
mainfrom
feature/platform-integration

Conversation

@JasonDD
Copy link
Copy Markdown
Contributor

@JasonDD JasonDD commented May 26, 2026

Summary

Adds graphify.fabric_url + fabric_key + fabric_rag_weights to
GraphifyConfig. When fabric_url is set, the augment/compress
middleware delegates retrieval to Fabric's /v1/rag instead of the
embedded pgvector + sentence-transformers backend. If unset,
embedded behaviour is unchanged so single-box deployments keep
working.

  • On any Fabric error we log + fall back to embedded retrieval, so a
    flaky Fabric host never fails a chat request.
  • Default ranking weights are pure cosine -- Router asks Fabric for
    code-chunk relevance, and Fabric's memo-search default of
    cosine 0.5 + tsvector 0.3 + recency 0.2 is the wrong blend for
    that workload.
  • New file graphify_fabric.go: fabricRetrieve() + wire types
  • Middleware: new retrieve() helper branches Fabric vs embedded
  • main.go: middleware constructs in fabric-only mode when no local
    embedder is available
  • Four new Prometheus counters:
    kronaxis_router_graphify_fabric_{calls,fails,chunks,fallbacks}_total
  • examples/fabric-integration.yaml: dedicated reference config
  • Inline docs in the main config.yaml graphify block

Companion PR (Fabric side):
Kronaxis/kronaxis-fabric#1

Test plan

  • go build ./... and go vet ./... pass
  • go test ./... -- all 136 existing tests still pass
  • End-to-end smoke against fabric v0.10 on DL580 (192.168.50.129:8201):
    - Router starts: graphify enabled: mode=fabric-only fabric_url="..."
    - Chat completion logs: graphify: delegating to fabric url=... top_k=3 weights=cosine:1.00,... then graphify: fabric returned 2 chunks (~132 tokens)
    - Response headers include X-Kronaxis-Graphify: augment +
    X-Kronaxis-Graphify-Chunks: 2
    - /metrics shows graphify_fabric_calls_total=1, fails=0, chunks=2
    - Backing LLM (qwen-coder-32b) used the chunk content in its reply

Out of scope

  • Chunk ingestion pipeline (separate workstream -- Router's existing
    chunk-builder code can be retargeted to POST to Fabric's /v1/chunks)
  • Performance benchmarking
  • Tests beyond smoke (the path goes through the existing middleware so
    the embedded-path tests still cover the fallback branch)

DO NOT merge yet -- operator review.

Adds graphify.fabric_url + fabric_key + fabric_rag_weights to
GraphifyConfig. When fabric_url is set, the augment/compress middleware
delegates retrieval to Fabric's /v1/rag instead of the embedded
pgvector + sentence-transformers backend. If unset, embedded behaviour
is unchanged so single-box deployments keep working.

On any Fabric error we log + fall back to embedded retrieval, so a
flaky Fabric host never fails a chat request. Default ranking weights
are pure cosine because Router asks Fabric for code-chunk relevance,
and Fabric's memo-search default of cosine 0.5 + tsvector 0.3 +
recency 0.2 is the wrong blend for that workload.

Adds:
- GraphifyConfig.{FabricURL,FabricKey,FabricRAGWeights,FabricTimeoutMS}
- graphify_fabric.go: fabricRetrieve() + FabricRAG{Request,Response}
- middleware: new retrieve() helper that branches Fabric vs embedded
- main.go: middleware now constructs in fabric-only mode when no local
  embedder is available
- four new Prometheus counters: kronaxis_router_graphify_fabric_{calls,
  fails,chunks,fallbacks}_total
- examples/fabric-integration.yaml: dedicated reference config
- inline docs in the main config.yaml graphify block

Companion PR: kronaxis-fabric#feature/platform-integration adds the
/v1/rag endpoint this targets.

Smoke-tested end-to-end against fabric v0.10 on DL580 (192.168.50.129:
8201) with two seeded chunks; router metrics show fabric_calls=1,
fabric_fails=0, fabric_chunks=2.
@JasonDD JasonDD merged commit 2ee9df2 into main May 26, 2026
1 check passed
@JasonDD JasonDD deleted the feature/platform-integration branch May 26, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant