{"_id":"@atisse/context-rag","_rev":"3-f7c73a5e5bd568600607fe50c2164ea9","name":"@atisse/context-rag","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@atisse/context-rag","version":"1.0.0","_id":"@atisse/context-rag@1.0.0","maintainers":[{"name":"softendo","email":"kadirkaradas5@gmail.com"}],"dist":{"shasum":"78ebe7dd5730b8fdf4b4cf8a70525631a56ebe41","tarball":"https://registry.npmjs.org/@atisse/context-rag/-/context-rag-1.0.0.tgz","fileCount":5,"integrity":"sha512-/tZ5Smd2d202tF35PA6iJj7YRpXb5C156+P2SKGDpYHiae5lMvPOD6NzTT8rNuj4gVf81hUA0vgSYIq4B5oQ+A==","signatures":[{"sig":"MEQCIETXfxmwj8tuZiC8jn6XszcTcB3tXbsMhd3UEbxmP6bOAiAW3qGYm8GFZBLpTRgyJK7gpg5/vAYpt2kb4XMrj+czcw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5364},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"766fc1f9364cd3ca6750ca4c1dc4110f5b613b73","scripts":{"lint":"eslint src/","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"softendo","email":"kadirkaradas5@gmail.com"},"_npmVersion":"11.17.0","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"packageManager":"pnpm@11.5.0","peerDependencies":{"@atisse/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/context-rag_1.0.0_1781528309397_0.7935257516488086","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@atisse/context-rag","version":"1.0.1","keywords":["llm","ai","rag","context","retrieval","adapter","typescript","orchestration"],"author":"Abdulkadir Karadas(saferias)","license":"MIT","_id":"@atisse/context-rag@1.0.1","maintainers":[{"name":"softendo","email":"kadirkaradas5@gmail.com"}],"homepage":"https://github.com/abdulkadirkaradas/atisse#readme","bugs":{"url":"https://github.com/abdulkadirkaradas/atisse/issues"},"dist":{"shasum":"83f4e9ab317fb6ee244203ede72278aa6468ed51","tarball":"https://registry.npmjs.org/@atisse/context-rag/-/context-rag-1.0.1.tgz","fileCount":7,"integrity":"sha512-s4+3UXp9lc8tw/3K3pYEFoKyu/avFmBDrsA5AObmZB0g6k3Kj/uXJhwutbe7vhLzn3JwJ5NAUw0ogBK/yf6bxQ==","signatures":[{"sig":"MEQCIEvZ/+tlY2qkdr7rf97luTO8LQG6ZevOd2H6RuJw/xC9AiAtISXKibObhDEYU80Tz72JG9MZV9n1++3jBofmqohGPQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11378},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"lint":"eslint src/","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"softendo","email":"kadirkaradas5@gmail.com"},"repository":{"url":"git+https://github.com/abdulkadirkaradas/atisse.git","type":"git","directory":"packages/context-rag"},"directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"peerDependencies":{"@atisse/core":"1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/context-rag_1.0.1_1781790652960_0.39146967258666643","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"_id":"@atisse/context-rag@1.0.2","bugs":{"url":"https://github.com/abdulkadirkaradas/atisse/issues"},"dist":{"shasum":"469f528291996df655d31bbdc0bae69022868ef0","tarball":"https://registry.npmjs.org/@atisse/context-rag/-/context-rag-1.0.2.tgz","fileCount":7,"integrity":"sha512-mOxgLr3m7ZINqWvf0DWLxtGG2vJlKESKjldGGPI2+AcFZcUxVFsXNSH34nWnw36iKX98nCLpiHbpSSImCat1Ng==","signatures":[{"sig":"MEQCIBRv/Gl76cGX453kBcPJ5MJhRPT0TVg70cxUjRLEG0BkAiAiodelemkjVVwCypIKtqS1jTHU1OUzYlI6iVfZKuLbww==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDaXLulTg231pHgkwf8wGyLwA89iJspuheiLyrTTqiwggIhAI9lkybKrJIxf54NqgxjI/aifT8SgosbLOfXwLlDBfz4"}],"unpackedSize":11378},"main":"./dist/index.js","name":"@atisse/context-rag","type":"module","types":"./dist/index.d.ts","author":"Abdulkadir Karadas(saferias)","module":"./dist/index.js","engines":{"node":">=24"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"license":"MIT","scripts":{"lint":"eslint src/","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","test:coverage":"vitest run --coverage"},"version":"1.0.2","_npmUser":{"name":"softendo","email":"kadirkaradas5@gmail.com"},"homepage":"https://github.com/abdulkadirkaradas/atisse#readme","keywords":["llm","ai","rag","context","retrieval","adapter","typescript","orchestration"],"repository":{"url":"git+https://github.com/abdulkadirkaradas/atisse.git","type":"git","directory":"packages/context-rag"},"directories":{},"maintainers":[{"name":"softendo","email":"kadirkaradas5@gmail.com"}],"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"peerDependencies":{"@atisse/core":"1.1.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/context-rag_1.0.2_1789407495813_0.5548901490532525"}}},"time":{"created":"2026-06-15T12:58:29.179Z","modified":"2026-09-14T17:38:16.152Z","1.0.0":"2026-06-15T12:58:29.505Z","1.0.1":"2026-06-18T13:50:53.090Z","1.0.2":"2026-09-14T17:38:15.911Z"},"bugs":{"url":"https://github.com/abdulkadirkaradas/atisse/issues"},"author":"Abdulkadir Karadas(saferias)","license":"MIT","homepage":"https://github.com/abdulkadirkaradas/atisse#readme","keywords":["llm","ai","rag","context","retrieval","adapter","typescript","orchestration"],"repository":{"url":"git+https://github.com/abdulkadirkaradas/atisse.git","type":"git","directory":"packages/context-rag"},"maintainers":[{"name":"softendo","email":"kadirkaradas5@gmail.com"}],"readme":"# @atisse/context-rag\n\n[![npm version](https://img.shields.io/npm/v/@atisse/context-rag.svg)](https://www.npmjs.com/package/@atisse/context-rag)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)\n\nA RAG (Retrieval-Augmented Generation) context provider for `@atisse/core`. Queries a vector store at pipeline startup and injects retrieved documents as system messages before the LLM generates a response.\n\n## Features\n\n- Plugs into the core context injection pipeline — documents are retrieved before generation begins\n- Works with any vector store implementation via the `VectorStore` interface\n- Configurable document count via `topK` parameter\n- Automatically prefixes system messages with retrieved document content\n- Integrates with the core retry policy for reliable vector store queries\n\n## Installation\n\n```bash\nnpm install @atisse/context-rag\n# or\npnpm add @atisse/context-rag\n```\n\n> `@atisse/core` is a peer dependency. Install it alongside this package.\n\n## Quick Start\n\n```typescript\nimport { Orchestrator } from '@atisse/core';\nimport { RAGContextProvider } from '@atisse/context-rag';\nimport type { VectorStore, VectorDocument } from '@atisse/context-rag';\n\n// Implement a VectorStore against your preferred vector database\nclass MyVectorStore implements VectorStore {\n  readonly id = 'my-store';\n\n  async search(query: string, topK?: number): Promise<VectorDocument[]> {\n    // Replace with actual vector search — this is a stub\n    return [\n      {\n        content: 'Paris is the capital of France, located on the River Seine.',\n        metadata: { source: 'geography-db' },\n      },\n    ];\n  }\n}\n\nconst vectorStore = new MyVectorStore();\nconst ragProvider = new RAGContextProvider({\n  vectorStore,\n  topK: 3,\n});\n\nconst orchestrator = new Orchestrator({\n  provider: myProvider,\n  contextProviders: [ragProvider],\n  systemPrompt: 'Answer based on the retrieved context.',\n});\n\nconst result = await orchestrator.run({\n  prompt: 'What is the capital of France?',\n});\n```\n\n## API Reference\n\n`@atisse/context-rag` package exports the following types and classes:\n\n<details>\n<summary>Click to expand</summary>\n\n### `RAGContextProvider`\n\nImplements `ContextProvider` from `@atisse/core`. Queries the vector store during the context injection phase and converts results into `SystemMessage[]` entries.\n\n**Constructor**\n\n```typescript\nnew RAGContextProvider(config: RAGContextProviderConfig)\n```\n\n**`RAGContextProviderConfig` fields**\n\n| Field         | Type          | Default                | Description                             |\n| ------------- | ------------- | ---------------------- | --------------------------------------- |\n| `vectorStore` | `VectorStore` | —                      | Vector store implementation (required)  |\n| `topK`        | `number`      | `5`                    | Maximum number of documents to retrieve |\n| `id`          | `string`      | `rag-{vectorStore.id}` | Unique provider identifier              |\n\n**Method: `provide`**\n\n```typescript\nprovide(input: ContextProviderInput): Promise<SystemMessage[]>\n```\n\nCalled by the core pipeline during the `CONTEXT_INJECTING` phase. Returns an array of system messages with retrieved document content. Returns an empty array if no documents match.\n\n### `VectorStore` interface\n\n```typescript\ninterface VectorStore {\n  readonly id: string;\n  search(query: string, topK?: number): Promise<VectorDocument[]>;\n}\n```\n\n### `VectorDocument` interface\n\n```typescript\ninterface VectorDocument {\n  content: string;\n  metadata?: Record<string, unknown>;\n}\n```\n\n</details>\n\n### Error handling\n\nThe provider wraps vector store errors using `ContextLoadError` from `@atisse/core`. If the store returns non-array results or documents missing the `content` field, a `ContextProviderError` is thrown. Both error types are retryable by the core pipeline.\n\n## Monorepo Ecosystem\n\n`@atisse/*` packages are part of the [atisse](https://github.com/abdulkadirkaradas/atisse) monorepo.\n\n- **[@atisse/core](../core)** — Execution kernel (required peer dependency)\n- **[@atisse/memory-inmemory](../memory-inmemory)** — In-memory memory adapter\n- **[@atisse/memory-redis](../memory-redis)** — Redis memory adapter\n- **[@atisse/provider-anthropic](../provider-anthropic)** — Anthropic Claude provider\n- **[@atisse/provider-openai](../provider-openai)** — OpenAI GPT provider\n\n## License\n\nMIT © [Abdulkadir Karadas(saferias)](https://github.com/abdulkadirkaradas)\n","readmeFilename":""}