Back to Docs

Packages

Three powerful packages that work together or standalone

@rana/helpers

10 one-line AI functions for common tasks

npm install @rana/helpers

API

summarize()Summarize text with customizable style
translate()Translate to any language
classify()Classify into categories
extract()Extract structured data
sentiment()Analyze sentiment
answer()Answer questions from context
rewrite()Rewrite in different styles
generate()Generate content
compare()Compare texts
moderate()Content moderation

Example

import { summarize, translate, classify } from '@rana/helpers';

const summary = await summarize(document, { style: 'brief' });
const spanish = await translate(text, { to: 'es' });
const category = await classify(email, ['spam', 'ham']);

@rana/prompts

Enterprise prompt management with versioning and A/B testing

npm install @rana/prompts

API

PromptManagerMain manager class
register()Register prompts with versioning
execute()Execute with tracking
createABTest()A/B test variants
getAnalytics()View prompt analytics
usePrompt()React hook for prompts

Example

import { PromptManager } from '@rana/prompts';

const pm = new PromptManager({ workspace: 'app' });

await pm.register('greeting', {
  template: 'Hello {{name}}!',
  variables: ['name'],
});

const result = await pm.execute('greeting', {
  variables: { name: 'John' },
});

@rana/rag

Advanced RAG with hybrid retrieval and re-ranking

npm install @rana/rag

API

RAGPresetsPre-configured pipelines
createRAGPipeline()Custom pipeline builder
SemanticChunkerSemantic text chunking
HybridRetrieverVector + keyword search
CrossEncoderRerankerRe-ranking results
useRAG()React hook for RAG

Example

import { RAGPresets } from '@rana/rag';

const pipeline = RAGPresets.balanced();

await pipeline.index([
  { id: 'doc1', content: '...' },
]);

const result = await pipeline.query({
  query: 'How does this work?',
});