@pylonsync/functions 0.4.20 → 0.4.21

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/types.d.ts CHANGED
@@ -134,11 +134,15 @@ export interface DbReader {
134
134
  * hits come back best-first with the full row on `doc` (vector
135
135
  * fields stripped — re-fetch by id if you need the embedding).
136
136
  *
137
+ * Available wherever `ctx.db` is — queries and mutations. Actions
138
+ * have no `ctx.db`: embed there, then `ctx.runQuery` a query that
139
+ * searches with the vector.
140
+ *
137
141
  * ```ts
138
- * const [embedding] = await ctx.llm.embed(["how do I reset my password?"]);
142
+ * // In a query: the vector arrives as an arg (an action embedded it).
139
143
  * const { hits } = await ctx.db.vectorSearch("Doc", {
140
144
  * field: "embedding",
141
- * vector: embedding,
145
+ * vector,
142
146
  * limit: 5,
143
147
  * filter: { status: "published" }, // equality / IN pre-filter
144
148
  * });
@@ -391,11 +395,12 @@ export interface Llm {
391
395
  * Batch-embed texts via the configured embeddings provider. One
392
396
  * embedding per input, in input order. Pair with a
393
397
  * `field.vector(dims)` field and `ctx.db.vectorSearch` for
394
- * retrieval:
398
+ * retrieval. From an action (which has no `ctx.db`), store via a
399
+ * mutation:
395
400
  *
396
401
  * ```ts
397
402
  * const [vec] = await ctx.llm.embed([doc.body]);
398
- * await ctx.db.update("Doc", doc.id, { embedding: vec });
403
+ * await ctx.runMutation("saveEmbedding", { docId: doc.id, embedding: vec });
399
404
  * ```
400
405
  *
401
406
  * The embeddings provider is a separate axis from chat: with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/functions",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "description": "TypeScript function runtime for pylon — defines server-side queries, mutations, and actions.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/types.ts CHANGED
@@ -162,11 +162,15 @@ export interface DbReader {
162
162
  * hits come back best-first with the full row on `doc` (vector
163
163
  * fields stripped — re-fetch by id if you need the embedding).
164
164
  *
165
+ * Available wherever `ctx.db` is — queries and mutations. Actions
166
+ * have no `ctx.db`: embed there, then `ctx.runQuery` a query that
167
+ * searches with the vector.
168
+ *
165
169
  * ```ts
166
- * const [embedding] = await ctx.llm.embed(["how do I reset my password?"]);
170
+ * // In a query: the vector arrives as an arg (an action embedded it).
167
171
  * const { hits } = await ctx.db.vectorSearch("Doc", {
168
172
  * field: "embedding",
169
- * vector: embedding,
173
+ * vector,
170
174
  * limit: 5,
171
175
  * filter: { status: "published" }, // equality / IN pre-filter
172
176
  * });
@@ -477,11 +481,12 @@ export interface Llm {
477
481
  * Batch-embed texts via the configured embeddings provider. One
478
482
  * embedding per input, in input order. Pair with a
479
483
  * `field.vector(dims)` field and `ctx.db.vectorSearch` for
480
- * retrieval:
484
+ * retrieval. From an action (which has no `ctx.db`), store via a
485
+ * mutation:
481
486
  *
482
487
  * ```ts
483
488
  * const [vec] = await ctx.llm.embed([doc.body]);
484
- * await ctx.db.update("Doc", doc.id, { embedding: vec });
489
+ * await ctx.runMutation("saveEmbedding", { docId: doc.id, embedding: vec });
485
490
  * ```
486
491
  *
487
492
  * The embeddings provider is a separate axis from chat: with