Skip to content

Bring your own models

CiteNexus bundles no models. Embedding, LLM, and optionally a reranker and a vision model for figures are injected by you. The shipped clients speak the OpenAI API — nothing runs locally that you didn’t wire up, and the key stays in your endpoint config.

Embedding and chat generation are the seams all three ports consume, so all three ship a client for them. Same endpoint, same ${ENV} header convention, one tab per language:

from citenexus import OpenAICompatibleEmbedding, OpenAICompatibleGenerator
embedder = OpenAICompatibleEmbedding(base_url="…/v1", model="bge-m3")
generator = OpenAICompatibleGenerator(base_url="…/v1", model="qwen2.5")

Auth on all three — ${ENV} templates expanded at the request boundary, never stored — is in Custom endpoints & auth.

The other two shipped clients, and the CiteNexus(...) constructor that consumes them, are Python. All four Python clients import from the top-level package and share one constructor shape (keyword-only base_url, model, transport, headers, plus role-specific extras):

from citenexus import (
CiteNexus,
OpenAICompatibleEmbedding,
OpenAICompatibleGenerator,
OpenAICompatibleReranker,
OpenAICompatibleVision,
)
rag = CiteNexus(
"./citenexus-data",
embedder=OpenAICompatibleEmbedding(base_url="…/v1", model="bge-m3"),
generator=OpenAICompatibleGenerator(base_url="…/v1", model="qwen2.5"),
vision=OpenAICompatibleVision(base_url="…/v1", model="qwen2.5-vl"), # figures → cited evidence
)

Any endpoint that speaks the OpenAI API works — Ollama, OpenAI, a local vLLM or llama.cpp server, or Gemini’s OpenAI-compatibility endpoint. The two shipped examples (examples/multilingual and examples/law-authority) run on hosted Jina + Gemini, which is the cheap default stack. For an all-local run, task local:ollama:up pulls the Ollama variant — bge-m3, qwen2.5, and the reranker xitao/bge-reranker-v2-m3 (note the xitao/ prefix).

Wiring a model these clients can’t reach over HTTP — an in-process ONNX or llama.cpp model, a local daemon, an SDK you already use, a test fixture — is one line, transport=: Bring your own model — swap the transport.

Go deeper on each: Custom endpoints & auth · Reranking & retrieval · Vision — figures as cited evidence.