@convex-dev/rag 0.5.3 → 0.6.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.
Files changed (82) hide show
  1. package/README.md +89 -82
  2. package/dist/client/index.d.ts +39 -26
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +26 -8
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/component/_generated/api.d.ts +100 -481
  7. package/dist/component/_generated/api.d.ts.map +1 -1
  8. package/dist/component/_generated/api.js +10 -1
  9. package/dist/component/_generated/api.js.map +1 -1
  10. package/dist/component/_generated/component.d.ts +380 -0
  11. package/dist/component/_generated/component.d.ts.map +1 -0
  12. package/dist/component/_generated/component.js +11 -0
  13. package/dist/component/_generated/component.js.map +1 -0
  14. package/dist/component/_generated/dataModel.d.ts +4 -18
  15. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  16. package/dist/component/_generated/dataModel.js +11 -0
  17. package/dist/component/_generated/dataModel.js.map +1 -0
  18. package/dist/component/_generated/server.d.ts +10 -38
  19. package/dist/component/_generated/server.d.ts.map +1 -1
  20. package/dist/component/_generated/server.js +9 -5
  21. package/dist/component/_generated/server.js.map +1 -1
  22. package/dist/component/chunks.d.ts +5 -5
  23. package/dist/component/chunks.d.ts.map +1 -1
  24. package/dist/component/chunks.js +11 -44
  25. package/dist/component/chunks.js.map +1 -1
  26. package/dist/component/embeddings/tables.d.ts +4 -5
  27. package/dist/component/embeddings/tables.d.ts.map +1 -1
  28. package/dist/component/embeddings/tables.js.map +1 -1
  29. package/dist/component/entries.d.ts +6 -6
  30. package/dist/component/namespaces.d.ts +8 -8
  31. package/dist/component/namespaces.d.ts.map +1 -1
  32. package/dist/component/namespaces.js +2 -2
  33. package/dist/component/namespaces.js.map +1 -1
  34. package/dist/component/schema.d.ts +185 -224
  35. package/dist/component/schema.d.ts.map +1 -1
  36. package/dist/component/search.d.ts +4 -3
  37. package/dist/component/search.d.ts.map +1 -1
  38. package/dist/component/search.js +1 -1
  39. package/dist/component/search.js.map +1 -1
  40. package/dist/shared.d.ts +9 -4
  41. package/dist/shared.d.ts.map +1 -1
  42. package/dist/shared.js +1 -4
  43. package/dist/shared.js.map +1 -1
  44. package/package.json +71 -42
  45. package/src/client/defaultChunker.test.ts +1 -1
  46. package/src/client/defaultChunker.ts +7 -7
  47. package/src/client/fileUtils.ts +3 -3
  48. package/src/client/hybridRank.ts +1 -1
  49. package/src/client/index.test.ts +18 -18
  50. package/src/client/index.ts +135 -90
  51. package/src/client/setup.test.ts +2 -2
  52. package/src/component/_generated/api.ts +152 -0
  53. package/src/component/_generated/component.ts +442 -0
  54. package/src/component/_generated/{server.d.ts → server.ts} +33 -21
  55. package/src/component/chunks.test.ts +14 -14
  56. package/src/component/chunks.ts +49 -82
  57. package/src/component/embeddings/importance.test.ts +4 -4
  58. package/src/component/embeddings/importance.ts +1 -1
  59. package/src/component/embeddings/index.test.ts +3 -4
  60. package/src/component/embeddings/index.ts +6 -6
  61. package/src/component/embeddings/tables.ts +9 -8
  62. package/src/component/entries.test.ts +10 -10
  63. package/src/component/entries.ts +29 -29
  64. package/src/component/filters.ts +8 -8
  65. package/src/component/namespaces.ts +31 -34
  66. package/src/component/schema.ts +2 -2
  67. package/src/component/search.test.ts +5 -5
  68. package/src/component/search.ts +8 -9
  69. package/src/component/setup.test.ts +2 -8
  70. package/src/shared.ts +47 -45
  71. package/src/test.ts +20 -0
  72. package/dist/client/types.d.ts +0 -29
  73. package/dist/client/types.d.ts.map +0 -1
  74. package/dist/client/types.js +0 -2
  75. package/dist/client/types.js.map +0 -1
  76. package/dist/package.json +0 -3
  77. package/src/client/types.ts +0 -69
  78. package/src/component/_generated/api.d.ts +0 -507
  79. package/src/component/_generated/api.js +0 -23
  80. package/src/component/_generated/server.js +0 -90
  81. package/src/vitest.config.ts +0 -7
  82. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
package/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  <!-- START: Include on https://convex.dev/components -->
6
6
 
7
- A component for semantic search, usually used to look up context for LLMs.
8
- Use with an Agent for Retrieval-Augmented Generation (RAG).
7
+ A component for semantic search, usually used to look up context for LLMs. Use
8
+ with an Agent for Retrieval-Augmented Generation (RAG).
9
9
 
10
10
  [![Use AI to search HUGE amounts of text with the RAG Component](https://thumbs.video-to-markdown.com/1ff18153.jpg)](https://youtu.be/dGmtAmdAaFs)
11
11
 
@@ -17,17 +17,20 @@ Use with an Agent for Retrieval-Augmented Generation (RAG).
17
17
  - **Custom Filtering**: Filter content with custom indexed fields.
18
18
  - **Importance Weighting**: Weight content by providing a 0 to 1 "importance".
19
19
  - **Chunk Context**: Get surrounding chunks for better context.
20
- - **Graceful Migrations**: Migrate content or whole namespaces without disruption.
20
+ - **Graceful Migrations**: Migrate content or whole namespaces without
21
+ disruption.
21
22
 
22
- Found a bug? Feature request? [File it here](https://github.com/get-convex/rag/issues).
23
+ Found a bug? Feature request?
24
+ [File it here](https://github.com/get-convex/rag/issues).
23
25
 
24
26
  ## Pre-requisite: Convex
25
27
 
26
- You'll need an existing Convex project to use the component.
27
- Convex is a hosted backend platform, including a database, serverless functions,
28
- and a ton more you can learn about [here](https://docs.convex.dev/get-started).
28
+ You'll need an existing Convex project to use the component. Convex is a hosted
29
+ backend platform, including a database, serverless functions, and a ton more you
30
+ can learn about [here](https://docs.convex.dev/get-started).
29
31
 
30
- Run `npm create convex` or follow any of the [quickstarts](https://docs.convex.dev/home) to set one up.
32
+ Run `npm create convex` or follow any of the
33
+ [quickstarts](https://docs.convex.dev/home) to set one up.
31
34
 
32
35
  ## Installation
33
36
 
@@ -37,12 +40,13 @@ Install the component package:
37
40
  npm install @convex-dev/rag
38
41
  ```
39
42
 
40
- Create a `convex.config.ts` file in your app's `convex/` folder and install the component by calling `use`:
43
+ Create a `convex.config.ts` file in your app's `convex/` folder and install the
44
+ component by calling `use`:
41
45
 
42
46
  ```ts
43
47
  // convex/convex.config.ts
44
48
  import { defineApp } from "convex/server";
45
- import rag from "@convex-dev/rag/convex.config";
49
+ import rag from "@convex-dev/rag/convex.config.js";
46
50
 
47
51
  const app = defineApp();
48
52
  app.use(rag);
@@ -67,8 +71,8 @@ const rag = new RAG(components.rag, {
67
71
 
68
72
  ## Add context to RAG
69
73
 
70
- Add content with text chunks. Each call to `add` will create a new **entry**.
71
- It will embed the chunks automatically if you don't provide them.
74
+ Add content with text chunks. Each call to `add` will create a new **entry**. It
75
+ will embed the chunks automatically if you don't provide them.
72
76
 
73
77
  ```ts
74
78
  export const add = action({
@@ -83,19 +87,21 @@ export const add = action({
83
87
  });
84
88
  ```
85
89
 
86
- See below for how to chunk the text yourself or add content asynchronously, e.g. to handle large files.
90
+ See below for how to chunk the text yourself or add content asynchronously, e.g.
91
+ to handle large files.
87
92
 
88
93
  ## Semantic Search
89
94
 
90
95
  Search across content with vector similarity
91
96
 
92
- - `text` is a string with the full content of the results, for convenience.
93
- It is in order of the entries, with titles at each entry boundary, and
94
- separators between non-sequential chunks. See below for more details.
97
+ - `text` is a string with the full content of the results, for convenience. It
98
+ is in order of the entries, with titles at each entry boundary, and separators
99
+ between non-sequential chunks. See below for more details.
95
100
  - `results` is an array of matching chunks with scores and more metadata.
96
- - `entries` is an array of the entries that matched the query.
97
- Each result has a `entryId` referencing one of these source entries.
98
- - `usage` contains embedding token usage information. Will be `{ tokens: 0 }` if no embedding was performed (e.g. when passing pre-computed embeddings).
101
+ - `entries` is an array of the entries that matched the query. Each result has a
102
+ `entryId` referencing one of these source entries.
103
+ - `usage` contains embedding token usage information. Will be `{ tokens: 0 }` if
104
+ no embedding was performed (e.g. when passing pre-computed embeddings).
99
105
 
100
106
  ```ts
101
107
  export const search = action({
@@ -119,17 +125,17 @@ export const search = action({
119
125
 
120
126
  Once you have searched for the context, you can use it with an LLM.
121
127
 
122
- Generally you'll already be using something to make LLM requests, e.g.
123
- the [Agent Component](https://www.convex.dev/components/agent),
124
- which tracks the message history for you.
125
- See the [Agent Component docs](https://docs.convex.dev/agents)
126
- for more details on doing RAG with the Agent Component.
128
+ Generally you'll already be using something to make LLM requests, e.g. the
129
+ [Agent Component](https://www.convex.dev/components/agent), which tracks the
130
+ message history for you. See the
131
+ [Agent Component docs](https://docs.convex.dev/agents) for more details on doing
132
+ RAG with the Agent Component.
127
133
 
128
134
  However, if you just want a one-off response, you can use the `generateText`
129
135
  function as a convenience.
130
136
 
131
- This will automatically search for relevant entries and use them as context
132
- for the LLM, using default formatting.
137
+ This will automatically search for relevant entries and use them as context for
138
+ the LLM, using default formatting.
133
139
 
134
140
  The arguments to `generateText` are compatible with all arguments to
135
141
  `generateText` from the AI SDK.
@@ -154,9 +160,9 @@ Note: You can specify any of the search options available on `rag.search`.
154
160
 
155
161
  ## Filtered Search
156
162
 
157
- You can provide filters when adding content and use them to search.
158
- To do this, you'll need to give the RAG component a list of the filter names.
159
- You can optionally provide a type parameter for type safety (no runtime validation).
163
+ You can provide filters when adding content and use them to search. To do this,
164
+ you'll need to give the RAG component a list of the filter names. You can
165
+ optionally provide a type parameter for type safety (no runtime validation).
160
166
 
161
167
  Note: these filters can be OR'd together when searching. In order to get an AND,
162
168
  you provide a filter with a more complex value, such as `categoryAndType` below.
@@ -227,14 +233,13 @@ export const searchForNewsOrSports = action({
227
233
 
228
234
  ### Add surrounding chunks to results for context
229
235
 
230
- Instead of getting just the single matching chunk, you can request
231
- surrounding chunks so there's more context to the result.
236
+ Instead of getting just the single matching chunk, you can request surrounding
237
+ chunks so there's more context to the result.
232
238
 
233
239
  Note: If there are results that have overlapping ranges, it will not return
234
- duplicate chunks, but instead give priority to adding the "before" context
235
- to each chunk.
236
- For example if you requested 2 before and 1 after, and your results were for
237
- the same entryId indexes 1, 4, and 7, the results would be:
240
+ duplicate chunks, but instead give priority to adding the "before" context to
241
+ each chunk. For example if you requested 2 before and 1 after, and your results
242
+ were for the same entryId indexes 1, 4, and 7, the results would be:
238
243
 
239
244
  ```ts
240
245
  [
@@ -268,10 +273,10 @@ export const searchWithContext = action({
268
273
 
269
274
  ## Formatting results
270
275
 
271
- Formatting the results for use in a prompt depends a bit on the use case.
272
- By default, the results will be sorted by score, not necessarily in the order
273
- they appear in the original text. You may want to sort them by the order they
274
- appear in the original text so they follow the flow of the original document.
276
+ Formatting the results for use in a prompt depends a bit on the use case. By
277
+ default, the results will be sorted by score, not necessarily in the order they
278
+ appear in the original text. You may want to sort them by the order they appear
279
+ in the original text so they follow the flow of the original document.
275
280
 
276
281
  For convenience, the `text` field of the search results is a string formatted
277
282
  with `...` separating non-sequential chunks, `---` separating entries, and
@@ -300,8 +305,8 @@ Chunk 5 contents
300
305
  ```
301
306
 
302
307
  There is also a `text` field on each entry that is the full text of the entry,
303
- similarly formatted with `...` separating non-sequential chunks, if you want
304
- to format each entry differently.
308
+ similarly formatted with `...` separating non-sequential chunks, if you want to
309
+ format each entry differently.
305
310
 
306
311
  For a fully custom format, you can use the `results` field and entries directly:
307
312
 
@@ -350,33 +355,33 @@ await generateText({
350
355
 
351
356
  ## Using keys to gracefully replace content
352
357
 
353
- When you add content to a namespace, you can provide a `key` to uniquely identify the content.
354
- If you add content with the same key, it will make a new entry to replace the old one.
358
+ When you add content to a namespace, you can provide a `key` to uniquely
359
+ identify the content. If you add content with the same key, it will make a new
360
+ entry to replace the old one.
355
361
 
356
362
  ```ts
357
363
  await rag.add(ctx, { namespace: userId, key: "my-file.txt", text });
358
364
  ```
359
365
 
360
- When a new document is added, it will start with a status of "pending" while
361
- it chunks, embeds, and inserts the data into the database.
362
- Once all data is inserted, it will iterate over the chunks and swap the old
363
- content embeddings with the new ones, and then update the status to "ready",
364
- marking the previous version as "replaced".
366
+ When a new document is added, it will start with a status of "pending" while it
367
+ chunks, embeds, and inserts the data into the database. Once all data is
368
+ inserted, it will iterate over the chunks and swap the old content embeddings
369
+ with the new ones, and then update the status to "ready", marking the previous
370
+ version as "replaced".
365
371
 
366
372
  The old content is kept around by default, so in-flight searches will get
367
- results for old vector search results.
368
- See below for more details on deleting.
373
+ results for old vector search results. See below for more details on deleting.
369
374
 
370
375
  This means that if searches are happening while the document is being added,
371
- they will see the old content results
372
- This is useful if you want to add content to a namespace and then immediately
373
- search for it, or if you want to add content to a namespace and then immediately
374
- add more content to the same namespace.
376
+ they will see the old content results This is useful if you want to add content
377
+ to a namespace and then immediately search for it, or if you want to add content
378
+ to a namespace and then immediately add more content to the same namespace.
375
379
 
376
380
  ## Using your own content splitter
377
381
 
378
- By default, the component uses the `defaultChunker` to split the content into chunks.
379
- You can pass in your own content chunks to the `add` or `addAsync` functions.
382
+ By default, the component uses the `defaultChunker` to split the content into
383
+ chunks. You can pass in your own content chunks to the `add` or `addAsync`
384
+ functions.
380
385
 
381
386
  ```ts
382
387
  const chunks = await textSplitter.split(content);
@@ -386,8 +391,8 @@ await rag.add(ctx, { namespace: "global", chunks });
386
391
  Note: The `textSplitter` here could be LangChain, Mastra, or something custom.
387
392
  The simplest version makes an array of strings like `content.split("\n")`.
388
393
 
389
- Note: you can pass in an async iterator instead of an array to handle large content.
390
- Or use the `addAsync` function (see below).
394
+ Note: you can pass in an async iterator instead of an array to handle large
395
+ content. Or use the `addAsync` function (see below).
391
396
 
392
397
  ## Providing custom embeddings per-chunk
393
398
 
@@ -404,7 +409,7 @@ const chunksWithEmbeddings = await Promise.all(
404
409
  ...chunk,
405
410
  embedding: await embedSummary(chunk),
406
411
  };
407
- })
412
+ }),
408
413
  );
409
414
  await rag.add(ctx, { namespace: "global", chunks });
410
415
  ```
@@ -451,14 +456,14 @@ export const chunkerAction = rag.defineChunkerAction(async (ctx, args) => {
451
456
  export default cors.http;
452
457
  ```
453
458
 
454
- You can upload files directly to a Convex action, httpAction, or upload url.
455
- See the [docs](https://docs.convex.dev/file-storage/upload-files) for details.
459
+ You can upload files directly to a Convex action, httpAction, or upload url. See
460
+ the [docs](https://docs.convex.dev/file-storage/upload-files) for details.
456
461
 
457
462
  ### OnComplete Handling
458
463
 
459
464
  You can register an `onComplete` handler when adding content that will be called
460
- when the entry was created and is ready, or if there was an error or it was replaced before it
461
- finished.
465
+ when the entry was created and is ready, or if there was an error or it was
466
+ replaced before it finished.
462
467
 
463
468
  ```ts
464
469
  // in an action
@@ -476,12 +481,14 @@ export const docComplete = rag.defineOnComplete<DataModel>(
476
481
  }
477
482
  // You can associate the entry with your own data here. This will commit
478
483
  // in the same transaction as the entry becoming ready.
479
- }
484
+ },
480
485
  );
481
486
  ```
482
487
 
483
- Note: The `onComplete` callback is only triggered when new content is processed. If you add content that already exists (`contentHash` did not change for the same `key`), `onComplete` will not be called.
484
- To handle this case, you can check the return value of `rag.add()`:
488
+ Note: The `onComplete` callback is only triggered when new content is processed.
489
+ If you add content that already exists (`contentHash` did not change for the
490
+ same `key`), `onComplete` will not be called. To handle this case, you can check
491
+ the return value of `rag.add()`:
485
492
 
486
493
  ```ts
487
494
  const { status, created } = await rag.add(ctx, {
@@ -502,8 +509,8 @@ if (status === "ready" && !created) {
502
509
 
503
510
  Here's a simple example fetching content from a URL to add.
504
511
 
505
- It also adds filters to the entry, so you can search for it later by
506
- category, contentType, or both.
512
+ It also adds filters to the entry, so you can search for it later by category,
513
+ contentType, or both.
507
514
 
508
515
  ```ts
509
516
  export const add = action({
@@ -581,7 +588,7 @@ crons.interval(
581
588
  "deleteOldContent",
582
589
  { hours: 1 },
583
590
  internal.crons.deleteOldContent,
584
- {}
591
+ {},
585
592
  );
586
593
  export default crons;
587
594
  ```
@@ -604,13 +611,13 @@ Types for the various elements:
604
611
  - While the `EntryId` and `NamespaceId` are strings under the hood, they are
605
612
  given more specific types to make it easier to use them correctly.
606
613
 
607
- Validators can be used in `args` and schema table definitions:
608
- `vEntry`, `vEntryId`, `vNamespaceId`, `vSearchEntry`, `vSearchResult`
614
+ Validators can be used in `args` and schema table definitions: `vEntry`,
615
+ `vEntryId`, `vNamespaceId`, `vSearchEntry`, `vSearchResult`
609
616
 
610
617
  e.g. `defineTable({ myDocTitle: v.string(), entryId: vEntryId })`
611
618
 
612
- The validators for the branded IDs will only validate they are strings,
613
- but will have the more specific types, to provide type safety.
619
+ The validators for the branded IDs will only validate they are strings, but will
620
+ have the more specific types, to provide type safety.
614
621
 
615
622
  ## Utility Functions
616
623
 
@@ -665,29 +672,29 @@ const results = hybridRank(
665
672
  [textSearchResults, vectorSearchResults, recentSearchResults],
666
673
  {
667
674
  weights: [2, 1, 3], // prefer recent results more than text or vector
668
- }
675
+ },
669
676
  );
670
677
  // results = [ id3, id5, id1, id2, id4 ]
671
678
  ```
672
679
 
673
- To have it more biased towards the top few results, you can set the `k` value
674
- to a lower number (10 by default).
680
+ To have it more biased towards the top few results, you can set the `k` value to
681
+ a lower number (10 by default).
675
682
 
676
683
  ```ts
677
684
  const results = hybridRank(
678
685
  [textSearchResults, vectorSearchResults, recentSearchResults],
679
- { k: 1 }
686
+ { k: 1 },
680
687
  );
681
688
  // results = [ id5, id1, id3, id2, id4 ]
682
689
  ```
683
690
 
684
691
  ### `contentHashFromArrayBuffer`
685
692
 
686
- This generates the hash of a file's contents, which can be used to avoid
687
- adding the same file twice.
693
+ This generates the hash of a file's contents, which can be used to avoid adding
694
+ the same file twice.
688
695
 
689
- Note: doing `blob.arrayBuffer()` will consume the blob's data, so you'll need
690
- to make a new blob to use it after calling this function.
696
+ Note: doing `blob.arrayBuffer()` will consume the blob's data, so you'll need to
697
+ make a new blob to use it after calling this function.
691
698
 
692
699
  ```ts
693
700
  import { contentHashFromArrayBuffer } from "@convex-dev/rag";
@@ -739,6 +746,6 @@ See more example usage in [example.ts](./example/convex/example.ts).
739
746
 
740
747
  ### Running the example
741
748
 
742
- Run the example with `npm i && npm run setup && npm run example`.
749
+ Run the example with `npm run setup && npm run dev`.
743
750
 
744
751
  <!-- END: Include on https://convex.dev/components -->
@@ -1,18 +1,17 @@
1
- import { generateText, type ModelMessage, type EmbeddingModel, type EmbeddingModelUsage } from "ai";
2
- import { type FunctionArgs, type FunctionReturnType, type GenericActionCtx, type GenericDataModel, type GenericMutationCtx, type PaginationOptions, type PaginationResult, type RegisteredAction, type RegisteredMutation } from "convex/server";
1
+ import { generateText, type EmbeddingModel, type EmbeddingModelUsage, type ModelMessage } from "ai";
2
+ import { FunctionReference, type FunctionArgs, type FunctionReturnType, type GenericActionCtx, type GenericDataModel, type GenericMutationCtx, type PaginationOptions, type PaginationResult, type RegisteredAction, type RegisteredMutation } from "convex/server";
3
3
  import { type Value } from "convex/values";
4
- import { vEntryId, vNamespaceId, type Chunk, type Entry, type EntryFilter, type EntryId, type Namespace, type NamespaceId, type SearchEntry, type SearchResult, type Status } from "../shared.js";
5
- import { type RAGComponent, type RunActionCtx, type RunMutationCtx, type RunQueryCtx } from "./types.js";
6
- import { type ChunkerAction, type OnComplete, type OnCompleteNamespace } from "../shared.js";
4
+ import { ComponentApi } from "../component/_generated/component.js";
5
+ import { OnCompleteArgs, vEntryId, vNamespaceId, type Chunk, type ChunkerAction, type Entry, type EntryFilter, type EntryId, type Namespace, type NamespaceId, type OnComplete, type OnCompleteNamespace, type SearchEntry, type SearchResult, type Status } from "../shared.js";
7
6
  import { defaultChunker } from "./defaultChunker.js";
8
7
  export { hybridRank } from "./hybridRank.js";
9
8
  export { defaultChunker, vEntryId, vNamespaceId };
10
- export type { ChunkerAction, Entry, EntryId, RAGComponent, NamespaceId, OnComplete, OnCompleteNamespace, SearchEntry, SearchResult, Status, };
11
- export { type VEntry, type VSearchEntry, type EntryFilter, vEntry, vSearchEntry, vSearchResult, vOnCompleteArgs, } from "../shared.js";
12
- export { contentHashFromArrayBuffer, guessMimeTypeFromExtension, guessMimeTypeFromContents, } from "./fileUtils.js";
9
+ export type { ChunkerAction, Entry, EntryId, NamespaceId, OnComplete, OnCompleteNamespace, SearchEntry, SearchResult, Status, };
10
+ export { vEntry, vOnCompleteArgs, vSearchEntry, vSearchResult, type EntryFilter, type VEntry, type VSearchEntry, } from "../shared.js";
11
+ export { contentHashFromArrayBuffer, guessMimeTypeFromContents, guessMimeTypeFromExtension, } from "./fileUtils.js";
13
12
  type Importance = number;
14
13
  export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<string, Value>, EntryMetadata extends Record<string, Value> = Record<string, Value>> {
15
- component: RAGComponent;
14
+ component: ComponentApi;
16
15
  options: {
17
16
  embeddingDimension: number;
18
17
  textEmbeddingModel: EmbeddingModel<string>;
@@ -37,7 +36,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
37
36
  * })
38
37
  * and then entry results will have the metadata type `{ source: "website" }`.
39
38
  */
40
- constructor(component: RAGComponent, options: {
39
+ constructor(component: ComponentApi, options: {
41
40
  embeddingDimension: number;
42
41
  textEmbeddingModel: EmbeddingModel<string>;
43
42
  filterNames?: FilterNames<FitlerSchemas>;
@@ -52,7 +51,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
52
51
  * If you provide a contentHash, it will deduplicate the entry if it already exists.
53
52
  * The filterValues you provide can be used later to search for it.
54
53
  */
55
- add(ctx: RunMutationCtx, args: NamespaceSelection & EntryArgs<FitlerSchemas, EntryMetadata> & ({
54
+ add(ctx: CtxWith<"runMutation">, args: NamespaceSelection & EntryArgs<FitlerSchemas, EntryMetadata> & ({
56
55
  /**
57
56
  * You can provide your own chunks to finely control the splitting.
58
57
  * These can also include your own provided embeddings, so you can
@@ -100,7 +99,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
100
99
  * });
101
100
  * ```
102
101
  */
103
- addAsync(ctx: RunMutationCtx, args: NamespaceSelection & EntryArgs<FitlerSchemas, EntryMetadata> & {
102
+ addAsync(ctx: CtxWith<"runMutation">, args: NamespaceSelection & EntryArgs<FitlerSchemas, EntryMetadata> & {
104
103
  /**
105
104
  * A function that splits the entry into chunks and embeds them.
106
105
  * This should be passed as internal.foo.myChunkerAction
@@ -125,7 +124,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
125
124
  * You can provide a query string or target embedding, as well as search
126
125
  * parameters to filter and constrain the results.
127
126
  */
128
- search(ctx: RunActionCtx, args: {
127
+ search(ctx: CtxWith<"runAction">, args: {
129
128
  /**
130
129
  * The namespace to search in. e.g. a userId if entries are per-user.
131
130
  * Note: it will only match entries in the namespace that match the
@@ -152,7 +151,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
152
151
  * You can provide "messages" in addition to the prompt to provide
153
152
  * extra context / conversation history.
154
153
  */
155
- generateText(ctx: RunActionCtx, args: {
154
+ generateText(ctx: CtxWith<"runAction">, args: {
156
155
  /**
157
156
  * The search options to use for context search, including the namespace.
158
157
  */
@@ -188,7 +187,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
188
187
  /**
189
188
  * List all entries in a namespace.
190
189
  */
191
- list(ctx: RunQueryCtx, args: {
190
+ list(ctx: CtxWith<"runQuery">, args: {
192
191
  namespaceId?: NamespaceId;
193
192
  order?: "desc" | "asc";
194
193
  status?: Status;
@@ -200,7 +199,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
200
199
  /**
201
200
  * Get entry metadata by its id.
202
201
  */
203
- getEntry(ctx: RunQueryCtx, args: {
202
+ getEntry(ctx: CtxWith<"runQuery">, args: {
204
203
  entryId: EntryId;
205
204
  }): Promise<Entry<FitlerSchemas, EntryMetadata> | null>;
206
205
  /**
@@ -208,7 +207,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
208
207
  * new results into a new entry when migrating, or avoiding duplicating work
209
208
  * when updating content.
210
209
  */
211
- findEntryByContentHash(ctx: RunQueryCtx, args: {
210
+ findEntryByContentHash(ctx: CtxWith<"runQuery">, args: {
212
211
  namespace: string;
213
212
  key: string;
214
213
  /** The hash of the entry contents to try to match. */
@@ -218,7 +217,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
218
217
  * Get a namespace that matches the modelId, embedding dimension, and
219
218
  * filterNames of the RAG instance. If it doesn't exist, it will be created.
220
219
  */
221
- getOrCreateNamespace(ctx: RunMutationCtx, args: {
220
+ getOrCreateNamespace(ctx: CtxWith<"runMutation">, args: {
222
221
  /**
223
222
  * The namespace to get or create. e.g. a userId if entries are per-user.
224
223
  */
@@ -241,13 +240,13 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
241
240
  * Get a namespace that matches the modelId, embedding dimension, and
242
241
  * filterNames of the RAG instance. If it doesn't exist, it will return null.
243
242
  */
244
- getNamespace(ctx: RunQueryCtx, args: {
243
+ getNamespace(ctx: CtxWith<"runQuery">, args: {
245
244
  namespace: string;
246
245
  }): Promise<Namespace | null>;
247
246
  /**
248
247
  * List all chunks for an entry, paginated.
249
248
  */
250
- listChunks(ctx: RunQueryCtx, args: {
249
+ listChunks(ctx: CtxWith<"runQuery">, args: {
251
250
  paginationOpts: PaginationOptions;
252
251
  entryId: EntryId;
253
252
  order?: "desc" | "asc";
@@ -255,7 +254,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
255
254
  /**
256
255
  * Delete an entry and all its chunks in the background using a workpool.
257
256
  */
258
- deleteAsync(ctx: RunMutationCtx, args: {
257
+ deleteAsync(ctx: CtxWith<"runMutation">, args: {
259
258
  entryId: EntryId;
260
259
  }): Promise<void>;
261
260
  /**
@@ -264,17 +263,17 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
264
263
  * you're likely running this in a mutation.
265
264
  * Use `deleteAsync` or run `delete` in an action.
266
265
  */
267
- delete(ctx: RunActionCtx, args: {
266
+ delete(ctx: CtxWith<"runAction">, args: {
268
267
  entryId: EntryId;
269
268
  }): Promise<void>;
270
269
  /** @deprecated Use `deleteAsync` in mutations. */
271
- delete(ctx: RunMutationCtx, args: {
270
+ delete(ctx: CtxWith<"runMutation">, args: {
272
271
  entryId: EntryId;
273
272
  }): Promise<void>;
274
273
  /**
275
274
  * Delete all entries with a given key (asynchrounously).
276
275
  */
277
- deleteByKeyAsync(ctx: RunMutationCtx, args: {
276
+ deleteByKeyAsync(ctx: CtxWith<"runMutation">, args: {
278
277
  namespaceId: NamespaceId;
279
278
  key: string;
280
279
  beforeVersion?: number;
@@ -285,7 +284,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
285
284
  * you're likely running this in a mutation.
286
285
  * Use `deleteByKeyAsync` or run `delete` in an action.
287
286
  */
288
- deleteByKey(ctx: RunActionCtx, args: {
287
+ deleteByKey(ctx: CtxWith<"runAction">, args: {
289
288
  namespaceId: NamespaceId;
290
289
  key: string;
291
290
  beforeVersion?: number;
@@ -308,7 +307,7 @@ export declare class RAG<FitlerSchemas extends Record<string, Value> = Record<st
308
307
  * This is usually when it's "ready" but it can be "replaced" if a newer
309
308
  * entry is ready before this one.
310
309
  */
311
- defineOnComplete<DataModel extends GenericDataModel>(fn: (ctx: GenericMutationCtx<DataModel>, args: FunctionArgs<OnComplete<FitlerSchemas, EntryMetadata>>) => Promise<void>): RegisteredMutation<"internal", FunctionArgs<OnComplete<FitlerSchemas, EntryMetadata>>, null>;
310
+ defineOnComplete<DataModel extends GenericDataModel>(fn: (ctx: GenericMutationCtx<DataModel>, args: OnCompleteArgs<FitlerSchemas, EntryMetadata>) => Promise<void>): RegisteredMutation<"internal", FunctionArgs<OnComplete>, null>;
312
311
  /**
313
312
  * Define a function that can be provided to the `chunkerAction` parameter of
314
313
  * `addAsync` like:
@@ -455,4 +454,18 @@ type SearchOptions<FitlerSchemas extends Record<string, Value>> = {
455
454
  */
456
455
  vectorScoreThreshold?: number;
457
456
  };
457
+ export type ModelOrMetadata = string | ({
458
+ provider: string;
459
+ } & ({
460
+ modelId: string;
461
+ } | {
462
+ model: string;
463
+ }));
464
+ export declare function getModelId(embeddingModel: ModelOrMetadata): string;
465
+ export declare function getProviderName(embeddingModel: ModelOrMetadata): string;
466
+ type CtxWith<T extends "runQuery" | "runMutation" | "runAction"> = Pick<{
467
+ runQuery: <Query extends FunctionReference<"query", "internal">>(query: Query, args: FunctionArgs<Query>) => Promise<FunctionReturnType<Query>>;
468
+ runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(mutation: Mutation, args: FunctionArgs<Mutation>) => Promise<FunctionReturnType<Mutation>>;
469
+ runAction: <Action extends FunctionReference<"action", "internal">>(action: Action, args: FunctionArgs<Action>) => Promise<FunctionReturnType<Action>>;
470
+ }, T>;
458
471
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAIL,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAIL,QAAQ,EACR,YAAY,EAEZ,KAAK,KAAK,EAEV,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,MAAM,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAClD,YAAY,EACV,aAAa,EACb,KAAK,EACL,OAAO,EACP,Y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