@exulu/backend 1.48.2 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +351 -42
- package/dist/index.d.cts +96 -1
- package/dist/index.d.ts +96 -1
- package/dist/index.js +340 -38
- package/ee/{markdown.ts → chunking/markdown.ts} +2 -2
- package/ee/python/README.md +295 -0
- package/ee/python/documents/processing/README.md +155 -0
- package/ee/{documents → python/documents}/processing/doc_processor.ts +25 -17
- package/ee/{documents/processing/pdf_to_markdown.py → python/documents/processing/document_to_markdown.py} +3 -10
- package/ee/python/setup.sh +180 -0
- package/package.json +14 -3
- package/scripts/postinstall.cjs +149 -0
- package/.agents/skills/mintlify/SKILL.md +0 -347
- package/.editorconfig +0 -15
- package/.eslintrc.json +0 -52
- package/.github/workflows/release-backend.yml +0 -38
- package/.husky/commit-msg +0 -1
- package/.jscpd.json +0 -18
- package/.mcp.json +0 -25
- package/.nvmrc +0 -1
- package/.prettierignore +0 -5
- package/.prettierrc.json +0 -12
- package/CHANGELOG.md +0 -8
- package/SECURITY.md +0 -5
- package/commitlint.config.js +0 -4
- package/devops/documentation/patch-older-releases.md +0 -42
- package/ee/documents/processing/build_pdf_processor.sh +0 -35
- package/ee/documents/processing/chunk_markdown.py +0 -263
- package/ee/documents/processing/pdf_processor.spec +0 -115
- package/eslint.config.js +0 -88
- package/jest.config.ts +0 -25
- package/mintlify-docs/.mintignore +0 -7
- package/mintlify-docs/AGENTS.md +0 -33
- package/mintlify-docs/CLAUDE.MD +0 -50
- package/mintlify-docs/CONTRIBUTING.md +0 -32
- package/mintlify-docs/LICENSE +0 -21
- package/mintlify-docs/README.md +0 -55
- package/mintlify-docs/ai-tools/claude-code.mdx +0 -43
- package/mintlify-docs/ai-tools/cursor.mdx +0 -39
- package/mintlify-docs/ai-tools/windsurf.mdx +0 -39
- package/mintlify-docs/api-reference/core-types/agent-types.mdx +0 -110
- package/mintlify-docs/api-reference/core-types/analytics-types.mdx +0 -95
- package/mintlify-docs/api-reference/core-types/configuration-types.mdx +0 -83
- package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +0 -106
- package/mintlify-docs/api-reference/core-types/job-types.mdx +0 -135
- package/mintlify-docs/api-reference/core-types/overview.mdx +0 -73
- package/mintlify-docs/api-reference/core-types/prompt-types.mdx +0 -102
- package/mintlify-docs/api-reference/core-types/rbac-types.mdx +0 -163
- package/mintlify-docs/api-reference/core-types/session-types.mdx +0 -77
- package/mintlify-docs/api-reference/core-types/user-management.mdx +0 -112
- package/mintlify-docs/api-reference/core-types/workflow-types.mdx +0 -88
- package/mintlify-docs/api-reference/core-types.mdx +0 -585
- package/mintlify-docs/api-reference/dynamic-types.mdx +0 -851
- package/mintlify-docs/api-reference/endpoint/create.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/delete.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/get.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/webhook.mdx +0 -4
- package/mintlify-docs/api-reference/introduction.mdx +0 -661
- package/mintlify-docs/api-reference/mutations.mdx +0 -1012
- package/mintlify-docs/api-reference/openapi.json +0 -217
- package/mintlify-docs/api-reference/queries.mdx +0 -1154
- package/mintlify-docs/backend/introduction.mdx +0 -218
- package/mintlify-docs/changelog.mdx +0 -387
- package/mintlify-docs/community-edition.mdx +0 -304
- package/mintlify-docs/core/exulu-agent/api-reference.mdx +0 -894
- package/mintlify-docs/core/exulu-agent/configuration.mdx +0 -690
- package/mintlify-docs/core/exulu-agent/introduction.mdx +0 -552
- package/mintlify-docs/core/exulu-app/api-reference.mdx +0 -481
- package/mintlify-docs/core/exulu-app/configuration.mdx +0 -319
- package/mintlify-docs/core/exulu-app/introduction.mdx +0 -117
- package/mintlify-docs/core/exulu-authentication.mdx +0 -810
- package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +0 -1011
- package/mintlify-docs/core/exulu-chunkers/configuration.mdx +0 -596
- package/mintlify-docs/core/exulu-chunkers/introduction.mdx +0 -403
- package/mintlify-docs/core/exulu-context/api-reference.mdx +0 -911
- package/mintlify-docs/core/exulu-context/configuration.mdx +0 -648
- package/mintlify-docs/core/exulu-context/introduction.mdx +0 -394
- package/mintlify-docs/core/exulu-database.mdx +0 -811
- package/mintlify-docs/core/exulu-default-agents.mdx +0 -545
- package/mintlify-docs/core/exulu-eval/api-reference.mdx +0 -772
- package/mintlify-docs/core/exulu-eval/configuration.mdx +0 -680
- package/mintlify-docs/core/exulu-eval/introduction.mdx +0 -459
- package/mintlify-docs/core/exulu-logging.mdx +0 -464
- package/mintlify-docs/core/exulu-otel.mdx +0 -670
- package/mintlify-docs/core/exulu-queues/api-reference.mdx +0 -648
- package/mintlify-docs/core/exulu-queues/configuration.mdx +0 -650
- package/mintlify-docs/core/exulu-queues/introduction.mdx +0 -474
- package/mintlify-docs/core/exulu-reranker/api-reference.mdx +0 -630
- package/mintlify-docs/core/exulu-reranker/configuration.mdx +0 -663
- package/mintlify-docs/core/exulu-reranker/introduction.mdx +0 -516
- package/mintlify-docs/core/exulu-tool/api-reference.mdx +0 -723
- package/mintlify-docs/core/exulu-tool/configuration.mdx +0 -805
- package/mintlify-docs/core/exulu-tool/introduction.mdx +0 -539
- package/mintlify-docs/core/exulu-variables/api-reference.mdx +0 -699
- package/mintlify-docs/core/exulu-variables/configuration.mdx +0 -736
- package/mintlify-docs/core/exulu-variables/introduction.mdx +0 -511
- package/mintlify-docs/development.mdx +0 -94
- package/mintlify-docs/docs.json +0 -248
- package/mintlify-docs/enterprise-edition.mdx +0 -538
- package/mintlify-docs/essentials/code.mdx +0 -35
- package/mintlify-docs/essentials/images.mdx +0 -59
- package/mintlify-docs/essentials/markdown.mdx +0 -88
- package/mintlify-docs/essentials/navigation.mdx +0 -87
- package/mintlify-docs/essentials/reusable-snippets.mdx +0 -110
- package/mintlify-docs/essentials/settings.mdx +0 -318
- package/mintlify-docs/favicon.svg +0 -3
- package/mintlify-docs/frontend/introduction.mdx +0 -39
- package/mintlify-docs/getting-started.mdx +0 -267
- package/mintlify-docs/guides/custom-agent.mdx +0 -608
- package/mintlify-docs/guides/first-agent.mdx +0 -315
- package/mintlify-docs/images/admin_ui.png +0 -0
- package/mintlify-docs/images/contexts.png +0 -0
- package/mintlify-docs/images/create_agents.png +0 -0
- package/mintlify-docs/images/evals.png +0 -0
- package/mintlify-docs/images/graphql.png +0 -0
- package/mintlify-docs/images/graphql_api.png +0 -0
- package/mintlify-docs/images/hero-dark.png +0 -0
- package/mintlify-docs/images/hero-light.png +0 -0
- package/mintlify-docs/images/hero.png +0 -0
- package/mintlify-docs/images/knowledge_sources.png +0 -0
- package/mintlify-docs/images/mcp.png +0 -0
- package/mintlify-docs/images/scaling.png +0 -0
- package/mintlify-docs/index.mdx +0 -411
- package/mintlify-docs/logo/dark.svg +0 -9
- package/mintlify-docs/logo/light.svg +0 -9
- package/mintlify-docs/partners.mdx +0 -558
- package/mintlify-docs/products.mdx +0 -77
- package/mintlify-docs/snippets/snippet-intro.mdx +0 -4
- package/mintlify-docs/styles.css +0 -207
- package/ngrok.bash +0 -1
- package/ngrok.md +0 -6
- package/ngrok.yml +0 -10
- package/release.config.cjs +0 -15
- package/skills-lock.json +0 -10
- package/types/context-processor.ts +0 -45
- package/types/enums/eval-types.ts +0 -5
- package/types/enums/field-types.ts +0 -1
- package/types/enums/jobs.ts +0 -11
- package/types/enums/statistics.ts +0 -13
- package/types/exulu-table-definition.ts +0 -79
- package/types/file-types.ts +0 -18
- package/types/models/agent-session.ts +0 -27
- package/types/models/agent.ts +0 -68
- package/types/models/context.ts +0 -53
- package/types/models/embedding.ts +0 -17
- package/types/models/eval-run.ts +0 -40
- package/types/models/exulu-agent-tool-config.ts +0 -11
- package/types/models/item.ts +0 -21
- package/types/models/job.ts +0 -8
- package/types/models/project.ts +0 -16
- package/types/models/rate-limiter-rules.ts +0 -7
- package/types/models/test-case.ts +0 -25
- package/types/models/tool.ts +0 -9
- package/types/models/user-role.ts +0 -12
- package/types/models/user.ts +0 -20
- package/types/models/variable.ts +0 -8
- package/types/models/vector-methods.ts +0 -7
- package/types/provider-config.ts +0 -21
- package/types/queue-config.ts +0 -16
- package/types/rbac-rights-modes.ts +0 -1
- package/types/statistics.ts +0 -20
- package/types/workflow.ts +0 -31
- /package/ee/{documents → python/documents}/THIRD_PARTY_LICENSES/docling.txt +0 -0
- /package/ee/{documents/processing → python}/requirements.txt +0 -0
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Overview"
|
|
3
|
-
description: "Semantic search contexts with vector embeddings for retrieval-augmented generation"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
`ExuluContext` represents a semantic search index that powers retrieval-augmented generation (RAG) in Exulu IMP. Each context maintains a collection of items with vector embeddings, enabling agents to query relevant information using natural language, keywords, or hybrid search.
|
|
9
|
-
|
|
10
|
-
## Key features
|
|
11
|
-
|
|
12
|
-
<CardGroup cols={2}>
|
|
13
|
-
<Card title="Vector search" icon="magnifying-glass">
|
|
14
|
-
Semantic search with pgvector for similarity-based retrieval
|
|
15
|
-
</Card>
|
|
16
|
-
<Card title="Hybrid search" icon="arrows-split-up-and-left">
|
|
17
|
-
Combines vector similarity with full-text keyword search
|
|
18
|
-
</Card>
|
|
19
|
-
<Card title="Data sources" icon="database">
|
|
20
|
-
Scheduled data ingestion from external systems
|
|
21
|
-
</Card>
|
|
22
|
-
<Card title="Processors" icon="gear">
|
|
23
|
-
Transform items before storage and embeddings generation
|
|
24
|
-
</Card>
|
|
25
|
-
<Card title="Auto tool generation" icon="wrench">
|
|
26
|
-
Automatically exposed as a tool for agents to use
|
|
27
|
-
</Card>
|
|
28
|
-
<Card title="Chunk expansion" icon="expand">
|
|
29
|
-
Retrieve surrounding context chunks for better results
|
|
30
|
-
</Card>
|
|
31
|
-
</CardGroup>
|
|
32
|
-
|
|
33
|
-
## What is a context?
|
|
34
|
-
|
|
35
|
-
A context is a semantic search index that:
|
|
36
|
-
|
|
37
|
-
1. **Stores structured data** with custom fields (text, numbers, files, JSON, etc.)
|
|
38
|
-
2. **Generates embeddings** using a configured embedder (OpenAI, Anthropic, etc.)
|
|
39
|
-
3. **Enables semantic search** through vector similarity and full-text search
|
|
40
|
-
4. **Automatically becomes a tool** that agents can call to retrieve information
|
|
41
|
-
5. **Manages data sources** that periodically sync external data
|
|
42
|
-
|
|
43
|
-
Think of a context as a specialized database table optimized for AI retrieval with semantic understanding.
|
|
44
|
-
|
|
45
|
-
## Quick start
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { ExuluContext, ExuluEmbedder } from "@exulu/backend";
|
|
49
|
-
|
|
50
|
-
// Create an embedder
|
|
51
|
-
const embedder = new ExuluEmbedder({
|
|
52
|
-
id: "openai_embedder",
|
|
53
|
-
name: "OpenAI Embeddings",
|
|
54
|
-
provider: "openai",
|
|
55
|
-
model: "text-embedding-3-small",
|
|
56
|
-
vectorDimensions: 1536
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Create a context
|
|
60
|
-
const docsContext = new ExuluContext({
|
|
61
|
-
id: "documentation",
|
|
62
|
-
name: "Documentation",
|
|
63
|
-
description: "Product documentation and help articles",
|
|
64
|
-
active: true,
|
|
65
|
-
embedder: embedder,
|
|
66
|
-
fields: [
|
|
67
|
-
{
|
|
68
|
-
name: "title",
|
|
69
|
-
type: "text",
|
|
70
|
-
required: true
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "content",
|
|
74
|
-
type: "text",
|
|
75
|
-
required: true
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "url",
|
|
79
|
-
type: "text"
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
sources: [],
|
|
83
|
-
configuration: {
|
|
84
|
-
calculateVectors: "onInsert",
|
|
85
|
-
enableAsTool: true,
|
|
86
|
-
maxRetrievalResults: 10
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Use in ExuluApp
|
|
91
|
-
const app = new ExuluApp();
|
|
92
|
-
await app.create({
|
|
93
|
-
contexts: {
|
|
94
|
-
documentation: docsContext
|
|
95
|
-
},
|
|
96
|
-
config: { /* ... */ }
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Architecture
|
|
101
|
-
|
|
102
|
-
### Database structure
|
|
103
|
-
|
|
104
|
-
Each context creates two PostgreSQL tables:
|
|
105
|
-
|
|
106
|
-
<AccordionGroup>
|
|
107
|
-
<Accordion title="Items table">
|
|
108
|
-
Stores the actual data items with your custom fields plus built-in fields:
|
|
109
|
-
- `id` - UUID primary key
|
|
110
|
-
- `name` - Item name
|
|
111
|
-
- `description` - Item description
|
|
112
|
-
- `external_id` - Optional external identifier for syncing
|
|
113
|
-
- `tags` - Comma-separated tags
|
|
114
|
-
- `created_by` - User who created the item
|
|
115
|
-
- `rights_mode` - Access control mode (private, public, restricted)
|
|
116
|
-
- `embeddings_updated_at` - Last embeddings generation timestamp
|
|
117
|
-
- `chunks_count` - Number of embedding chunks
|
|
118
|
-
- Your custom fields
|
|
119
|
-
</Accordion>
|
|
120
|
-
|
|
121
|
-
<Accordion title="Chunks table">
|
|
122
|
-
Stores embedding chunks generated from items:
|
|
123
|
-
- `id` - UUID primary key
|
|
124
|
-
- `source` - Foreign key to items table
|
|
125
|
-
- `content` - Text content of the chunk
|
|
126
|
-
- `chunk_index` - Position within the document
|
|
127
|
-
- `metadata` - JSON metadata
|
|
128
|
-
- `embedding` - Vector embedding (pgvector)
|
|
129
|
-
- `fts` - Full-text search index (tsvector)
|
|
130
|
-
</Accordion>
|
|
131
|
-
</AccordionGroup>
|
|
132
|
-
|
|
133
|
-
### Search methods
|
|
134
|
-
|
|
135
|
-
<Tabs>
|
|
136
|
-
<Tab title="Hybrid search">
|
|
137
|
-
Combines semantic understanding with keyword matching. Best for most queries.
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
const results = await context.search({
|
|
141
|
-
query: "How do I configure authentication?",
|
|
142
|
-
keywords: ["auth", "config"],
|
|
143
|
-
method: "hybridSearch",
|
|
144
|
-
limit: 10
|
|
145
|
-
});
|
|
146
|
-
```
|
|
147
|
-
</Tab>
|
|
148
|
-
|
|
149
|
-
<Tab title="Semantic search">
|
|
150
|
-
Uses vector similarity for conceptual matching. Best for questions with synonyms and paraphrasing.
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
const results = await context.search({
|
|
154
|
-
query: "authentication setup process",
|
|
155
|
-
method: "cosineDistance",
|
|
156
|
-
limit: 10
|
|
157
|
-
});
|
|
158
|
-
```
|
|
159
|
-
</Tab>
|
|
160
|
-
|
|
161
|
-
<Tab title="Keyword search">
|
|
162
|
-
Full-text search for exact term matching. Best for technical names, IDs, or specific phrases.
|
|
163
|
-
|
|
164
|
-
```typescript
|
|
165
|
-
const results = await context.search({
|
|
166
|
-
keywords: ["API-KEY-123", "production"],
|
|
167
|
-
method: "tsvector",
|
|
168
|
-
limit: 10
|
|
169
|
-
});
|
|
170
|
-
```
|
|
171
|
-
</Tab>
|
|
172
|
-
</Tabs>
|
|
173
|
-
|
|
174
|
-
## Core concepts
|
|
175
|
-
|
|
176
|
-
### Fields
|
|
177
|
-
|
|
178
|
-
Define the structure of your items with typed fields:
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
fields: [
|
|
182
|
-
{ name: "title", type: "text", required: true },
|
|
183
|
-
{ name: "category", type: "text", index: true },
|
|
184
|
-
{ name: "priority", type: "number", default: 0 },
|
|
185
|
-
{ name: "metadata", type: "json" },
|
|
186
|
-
{ name: "document", type: "file", allowedFileTypes: ["pdf", "docx"] },
|
|
187
|
-
{ name: "status", type: "text", enumValues: ["draft", "published"] }
|
|
188
|
-
]
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
<Note>
|
|
192
|
-
Field types include: text, number, boolean, date, json, file, and more. See the [configuration guide](/core/exulu-context/configuration) for all available types.
|
|
193
|
-
</Note>
|
|
194
|
-
|
|
195
|
-
### Embedder
|
|
196
|
-
|
|
197
|
-
The embedder generates vector representations of your items:
|
|
198
|
-
|
|
199
|
-
```typescript
|
|
200
|
-
embedder: new ExuluEmbedder({
|
|
201
|
-
id: "my_embedder",
|
|
202
|
-
name: "OpenAI Embeddings",
|
|
203
|
-
provider: "openai",
|
|
204
|
-
model: "text-embedding-3-small",
|
|
205
|
-
vectorDimensions: 1536,
|
|
206
|
-
template: "Title: {{title}}\n\nContent: {{content}}"
|
|
207
|
-
})
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
The embedder uses a template to format item data before generating embeddings.
|
|
211
|
-
|
|
212
|
-
### Sources
|
|
213
|
-
|
|
214
|
-
Data sources automatically sync external data into your context:
|
|
215
|
-
|
|
216
|
-
```typescript
|
|
217
|
-
sources: [
|
|
218
|
-
{
|
|
219
|
-
id: "notion_sync",
|
|
220
|
-
name: "Notion Documentation",
|
|
221
|
-
description: "Syncs docs from Notion",
|
|
222
|
-
config: {
|
|
223
|
-
schedule: "0 * * * *", // Every hour
|
|
224
|
-
queue: myQueue,
|
|
225
|
-
retries: 3
|
|
226
|
-
},
|
|
227
|
-
execute: async ({ exuluConfig }) => {
|
|
228
|
-
// Fetch data from Notion API
|
|
229
|
-
const pages = await fetchNotionPages();
|
|
230
|
-
return pages.map(page => ({
|
|
231
|
-
external_id: page.id,
|
|
232
|
-
name: page.title,
|
|
233
|
-
content: page.content
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
]
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### Processor
|
|
241
|
-
|
|
242
|
-
Processors transform items before storage or embeddings generation:
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
processor: {
|
|
246
|
-
name: "Extract text from PDF",
|
|
247
|
-
config: {
|
|
248
|
-
trigger: "onInsert",
|
|
249
|
-
generateEmbeddings: true
|
|
250
|
-
},
|
|
251
|
-
execute: async ({ item, utils }) => {
|
|
252
|
-
// Extract text from PDF file
|
|
253
|
-
const text = await utils.storage.extractText(item.document_s3key);
|
|
254
|
-
return {
|
|
255
|
-
...item,
|
|
256
|
-
content: text
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Usage patterns
|
|
263
|
-
|
|
264
|
-
### As an agent tool
|
|
265
|
-
|
|
266
|
-
When `enableAsTool: true`, contexts automatically become tools that agents can call:
|
|
267
|
-
|
|
268
|
-
```typescript
|
|
269
|
-
// Agent receives this tool automatically
|
|
270
|
-
{
|
|
271
|
-
name: "documentation_context_search",
|
|
272
|
-
description: "Gets information from the context called: Documentation...",
|
|
273
|
-
inputSchema: {
|
|
274
|
-
query: "The user's question",
|
|
275
|
-
keywords: ["relevant", "terms"],
|
|
276
|
-
method: "hybrid" | "semantic" | "keyword"
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
Agents will intelligently choose when to query your context based on the user's question.
|
|
282
|
-
|
|
283
|
-
### Direct querying
|
|
284
|
-
|
|
285
|
-
You can also query contexts directly in your code:
|
|
286
|
-
|
|
287
|
-
```typescript
|
|
288
|
-
const context = app.context("documentation");
|
|
289
|
-
const results = await context.search({
|
|
290
|
-
query: "How do I configure CORS?",
|
|
291
|
-
keywords: ["CORS", "config"],
|
|
292
|
-
method: "hybridSearch",
|
|
293
|
-
itemFilters: [
|
|
294
|
-
{ field: "category", operator: "=", value: "configuration" }
|
|
295
|
-
],
|
|
296
|
-
limit: 5
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
console.log(results.chunks); // Array of matching chunks with metadata
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### Managing items
|
|
303
|
-
|
|
304
|
-
Create, update, and delete items programmatically:
|
|
305
|
-
|
|
306
|
-
```typescript
|
|
307
|
-
// Create an item
|
|
308
|
-
const { item, job } = await context.createItem(
|
|
309
|
-
{
|
|
310
|
-
external_id: "doc-123",
|
|
311
|
-
name: "Getting Started",
|
|
312
|
-
content: "Welcome to our platform..."
|
|
313
|
-
},
|
|
314
|
-
config,
|
|
315
|
-
userId
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
// Update an item
|
|
319
|
-
await context.updateItem(
|
|
320
|
-
{
|
|
321
|
-
id: item.id,
|
|
322
|
-
content: "Updated content..."
|
|
323
|
-
},
|
|
324
|
-
config,
|
|
325
|
-
userId
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
// Delete an item
|
|
329
|
-
await context.deleteItem({ id: item.id });
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
## Search features
|
|
333
|
-
|
|
334
|
-
### Chunk expansion
|
|
335
|
-
|
|
336
|
-
Retrieve surrounding chunks for more context:
|
|
337
|
-
|
|
338
|
-
```typescript
|
|
339
|
-
configuration: {
|
|
340
|
-
expand: {
|
|
341
|
-
before: 1, // Include 1 chunk before match
|
|
342
|
-
after: 2 // Include 2 chunks after match
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### Search cutoffs
|
|
348
|
-
|
|
349
|
-
Filter results by relevance score:
|
|
350
|
-
|
|
351
|
-
```typescript
|
|
352
|
-
configuration: {
|
|
353
|
-
cutoffs: {
|
|
354
|
-
cosineDistance: 0.7, // Only results with >0.7 similarity
|
|
355
|
-
tsvector: 0.5, // Only results with >0.5 keyword score
|
|
356
|
-
hybrid: 0.6 // Only results with >0.6 combined score
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Query rewriting
|
|
362
|
-
|
|
363
|
-
Improve search quality with query rewriting:
|
|
364
|
-
|
|
365
|
-
```typescript
|
|
366
|
-
queryRewriter: async (query: string) => {
|
|
367
|
-
// Call LLM to expand/clarify the query
|
|
368
|
-
const rewritten = await llm.rewrite(query);
|
|
369
|
-
return rewritten;
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Result reranking
|
|
374
|
-
|
|
375
|
-
Reorder results based on custom logic:
|
|
376
|
-
|
|
377
|
-
```typescript
|
|
378
|
-
resultReranker: async (results) => {
|
|
379
|
-
// Use a reranker model or custom logic
|
|
380
|
-
const reranked = await reranker.rerank(results);
|
|
381
|
-
return reranked;
|
|
382
|
-
}
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
## Next steps
|
|
386
|
-
|
|
387
|
-
<CardGroup cols={2}>
|
|
388
|
-
<Card title="Configuration" icon="gear" href="/core/exulu-context/configuration">
|
|
389
|
-
Learn about all configuration options
|
|
390
|
-
</Card>
|
|
391
|
-
<Card title="API reference" icon="code" href="/core/exulu-context/api-reference">
|
|
392
|
-
Explore methods and properties
|
|
393
|
-
</Card>
|
|
394
|
-
</CardGroup>
|