Skip to main content

NLP & RAG

PrismIntelligence includes NLP utilities built on Apple’s NaturalLanguage framework and a complete RAG (Retrieval-Augmented Generation) pipeline using in-memory vector search.

Sentiment Analysis

Analyze the sentiment of any text:
Sentiment Analysis
Sentiment returns one of four values:

Named Entity Extraction

Extract people, places, organizations, and dates from text:
Entity Extraction
Each PrismNLPEntity includes:

Embedding Store

PrismEmbeddingStore is an actor-isolated vector store for similarity search:
Embedding Store
The embedding store uses cosine similarity for ranking. Vectors don’t need to be normalized — the similarity calculation handles it internally.

Text Chunker

Split long documents into overlapping chunks for embedding ingestion:
Text Chunking

RAG Pipeline

PrismRAGPipeline combines chunking, embedding storage, and retrieval into a single workflow:
RAG Configuration

Configuration

RAG Response

Query results include the answer, source chunks, and a confidence score:
RAG Response

Structured Output

PrismStructuredParser extracts structured data from raw LLM text output:
Parse JSON from Text

Extract JSON

Pull the first JSON object or array from mixed text:
Extract JSON

Extract Key-Value Pairs

Parse key: value lines into a dictionary:
Key-Value Extraction

Complete Example

Document Q&A with RAG