πŸ’¬
Available

AI Assistant

AI Assistant provides a complete, multi-tenant RAG (Retrieval-Augmented Generation) infrastructure. Each tenant has its own isolated knowledge bases, fed by PDF, DOCX, Markdown, or plain-text documents. Hybrid search combines pgvector (semantic similarity) and tsvector (PostgreSQL full-text search) for optimal relevance. Responses are streamed over SSE (Server-Sent Events) with precise citations pointing back to source passages. The multi-tenant architecture guarantees full data isolation between customers.

RAGpgvectorStreamingCitations

How it works

1

Create a knowledge base

Create an isolated knowledge space for your tenant and configure chunking and embedding settings.

2

Document ingestion

Upload your documents (PDF, DOCX, MD, TXT). They are automatically chunked, vectorized, and indexed.

3

Natural-language query

Ask your question. Hybrid search identifies the most relevant passages in your knowledge base.

4

Streamed answer with citations

The assistant generates an SSE-streamed answer, with each statement linked to a cited source passage.

API call example

query_knowledge_base.py
import httpx

KB_ID = class="text-teal">"kb_01HQ3V..."

class=class="text-teal">"text-text-faint italic"># Query with streaming
with httpx.stream(
    class="text-teal">"POST",
    fclass="text-teal">"https:class="text-text-faint italicclass="text-teal">">//api.djinn.dev/v1/knowledge-bases/{KB_ID}/query",
    headers={class="text-teal">"X-API-Key": class="text-teal">"djinn_live_..."},
    json={
        class="text-teal">"question": class="text-teal">"What is the notice period for a permanent contract?",
        class="text-teal">"max_sources": 5,
        class="text-teal">"stream": True,
    },
) as response:
    for line in response.iter_lines():
        if line.startswith(class="text-teal">"data: "):
            chunk = json.loads(line[6:])
            if chunk[class="text-teal">"type"] == class="text-teal">"text":
                print(chunk[class="text-teal">"content"], end=class="text-teal">"")
            elif chunk[class="text-teal">"type"] == class="text-teal">"citation":
                print(fclass="text-teal">" [{chunk['source']}]", end=class="text-teal">"")

Technical specifications

FormatsPDF, DOCX, MD, TXT
Max size100 MB
P95 latency< 2s (first token)
SLA99.9%

Ready to integrate this service?

Test the API free with 1,000 calls included. Integrate in minutes.