RAG with data residency

Retrieval-augmented generation sends your entire knowledge base through an embeddings API — contracts, patient notes, case files. With a US-controlled API that corpus leaves your jurisdiction at index time, before a single chat request is made. NeuralRing's POST /api/v1/embeddings applies the same rule as chat: the sovereignty pin is applied first and can never be loosened by price, speed, or fallback logic.

What you get on every embeddings request
  • Routing only to endpoints satisfying sovereignty.jurisdiction / min_tier / min_assurance — if none qualifies you get an honest no_eligible_endpoint error, never a silent non-sovereign fallback.
  • A signed, hash-chained, content-free attestation (input token counts, serving endpoint, jurisdiction, policy) — the audit substrate for your Art. 26(6)-style records.
  • Metering per input token across the whole batch; failover hops recorded if the primary endpoint failed.

OpenAI SDK (Python) — drop-in

# pip install openai — zero NeuralRing dependencies (drop-in)
from openai import OpenAI

client = OpenAI(
    base_url="https://neuralring.eu/api/v1",
    api_key="nr_...",
)

# 1) Embed your corpus — pinned to Germany, verified endpoints only.
#    extra_body carries the NeuralRing routing extensions.
resp = client.embeddings.create(
    model="dev/embed-de",
    input=["Vertragsentwurf Abschnitt 4.2 ...", "Datenschutzfolgeabschätzung ..."],
    extra_body={"sovereignty": {"jurisdiction": ["DE"], "min_assurance": "verified"}},
)
vectors = [d.embedding for d in resp.data]

# 2) Every call emitted a signed, content-free attestation:
#    x-neuralring-request-id → GET /api/v1/attestations/{id}
#    It proves WHERE the embedding ran and under which policy — your
#    auditors verify it offline against the published Ed25519 key.

TypeScript SDK

import { NeuralRing } from "@neuralring/sdk";

const nr = new NeuralRing({ baseUrl: "https://neuralring.eu", apiKey: process.env.NEURALRING_API_KEY! });
const res = await nr.embeddings({
  model: "dev/embed-de",
  input: ["chunk one", "chunk two"],
  sovereignty: { jurisdiction: ["DE"], min_assurance: "verified" },
});
console.log(res.data.length, res.neuralring); // vectors + who served, tier, attestation id

Batch inputs (string[] or token arrays) meter as the sum of their tokens. encoding_format: "base64" and dimensions pass through where the endpoint supports them. Embedding models carry modality: ["embedding"] in GET /api/v1/models, with measured latency (never invented numbers) from the perf sweep.