Skip to main content

insert()

Insert text content into the knowledge base. Vrin chunks the text, extracts facts (entities + relationships), and indexes everything for retrieval.
By default, insert() waits for processing to complete. Pass wait=False to get a job ID and poll later.

Parameters

string
required
Text content to insert into the knowledge base.
string
default:"Untitled"
Document title. Used in search results and source attribution.
List[str]
Optional tags for categorization and filtering.
Dict[str, Any]
Optional metadata dict attached to the document.
bool
default:"True"
If True, poll until processing completes and return the result dict. If False, return the job ID string immediately.
float
default:"2.0"
Seconds between status polls when wait=True.
float
default:"300.0"
Maximum seconds to wait when wait=True. Raises TimeoutError if exceeded.

Synchronous (default)

Asynchronous

get_job_status()

Check the status of an async insertion job.

Parameters

string
required
The job ID returned by insert(wait=False).

Returns

Job statuses progress through: pending -> chunking -> extracting -> storing -> completed.

wait_for_job()

Poll a job until completion or timeout. Logs progress as the job moves through stages.

Parameters

string
required
The job ID to wait on.
float
default:"2.0"
Seconds between status polls.
float
default:"300.0"
Maximum seconds to wait. Raises TimeoutError if exceeded.

Exceptions

  • JobFailedError — The job failed during processing.
  • TimeoutError — The job did not complete within max_wait seconds. Use get_job_status() to check current state.

get_knowledge_graph()

Get knowledge graph visualization data showing entities and their relationships.

Parameters

int
default:"100"
Maximum number of graph elements to return.

What happens during insertion

When you call insert(), Vrin:
  1. Chunks the text into overlapping segments optimized for retrieval
  2. Extracts facts — entities, relationships, and attributes using an LLM
  3. Stores facts in the knowledge graph (Neptune) with {model, timestamp, confidence} metadata
  4. Indexes chunks in the vector store (OpenSearch) with BM25 + kNN embeddings
  5. Returns a summary with fact counts and chunk IDs