@lunora/ai 1.0.0-alpha.22 → 1.0.0-alpha.23

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.
@@ -183,9 +183,12 @@ const defineRag = (config) => {
183
183
  return run();
184
184
  }
185
185
  const modelId = modelIdOf(resolvedModel);
186
+ const conversationId = typeof context.conversationId === "string" && context.conversationId.length > 0 ? context.conversationId : void 0;
186
187
  return tracer("ai.embed", (_trace, span) => run(span), {
187
188
  "gen_ai.operation.name": "embeddings",
188
- ...modelId === void 0 ? {} : { "gen_ai.request.model": modelId }
189
+ ...modelId === void 0 ? {} : { "gen_ai.request.model": modelId },
190
+ // Session/thread grouping — absent unless a conversation id was set.
191
+ ...conversationId === void 0 ? {} : { "gen_ai.conversation.id": conversationId }
189
192
  });
190
193
  };
191
194
  const checkNamespace = (namespace) => {
@@ -109,6 +109,14 @@ interface RagContext {
109
109
  * stays decoupled from `@lunora/server`'s identity type; `rlsFilter` narrows.
110
110
  */
111
111
  auth?: unknown;
112
+ /**
113
+ * Optional conversation / session id. When set (and `trace` is present), each
114
+ * embedding-model span additionally carries `gen_ai.conversation.id`, so a
115
+ * RAG embed done inside a multi-turn conversation groups with that
116
+ * conversation's other generation spans in the trace store. Omitted → the
117
+ * attribute is absent (backward-compatible).
118
+ */
119
+ conversationId?: string;
112
120
  /**
113
121
  * Optional `ctx.trace` span factory — an `ActionCtx`'s `ctx.trace` satisfies
114
122
  * it structurally. When present, `defineRag` wraps each embedding-model
@@ -109,6 +109,14 @@ interface RagContext {
109
109
  * stays decoupled from `@lunora/server`'s identity type; `rlsFilter` narrows.
110
110
  */
111
111
  auth?: unknown;
112
+ /**
113
+ * Optional conversation / session id. When set (and `trace` is present), each
114
+ * embedding-model span additionally carries `gen_ai.conversation.id`, so a
115
+ * RAG embed done inside a multi-turn conversation groups with that
116
+ * conversation's other generation spans in the trace store. Omitted → the
117
+ * attribute is absent (backward-compatible).
118
+ */
119
+ conversationId?: string;
112
120
  /**
113
121
  * Optional `ctx.trace` span factory — an `ActionCtx`'s `ctx.trace` satisfies
114
122
  * it structurally. When present, `defineRag` wraps each embedding-model
@@ -1,5 +1,5 @@
1
1
  export { default as fixedWindowChunks } from '../packem_shared/fixedWindowChunks-J-WfQDw9.mjs';
2
- export { default as defineRag } from '../packem_shared/defineRag-CQ3pnKUh.mjs';
2
+ export { default as defineRag } from '../packem_shared/defineRag-DmczmIDj.mjs';
3
3
  export { contentHash, guessMimeTypeFromExtension } from '../packem_shared/contentHash-Cgz5KRGD.mjs';
4
4
  export { default as hybridRank } from '../packem_shared/hybridRank-DPC9c2ON.mjs';
5
5
  export { default as bm25LexicalStore } from '../packem_shared/bm25LexicalStore-BQzWLMqX.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/ai",
3
- "version": "1.0.0-alpha.22",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "Workers AI helper for Lunora: provider-agnostic AI SDK access from functions, Workers AI by default",
5
5
  "keywords": [
6
6
  "ai",