Back to Docs
API Reference
Complete API documentation for all RANA packages
@rana/helpers
summarize
summarize(text: string, options?: SummarizeOptions): Promise<string>
Summarize text with customizable output style
Options
| Name | Type | Default |
|---|---|---|
| style | 'brief' | 'detailed' | 'bullet' | 'brief' |
| maxLength | number | undefined |
| model | string | 'claude-sonnet-4' |
translate
translate(text: string, options: TranslateOptions): Promise<string>
Translate text to any language
Options
| Name | Type | Default |
|---|---|---|
| to | string | required |
| from | string | 'auto' |
| preserveFormatting | boolean | true |
classify
classify(text: string, categories: string[], options?: ClassifyOptions): Promise<string>
Classify text into predefined categories
Options
| Name | Type | Default |
|---|---|---|
| multiLabel | boolean | false |
| confidence | boolean | false |
extract
extract<T>(text: string, schema: T, options?: ExtractOptions): Promise<T>
Extract structured data from unstructured text
Options
| Name | Type | Default |
|---|---|---|
| strict | boolean | true |
| examples | array | [] |
@rana/prompts
PromptManager
new PromptManager(config: PromptManagerConfig)
Main class for managing prompts with versioning and analytics
Options
| Name | Type | Default |
|---|---|---|
| workspace | string | required |
| storage | 'memory' | 'redis' | 'postgres' | 'memory' |
| analytics | boolean | true |
pm.register
register(id: string, config: PromptConfig): Promise<void>
Register a new prompt with template and variables
Options
| Name | Type | Default |
|---|---|---|
| template | string | required |
| variables | string[] | [] |
| model | string | 'claude-sonnet-4' |
pm.execute
execute(id: string, options: ExecuteOptions): Promise<ExecutionResult>
Execute a registered prompt with tracking
Options
| Name | Type | Default |
|---|---|---|
| variables | Record<string, string> | {} |
| userId | string | undefined |
@rana/rag
RAGPresets
RAGPresets.balanced() | .fast() | .accurate() | .code()
Pre-configured RAG pipelines for common use cases
Options
| Name | Type | Default |
|---|---|---|
| balanced() | RAGPipeline | Good speed/quality tradeoff |
| fast() | RAGPipeline | Optimized for speed |
| accurate() | RAGPipeline | Optimized for quality |
| code(lang) | RAGPipeline | For code search |
createRAGPipeline
createRAGPipeline(config: RAGPipelineConfig): RAGPipeline
Create a custom RAG pipeline with full configuration
Options
| Name | Type | Default |
|---|---|---|
| chunker | ChunkerConfig | { type: 'semantic' } |
| retriever | RetrieverConfig | { type: 'hybrid' } |
| reranker | RerankerConfig | undefined |
| synthesizer | SynthesizerConfig | { type: 'refine' } |
pipeline.query
query(options: QueryOptions): Promise<RAGResult>
Query the pipeline and get an answer with citations
Options
| Name | Type | Default |
|---|---|---|
| query | string | required |
| topK | number | 5 |
| filters | object | {} |