Eridian

RAG Pipeline

Document upload, chunking, retrieval, and context injection.

The RAG pipeline handles document upload, chunking, vector indexing, retrieval, and context injection before model inference. Eridian manages the full lifecycle - your application sends a query; the orchestration layer retrieves relevant chunks and assembles context within token budgets automatically.

Document Upload

POST /v1/rag/documents
Authorization: Bearer eridian_sk_...
Content-Type: multipart/form-data
FieldTypeRequiredDescription
filebinaryYesPDF, DOCX, or plain text
project_idstringYesOwning project
collection_idstringNoLogical grouping for retrieval
chunking_strategystringNofixed_size, semantic, or legal_clause
metadataobjectNoCustom tags (matter_id, jurisdiction, etc.)

Upload PDF, DOCX, or plain text documents. Documents are chunked, embedded, and stored in an encrypted vector store scoped to your project. Processing status is available via GET /v1/rag/documents/{id}.

Processing States

StatusMeaning
processingChunking and embedding in progress
readyAvailable for retrieval
failedProcessing error; see error.message
archivedExcluded from retrieval; retained for audit

Chunking Strategies

StrategyBest ForDefault params
fixed_sizeGeneral-purpose documents512 tokens, 64 overlap
semanticLong-form content with natural section boundariesSection-aware splits
legal_clauseContract libraries with clause-level retrievalClause boundary detection

Legal workflows often pair legal_clause chunking with similarity_threshold: 0.78 because clause wording varies more than FAQ-style content.

Retrieval Configuration

{
  "rag_config": {
    "top_k": 5,
    "similarity_threshold": 0.75,
    "max_context_tokens": 4096,
    "rerank": true,
    "collection_ids": ["col_msa_templates"]
  }
}

Enable RAG on inference requests with "features": ["rag"]. Responses include:

  • eridian.rag_injected - whether context was added
  • eridian.rag_chunks - count of chunks injected
  • eridian.rag_document_ids - source documents referenced

Context Injection

Retrieved chunks are injected into the prompt context before inference using a stable template:

<context> [chunk 1 metadata + text] [chunk 2 metadata + text] </context> <user_query> ...

The observability dashboard shows which chunks were used for each request, supporting audit and debugging in regulated workflows. Cache keys include document version hashes so corpus updates invalidate stale cached answers.

Delete and Reindex

DELETE /v1/rag/documents/{id}
POST /v1/rag/collections/{id}/reindex

Deletion is soft by default with 30-day retention for compliance holds. Reindex rebuilds embeddings after chunking strategy changes.

Error Codes

HTTPCodeMeaning
413document_too_largeExceeds tier upload limit
422unsupported_formatFile type not accepted
404collection_not_foundUnknown collection ID

See Inference for RAG feature flags and Semantic Caching for cache interaction with RAG prompts.

Production API credentials are issued with an institution workspace. Contact sales if you need access.