@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,648 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Configuration"
|
|
3
|
-
description: "Complete guide to configuring ExuluContext for semantic search"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Constructor parameters
|
|
7
|
-
|
|
8
|
-
The ExuluContext constructor accepts a configuration object with the following parameters:
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
const context = new ExuluContext({
|
|
12
|
-
id: string,
|
|
13
|
-
name: string,
|
|
14
|
-
description: string,
|
|
15
|
-
active: boolean,
|
|
16
|
-
fields: ExuluContextFieldDefinition[],
|
|
17
|
-
embedder?: ExuluEmbedder,
|
|
18
|
-
processor?: ExuluContextProcessor,
|
|
19
|
-
sources: ExuluContextSource[],
|
|
20
|
-
rateLimit?: RateLimiterRule,
|
|
21
|
-
queryRewriter?: (query: string) => Promise<string>,
|
|
22
|
-
resultReranker?: (results: any[]) => Promise<any[]>,
|
|
23
|
-
configuration?: { /* ... */ }
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Required parameters
|
|
28
|
-
|
|
29
|
-
### id
|
|
30
|
-
|
|
31
|
-
<ParamField path="id" type="string" required>
|
|
32
|
-
Unique identifier for the context. Must be a valid PostgreSQL identifier: start with a letter or underscore, contain only letters, digits, or underscores, 5-80 characters long.
|
|
33
|
-
</ParamField>
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
id: "product_docs"
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
<Warning>
|
|
40
|
-
The ID is used for database table names and should not change after creation. Changing the ID requires database migration.
|
|
41
|
-
</Warning>
|
|
42
|
-
|
|
43
|
-
### name
|
|
44
|
-
|
|
45
|
-
<ParamField path="name" type="string" required>
|
|
46
|
-
Human-readable name displayed in UI and logs
|
|
47
|
-
</ParamField>
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
name: "Product Documentation"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### description
|
|
54
|
-
|
|
55
|
-
<ParamField path="description" type="string" required>
|
|
56
|
-
Description of what information this context contains. Used in the auto-generated tool description for agents.
|
|
57
|
-
</ParamField>
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
description: "Product documentation, help articles, and tutorials for end users"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### active
|
|
64
|
-
|
|
65
|
-
<ParamField path="active" type="boolean" required>
|
|
66
|
-
Whether this context is active and available for use
|
|
67
|
-
</ParamField>
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
active: true
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### fields
|
|
74
|
-
|
|
75
|
-
<ParamField path="fields" type="ExuluContextFieldDefinition[]" required>
|
|
76
|
-
Array of field definitions that define the schema for items in this context
|
|
77
|
-
</ParamField>
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
fields: [
|
|
81
|
-
{
|
|
82
|
-
name: "title",
|
|
83
|
-
type: "text",
|
|
84
|
-
required: true,
|
|
85
|
-
editable: true
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "content",
|
|
89
|
-
type: "text",
|
|
90
|
-
required: true
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "category",
|
|
94
|
-
type: "text",
|
|
95
|
-
index: true,
|
|
96
|
-
enumValues: ["guide", "reference", "tutorial"]
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
#### Field definition properties
|
|
102
|
-
|
|
103
|
-
<ParamField path="fields[].name" type="string" required>
|
|
104
|
-
Field name (must be valid PostgreSQL column name)
|
|
105
|
-
</ParamField>
|
|
106
|
-
|
|
107
|
-
<ParamField path="fields[].type" type="ExuluFieldTypes" required>
|
|
108
|
-
Field type: `text`, `number`, `boolean`, `date`, `json`, `file`, `longtext`, `decimal`, `integer`, `timestamp`
|
|
109
|
-
</ParamField>
|
|
110
|
-
|
|
111
|
-
<ParamField path="fields[].required" type="boolean">
|
|
112
|
-
Whether this field is required when creating items
|
|
113
|
-
</ParamField>
|
|
114
|
-
|
|
115
|
-
<ParamField path="fields[].editable" type="boolean">
|
|
116
|
-
Whether this field can be edited after creation
|
|
117
|
-
</ParamField>
|
|
118
|
-
|
|
119
|
-
<ParamField path="fields[].unique" type="boolean">
|
|
120
|
-
Whether this field must have unique values
|
|
121
|
-
</ParamField>
|
|
122
|
-
|
|
123
|
-
<ParamField path="fields[].index" type="boolean">
|
|
124
|
-
Whether to create a database index on this field for faster queries
|
|
125
|
-
</ParamField>
|
|
126
|
-
|
|
127
|
-
<ParamField path="fields[].default" type="any">
|
|
128
|
-
Default value for this field
|
|
129
|
-
</ParamField>
|
|
130
|
-
|
|
131
|
-
<ParamField path="fields[].calculated" type="boolean">
|
|
132
|
-
Whether this field is calculated/computed rather than user-provided
|
|
133
|
-
</ParamField>
|
|
134
|
-
|
|
135
|
-
<ParamField path="fields[].enumValues" type="string[]">
|
|
136
|
-
For text fields, restrict values to this list of allowed values
|
|
137
|
-
</ParamField>
|
|
138
|
-
|
|
139
|
-
<ParamField path="fields[].allowedFileTypes" type="allFileTypes[]">
|
|
140
|
-
For file fields, restrict allowed file types (e.g., `["pdf", "docx", "txt"]`)
|
|
141
|
-
</ParamField>
|
|
142
|
-
|
|
143
|
-
### sources
|
|
144
|
-
|
|
145
|
-
<ParamField path="sources" type="ExuluContextSource[]" required>
|
|
146
|
-
Array of data sources that populate this context
|
|
147
|
-
</ParamField>
|
|
148
|
-
|
|
149
|
-
```typescript
|
|
150
|
-
sources: [
|
|
151
|
-
{
|
|
152
|
-
id: "github_issues",
|
|
153
|
-
name: "GitHub Issues",
|
|
154
|
-
description: "Syncs issues from GitHub repository",
|
|
155
|
-
config: {
|
|
156
|
-
schedule: "0 */6 * * *", // Every 6 hours
|
|
157
|
-
queue: await ExuluQueues.register("github_sync"),
|
|
158
|
-
retries: 3,
|
|
159
|
-
backoff: {
|
|
160
|
-
type: "exponential",
|
|
161
|
-
delay: 2000
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
execute: async ({ exuluConfig }) => {
|
|
165
|
-
const issues = await fetchGitHubIssues();
|
|
166
|
-
return issues.map(issue => ({
|
|
167
|
-
external_id: issue.id,
|
|
168
|
-
name: issue.title,
|
|
169
|
-
content: issue.body,
|
|
170
|
-
metadata: { labels: issue.labels }
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
#### Source configuration
|
|
178
|
-
|
|
179
|
-
<ParamField path="sources[].id" type="string" required>
|
|
180
|
-
Unique identifier for the source
|
|
181
|
-
</ParamField>
|
|
182
|
-
|
|
183
|
-
<ParamField path="sources[].name" type="string" required>
|
|
184
|
-
Human-readable source name
|
|
185
|
-
</ParamField>
|
|
186
|
-
|
|
187
|
-
<ParamField path="sources[].description" type="string" required>
|
|
188
|
-
Description of what this source provides
|
|
189
|
-
</ParamField>
|
|
190
|
-
|
|
191
|
-
<ParamField path="sources[].config.schedule" type="string">
|
|
192
|
-
Cron expression for scheduled execution (e.g., `"0 * * * *"` for hourly)
|
|
193
|
-
</ParamField>
|
|
194
|
-
|
|
195
|
-
<ParamField path="sources[].config.queue" type="Promise<ExuluQueueConfig>">
|
|
196
|
-
Queue configuration for background processing
|
|
197
|
-
</ParamField>
|
|
198
|
-
|
|
199
|
-
<ParamField path="sources[].config.retries" type="number">
|
|
200
|
-
Number of retry attempts on failure (default: 3)
|
|
201
|
-
</ParamField>
|
|
202
|
-
|
|
203
|
-
<ParamField path="sources[].config.backoff" type="object">
|
|
204
|
-
Backoff strategy for retries: `{ type: "exponential" | "linear", delay: number }`
|
|
205
|
-
</ParamField>
|
|
206
|
-
|
|
207
|
-
<ParamField path="sources[].execute" type="function" required>
|
|
208
|
-
Async function that fetches and returns items from the source
|
|
209
|
-
</ParamField>
|
|
210
|
-
|
|
211
|
-
## Optional parameters
|
|
212
|
-
|
|
213
|
-
### embedder
|
|
214
|
-
|
|
215
|
-
<ParamField path="embedder" type="ExuluEmbedder">
|
|
216
|
-
Embedder instance that generates vector embeddings for items
|
|
217
|
-
</ParamField>
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
import { ExuluEmbedder } from "@exulu/backend";
|
|
221
|
-
|
|
222
|
-
embedder: new ExuluEmbedder({
|
|
223
|
-
id: "openai_embedder",
|
|
224
|
-
name: "OpenAI Embeddings",
|
|
225
|
-
provider: "openai",
|
|
226
|
-
model: "text-embedding-3-small",
|
|
227
|
-
vectorDimensions: 1536,
|
|
228
|
-
template: "{{title}}\n\n{{content}}"
|
|
229
|
-
})
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
<Note>
|
|
233
|
-
Without an embedder, semantic search is not available. You can still use the context for structured data storage and retrieval.
|
|
234
|
-
</Note>
|
|
235
|
-
|
|
236
|
-
### processor
|
|
237
|
-
|
|
238
|
-
<ParamField path="processor" type="ExuluContextProcessor">
|
|
239
|
-
Processor that transforms items before storage or embeddings generation
|
|
240
|
-
</ParamField>
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
processor: {
|
|
244
|
-
name: "PDF Text Extractor",
|
|
245
|
-
config: {
|
|
246
|
-
trigger: "onInsert", // or "onUpdate", "always", "manual"
|
|
247
|
-
generateEmbeddings: true, // Auto-trigger embeddings after processing
|
|
248
|
-
queue: await ExuluQueues.register("processing"),
|
|
249
|
-
timeoutInSeconds: 300,
|
|
250
|
-
retries: 2,
|
|
251
|
-
backoff: {
|
|
252
|
-
type: "exponential",
|
|
253
|
-
delay: 2000
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
filter: async ({ item, user }) => {
|
|
257
|
-
// Optional: Filter which items to process
|
|
258
|
-
return item.document_s3key !== undefined;
|
|
259
|
-
},
|
|
260
|
-
execute: async ({ item, utils, exuluConfig }) => {
|
|
261
|
-
// Transform the item
|
|
262
|
-
const text = await utils.storage.extractText(item.document_s3key);
|
|
263
|
-
return {
|
|
264
|
-
...item,
|
|
265
|
-
content: text,
|
|
266
|
-
textlength: text.length
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### rateLimit
|
|
273
|
-
|
|
274
|
-
<ParamField path="rateLimit" type="RateLimiterRule">
|
|
275
|
-
Rate limiting rules for API access to this context
|
|
276
|
-
</ParamField>
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
rateLimit: {
|
|
280
|
-
points: 100, // Number of requests
|
|
281
|
-
duration: 60, // Time window in seconds
|
|
282
|
-
blockDuration: 60 // Block duration after exceeding limit
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### queryRewriter
|
|
287
|
-
|
|
288
|
-
<ParamField path="queryRewriter" type="(query: string) => Promise<string>">
|
|
289
|
-
Function that rewrites queries before search to improve results
|
|
290
|
-
</ParamField>
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
queryRewriter: async (query: string) => {
|
|
294
|
-
// Use an LLM to expand or clarify the query
|
|
295
|
-
const response = await openai.chat.completions.create({
|
|
296
|
-
model: "gpt-4",
|
|
297
|
-
messages: [
|
|
298
|
-
{
|
|
299
|
-
role: "system",
|
|
300
|
-
content: "Expand this query to improve search results"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
role: "user",
|
|
304
|
-
content: query
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
|
-
});
|
|
308
|
-
return response.choices[0].message.content;
|
|
309
|
-
}
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### resultReranker
|
|
313
|
-
|
|
314
|
-
<ParamField path="resultReranker" type="(results: any[]) => Promise<any[]>">
|
|
315
|
-
Function that reranks search results based on custom logic or a reranker model
|
|
316
|
-
</ParamField>
|
|
317
|
-
|
|
318
|
-
```typescript
|
|
319
|
-
resultReranker: async (results) => {
|
|
320
|
-
// Use a reranker to improve result ordering
|
|
321
|
-
const reranked = await cohereReranker.rerank({
|
|
322
|
-
query: results[0].query,
|
|
323
|
-
documents: results.map(r => r.chunk_content)
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
return reranked.results.map(r => results[r.index]);
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
## Configuration object
|
|
331
|
-
|
|
332
|
-
<ParamField path="configuration" type="object">
|
|
333
|
-
Additional configuration options for search behavior
|
|
334
|
-
</ParamField>
|
|
335
|
-
|
|
336
|
-
### calculateVectors
|
|
337
|
-
|
|
338
|
-
<ParamField path="configuration.calculateVectors" type="'manual' | 'onUpdate' | 'onInsert' | 'always'">
|
|
339
|
-
When to automatically generate embeddings for items (default: `"manual"`)
|
|
340
|
-
</ParamField>
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
configuration: {
|
|
344
|
-
calculateVectors: "onInsert" // Generate embeddings when items are created
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
<Tabs>
|
|
349
|
-
<Tab title="manual">
|
|
350
|
-
Never auto-generate embeddings. You must call `embeddings.generate.one()` or `embeddings.generate.all()` manually.
|
|
351
|
-
</Tab>
|
|
352
|
-
|
|
353
|
-
<Tab title="onInsert">
|
|
354
|
-
Generate embeddings when new items are created
|
|
355
|
-
</Tab>
|
|
356
|
-
|
|
357
|
-
<Tab title="onUpdate">
|
|
358
|
-
Generate embeddings when items are updated
|
|
359
|
-
</Tab>
|
|
360
|
-
|
|
361
|
-
<Tab title="always">
|
|
362
|
-
Generate embeddings on both insert and update
|
|
363
|
-
</Tab>
|
|
364
|
-
</Tabs>
|
|
365
|
-
|
|
366
|
-
### maxRetrievalResults
|
|
367
|
-
|
|
368
|
-
<ParamField path="configuration.maxRetrievalResults" type="number">
|
|
369
|
-
Maximum number of results to return from search queries (default: `10`)
|
|
370
|
-
</ParamField>
|
|
371
|
-
|
|
372
|
-
```typescript
|
|
373
|
-
configuration: {
|
|
374
|
-
maxRetrievalResults: 20
|
|
375
|
-
}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### defaultRightsMode
|
|
379
|
-
|
|
380
|
-
<ParamField path="configuration.defaultRightsMode" type="'private' | 'public' | 'restricted'">
|
|
381
|
-
Default access control mode for new items (default: `"private"`)
|
|
382
|
-
</ParamField>
|
|
383
|
-
|
|
384
|
-
```typescript
|
|
385
|
-
configuration: {
|
|
386
|
-
defaultRightsMode: "public"
|
|
387
|
-
}
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### enableAsTool
|
|
391
|
-
|
|
392
|
-
<ParamField path="configuration.enableAsTool" type="boolean">
|
|
393
|
-
Whether to automatically expose this context as a tool for agents (default: `true`)
|
|
394
|
-
</ParamField>
|
|
395
|
-
|
|
396
|
-
```typescript
|
|
397
|
-
configuration: {
|
|
398
|
-
enableAsTool: true // Agents can query this context
|
|
399
|
-
}
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
<Info>
|
|
403
|
-
When enabled, agents receive a tool called `{context_name}_context_search` that they can use to query this context.
|
|
404
|
-
</Info>
|
|
405
|
-
|
|
406
|
-
### cutoffs
|
|
407
|
-
|
|
408
|
-
<ParamField path="configuration.cutoffs" type="object">
|
|
409
|
-
Minimum relevance scores for different search methods
|
|
410
|
-
</ParamField>
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
configuration: {
|
|
414
|
-
cutoffs: {
|
|
415
|
-
cosineDistance: 0.7, // Min similarity for semantic search (0-1)
|
|
416
|
-
tsvector: 0.5, // Min score for keyword search
|
|
417
|
-
hybrid: 0.6 // Min score for hybrid search
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
Results below these thresholds are filtered out.
|
|
423
|
-
|
|
424
|
-
### expand
|
|
425
|
-
|
|
426
|
-
<ParamField path="configuration.expand" type="object">
|
|
427
|
-
Number of surrounding chunks to include with each result
|
|
428
|
-
</ParamField>
|
|
429
|
-
|
|
430
|
-
```typescript
|
|
431
|
-
configuration: {
|
|
432
|
-
expand: {
|
|
433
|
-
before: 1, // Include 1 chunk before the matched chunk
|
|
434
|
-
after: 2 // Include 2 chunks after the matched chunk
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
This provides more context around matched chunks, improving the agent's understanding.
|
|
440
|
-
|
|
441
|
-
### language
|
|
442
|
-
|
|
443
|
-
<ParamField path="configuration.language" type="'english' | 'german'">
|
|
444
|
-
Language for full-text search indexing (default: `"english"`)
|
|
445
|
-
</ParamField>
|
|
446
|
-
|
|
447
|
-
```typescript
|
|
448
|
-
configuration: {
|
|
449
|
-
language: "german" // Use German text search configuration
|
|
450
|
-
}
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
This affects stemming and stop words in keyword search.
|
|
454
|
-
|
|
455
|
-
## Complete example
|
|
456
|
-
|
|
457
|
-
```typescript
|
|
458
|
-
import {
|
|
459
|
-
ExuluContext,
|
|
460
|
-
ExuluEmbedder,
|
|
461
|
-
ExuluQueues
|
|
462
|
-
} from "@exulu/backend";
|
|
463
|
-
|
|
464
|
-
const embedder = new ExuluEmbedder({
|
|
465
|
-
id: "openai_ada",
|
|
466
|
-
name: "OpenAI Ada",
|
|
467
|
-
provider: "openai",
|
|
468
|
-
model: "text-embedding-3-small",
|
|
469
|
-
vectorDimensions: 1536,
|
|
470
|
-
template: "Title: {{title}}\nCategory: {{category}}\n\n{{content}}"
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
const docsContext = new ExuluContext({
|
|
474
|
-
id: "product_docs",
|
|
475
|
-
name: "Product Documentation",
|
|
476
|
-
description: "Comprehensive product docs including guides, API references, and tutorials",
|
|
477
|
-
active: true,
|
|
478
|
-
|
|
479
|
-
fields: [
|
|
480
|
-
{
|
|
481
|
-
name: "title",
|
|
482
|
-
type: "text",
|
|
483
|
-
required: true,
|
|
484
|
-
index: true
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
name: "content",
|
|
488
|
-
type: "longtext",
|
|
489
|
-
required: true
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
name: "category",
|
|
493
|
-
type: "text",
|
|
494
|
-
enumValues: ["guide", "api", "tutorial", "reference"],
|
|
495
|
-
index: true
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
name: "url",
|
|
499
|
-
type: "text",
|
|
500
|
-
unique: true
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
name: "last_updated",
|
|
504
|
-
type: "timestamp"
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
name: "metadata",
|
|
508
|
-
type: "json"
|
|
509
|
-
}
|
|
510
|
-
],
|
|
511
|
-
|
|
512
|
-
embedder: embedder,
|
|
513
|
-
|
|
514
|
-
processor: {
|
|
515
|
-
name: "Markdown Processor",
|
|
516
|
-
config: {
|
|
517
|
-
trigger: "onInsert",
|
|
518
|
-
generateEmbeddings: true,
|
|
519
|
-
queue: await ExuluQueues.register("doc_processing")
|
|
520
|
-
},
|
|
521
|
-
execute: async ({ item }) => {
|
|
522
|
-
// Process markdown, extract headings, etc.
|
|
523
|
-
const processed = processMarkdown(item.content);
|
|
524
|
-
return {
|
|
525
|
-
...item,
|
|
526
|
-
content: processed.text,
|
|
527
|
-
metadata: { headings: processed.headings }
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
|
|
532
|
-
sources: [
|
|
533
|
-
{
|
|
534
|
-
id: "github_docs",
|
|
535
|
-
name: "GitHub Documentation",
|
|
536
|
-
description: "Sync docs from GitHub repository",
|
|
537
|
-
config: {
|
|
538
|
-
schedule: "0 */4 * * *", // Every 4 hours
|
|
539
|
-
queue: await ExuluQueues.register("github_sync"),
|
|
540
|
-
retries: 3,
|
|
541
|
-
backoff: {
|
|
542
|
-
type: "exponential",
|
|
543
|
-
delay: 2000
|
|
544
|
-
}
|
|
545
|
-
},
|
|
546
|
-
execute: async ({ exuluConfig }) => {
|
|
547
|
-
const docs = await fetchGitHubDocs();
|
|
548
|
-
return docs.map(doc => ({
|
|
549
|
-
external_id: doc.path,
|
|
550
|
-
name: doc.title,
|
|
551
|
-
content: doc.content,
|
|
552
|
-
category: doc.category,
|
|
553
|
-
url: doc.url,
|
|
554
|
-
last_updated: doc.updatedAt
|
|
555
|
-
}));
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
],
|
|
559
|
-
|
|
560
|
-
rateLimit: {
|
|
561
|
-
points: 100,
|
|
562
|
-
duration: 60,
|
|
563
|
-
blockDuration: 60
|
|
564
|
-
},
|
|
565
|
-
|
|
566
|
-
queryRewriter: async (query) => {
|
|
567
|
-
// Expand query with LLM
|
|
568
|
-
return expandQuery(query);
|
|
569
|
-
},
|
|
570
|
-
|
|
571
|
-
resultReranker: async (results) => {
|
|
572
|
-
// Rerank with Cohere
|
|
573
|
-
return rerankResults(results);
|
|
574
|
-
},
|
|
575
|
-
|
|
576
|
-
configuration: {
|
|
577
|
-
calculateVectors: "onInsert",
|
|
578
|
-
maxRetrievalResults: 15,
|
|
579
|
-
defaultRightsMode: "public",
|
|
580
|
-
enableAsTool: true,
|
|
581
|
-
cutoffs: {
|
|
582
|
-
cosineDistance: 0.65,
|
|
583
|
-
tsvector: 0.5,
|
|
584
|
-
hybrid: 0.6
|
|
585
|
-
},
|
|
586
|
-
expand: {
|
|
587
|
-
before: 1,
|
|
588
|
-
after: 2
|
|
589
|
-
},
|
|
590
|
-
language: "english"
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
## Field type reference
|
|
596
|
-
|
|
597
|
-
<AccordionGroup>
|
|
598
|
-
<Accordion title="text">
|
|
599
|
-
Short text field (VARCHAR). Use for titles, names, categories, etc.
|
|
600
|
-
</Accordion>
|
|
601
|
-
|
|
602
|
-
<Accordion title="longtext">
|
|
603
|
-
Long text field (TEXT). Use for descriptions, articles, documentation content.
|
|
604
|
-
</Accordion>
|
|
605
|
-
|
|
606
|
-
<Accordion title="number">
|
|
607
|
-
Floating point number (DOUBLE PRECISION)
|
|
608
|
-
</Accordion>
|
|
609
|
-
|
|
610
|
-
<Accordion title="integer">
|
|
611
|
-
Whole number (INTEGER)
|
|
612
|
-
</Accordion>
|
|
613
|
-
|
|
614
|
-
<Accordion title="decimal">
|
|
615
|
-
Precise decimal number (DECIMAL)
|
|
616
|
-
</Accordion>
|
|
617
|
-
|
|
618
|
-
<Accordion title="boolean">
|
|
619
|
-
True/false value (BOOLEAN)
|
|
620
|
-
</Accordion>
|
|
621
|
-
|
|
622
|
-
<Accordion title="date">
|
|
623
|
-
Date without time (DATE)
|
|
624
|
-
</Accordion>
|
|
625
|
-
|
|
626
|
-
<Accordion title="timestamp">
|
|
627
|
-
Date with time (TIMESTAMP)
|
|
628
|
-
</Accordion>
|
|
629
|
-
|
|
630
|
-
<Accordion title="json">
|
|
631
|
-
JSON object or array (JSONB)
|
|
632
|
-
</Accordion>
|
|
633
|
-
|
|
634
|
-
<Accordion title="file">
|
|
635
|
-
S3 file reference. Creates a `{field_name}_s3key` column that stores the S3 object key.
|
|
636
|
-
</Accordion>
|
|
637
|
-
</AccordionGroup>
|
|
638
|
-
|
|
639
|
-
## Next steps
|
|
640
|
-
|
|
641
|
-
<CardGroup cols={2}>
|
|
642
|
-
<Card title="API reference" icon="code" href="/core/exulu-context/api-reference">
|
|
643
|
-
Explore all methods and properties
|
|
644
|
-
</Card>
|
|
645
|
-
<Card title="ExuluEmbedder" icon="brain" href="/core/exulu-embedder/introduction">
|
|
646
|
-
Learn about configuring embedders
|
|
647
|
-
</Card>
|
|
648
|
-
</CardGroup>
|