@tanstack/ai 0.26.0 → 0.27.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/esm/activities/chat/index.d.ts +0 -6
- package/dist/esm/activities/chat/index.js +2 -17
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/middleware/types.d.ts +1 -4
- package/dist/esm/activities/summarize/chat-stream-summarize.js +62 -3
- package/dist/esm/activities/summarize/chat-stream-summarize.js.map +1 -1
- package/dist/esm/logger/internal-logger.d.ts +8 -0
- package/dist/esm/logger/internal-logger.js +15 -0
- package/dist/esm/logger/internal-logger.js.map +1 -1
- package/dist/esm/middlewares/otel.js +30 -6
- package/dist/esm/middlewares/otel.js.map +1 -1
- package/dist/esm/types.d.ts +0 -35
- package/dist/esm/utilities/sampling-keys.d.ts +20 -0
- package/dist/esm/utilities/sampling-keys.js +20 -0
- package/dist/esm/utilities/sampling-keys.js.map +1 -0
- package/package.json +2 -2
- package/skills/ai-core/adapter-configuration/SKILL.md +67 -6
- package/skills/ai-core/adapter-configuration/references/anthropic-adapter.md +6 -3
- package/skills/ai-core/adapter-configuration/references/gemini-adapter.md +3 -0
- package/skills/ai-core/adapter-configuration/references/ollama-adapter.md +10 -1
- package/skills/ai-core/adapter-configuration/references/openai-adapter.md +4 -0
- package/skills/ai-core/chat-experience/SKILL.md +24 -7
- package/skills/ai-core/middleware/SKILL.md +11 -0
- package/src/activities/chat/index.ts +2 -23
- package/src/activities/chat/middleware/types.ts +1 -4
- package/src/activities/summarize/chat-stream-summarize.ts +162 -3
- package/src/logger/internal-logger.ts +18 -0
- package/src/middlewares/otel.ts +48 -6
- package/src/types.ts +0 -35
- package/src/utilities/sampling-keys.ts +28 -0
|
@@ -77,12 +77,6 @@ export interface TextActivityOptions<TAdapter extends AnyTextAdapter, TSchema ex
|
|
|
77
77
|
tools?: Array<(AnyRuntimeTool & {
|
|
78
78
|
readonly '~toolKind'?: never;
|
|
79
79
|
}) | ProviderTool<string, TAdapter['~types']['toolCapabilities'][number]>> | undefined;
|
|
80
|
-
/** Controls the randomness of the output. Higher values make output more random. Range: [0.0, 2.0] */
|
|
81
|
-
temperature?: TextOptions['temperature'];
|
|
82
|
-
/** Nucleus sampling parameter. The model considers tokens with topP probability mass. */
|
|
83
|
-
topP?: TextOptions['topP'];
|
|
84
|
-
/** The maximum number of tokens to generate in the response. */
|
|
85
|
-
maxTokens?: TextOptions['maxTokens'];
|
|
86
80
|
/** Additional metadata to attach to the request. */
|
|
87
81
|
metadata?: TextOptions['metadata'];
|
|
88
82
|
/** Model-specific provider options (type comes from adapter) */
|
|
@@ -297,11 +297,8 @@ class TextEngine {
|
|
|
297
297
|
}
|
|
298
298
|
beforeRun() {
|
|
299
299
|
this.streamStartTime = Date.now();
|
|
300
|
-
const { tools,
|
|
300
|
+
const { tools, metadata } = this.params;
|
|
301
301
|
const options = {};
|
|
302
|
-
if (temperature !== void 0) options.temperature = temperature;
|
|
303
|
-
if (topP !== void 0) options.topP = topP;
|
|
304
|
-
if (maxTokens !== void 0) options.maxTokens = maxTokens;
|
|
305
302
|
if (metadata !== void 0) options.metadata = metadata;
|
|
306
303
|
this.eventOptions = Object.keys(options).length > 0 ? options : void 0;
|
|
307
304
|
this.eventToolNames = tools?.map((t) => t.name);
|
|
@@ -336,7 +333,7 @@ class TextEngine {
|
|
|
336
333
|
});
|
|
337
334
|
}
|
|
338
335
|
async *streamModelResponse() {
|
|
339
|
-
const {
|
|
336
|
+
const { metadata, modelOptions } = this.params;
|
|
340
337
|
const tools = this.tools;
|
|
341
338
|
const toolsWithJsonSchemas = tools.map((tool) => ({
|
|
342
339
|
...tool,
|
|
@@ -359,9 +356,6 @@ class TextEngine {
|
|
|
359
356
|
model: this.params.model,
|
|
360
357
|
messages: this.messages,
|
|
361
358
|
tools: toolsWithJsonSchemas,
|
|
362
|
-
temperature,
|
|
363
|
-
topP,
|
|
364
|
-
maxTokens,
|
|
365
359
|
metadata,
|
|
366
360
|
request: this.effectiveRequest,
|
|
367
361
|
modelOptions,
|
|
@@ -1024,9 +1018,6 @@ class TextEngine {
|
|
|
1024
1018
|
chatOptions: {
|
|
1025
1019
|
model: this.params.model,
|
|
1026
1020
|
messages: this.messages,
|
|
1027
|
-
temperature: postOnConfig.temperature,
|
|
1028
|
-
topP: postOnConfig.topP,
|
|
1029
|
-
maxTokens: postOnConfig.maxTokens,
|
|
1030
1021
|
metadata: postOnConfig.metadata,
|
|
1031
1022
|
modelOptions: postOnConfig.modelOptions,
|
|
1032
1023
|
systemPrompts: postOnConfig.systemPrompts,
|
|
@@ -1330,9 +1321,6 @@ class TextEngine {
|
|
|
1330
1321
|
messages: this.messages,
|
|
1331
1322
|
systemPrompts: [...this.systemPrompts],
|
|
1332
1323
|
tools: [...this.tools],
|
|
1333
|
-
temperature: this.params.temperature,
|
|
1334
|
-
topP: this.params.topP,
|
|
1335
|
-
maxTokens: this.params.maxTokens,
|
|
1336
1324
|
metadata: this.params.metadata,
|
|
1337
1325
|
modelOptions: this.params.modelOptions
|
|
1338
1326
|
};
|
|
@@ -1343,9 +1331,6 @@ class TextEngine {
|
|
|
1343
1331
|
this.tools = config.tools;
|
|
1344
1332
|
this.params = {
|
|
1345
1333
|
...this.params,
|
|
1346
|
-
temperature: config.temperature,
|
|
1347
|
-
topP: config.topP,
|
|
1348
|
-
maxTokens: config.maxTokens,
|
|
1349
1334
|
metadata: config.metadata,
|
|
1350
1335
|
modelOptions: config.modelOptions
|
|
1351
1336
|
};
|