@telemai/sdk 0.2.1 → 0.2.3

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 CHANGED
@@ -59,7 +59,7 @@ var TimeoutError = class extends TelemError {
59
59
  };
60
60
 
61
61
  // src/version.ts
62
- var VERSION = "0.2.1";
62
+ var VERSION = "0.2.3";
63
63
 
64
64
  // src/config.ts
65
65
  var DEFAULT_BASE_URL = "https://router.telem.ai";
@@ -594,7 +594,7 @@ function searchBlock(defaults, options) {
594
594
  if (options.rerank !== void 0) block.rerank = options.rerank;
595
595
  if (includeFullContent !== void 0) block.include_full_content = includeFullContent;
596
596
  const autoRouting = options.autoRouting ?? defaults.autoRouting;
597
- if (autoRouting !== void 0) block.auto_routing = autoRouting;
597
+ if (autoRouting !== void 0 && autoRouting.toLowerCase() !== "off") block.auto_routing = autoRouting;
598
598
  const maxRoutingProviders = options.maxRoutingProviders ?? defaults.maxRoutingProviders;
599
599
  if (maxRoutingProviders !== void 0) block.max_routing_providers = maxRoutingProviders;
600
600
  const topic = options.topic ?? defaults.topic;
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-RYY4S5LP.js";
23
23
 
24
24
  // src/version.ts
25
- var VERSION = "0.2.1";
25
+ var VERSION = "0.2.3";
26
26
 
27
27
  // src/config.ts
28
28
  var DEFAULT_BASE_URL = "https://router.telem.ai";
@@ -229,7 +229,7 @@ function searchBlock(defaults, options) {
229
229
  if (options.rerank !== void 0) block.rerank = options.rerank;
230
230
  if (includeFullContent !== void 0) block.include_full_content = includeFullContent;
231
231
  const autoRouting = options.autoRouting ?? defaults.autoRouting;
232
- if (autoRouting !== void 0) block.auto_routing = autoRouting;
232
+ if (autoRouting !== void 0 && autoRouting.toLowerCase() !== "off") block.auto_routing = autoRouting;
233
233
  const maxRoutingProviders = options.maxRoutingProviders ?? defaults.maxRoutingProviders;
234
234
  if (maxRoutingProviders !== void 0) block.max_routing_providers = maxRoutingProviders;
235
235
  const topic = options.topic ?? defaults.topic;
@@ -473,6 +473,10 @@ var SEARCH_SCHEMA = (0, import_ai.jsonSchema)({
473
473
  context: {
474
474
  type: "string",
475
475
  description: "Two or three sentences of your reasoning: what you want to find out and why, given what you already know. Not a restatement of the query."
476
+ },
477
+ topic: {
478
+ type: "string",
479
+ description: "Optional. Set it only when the answer must come from one site: linkedin, reddit, or x (twitter is also accepted). Leave it unset otherwise."
476
480
  }
477
481
  },
478
482
  required: ["query"],
@@ -563,7 +567,7 @@ function createTelemVercelAgent(options) {
563
567
  const opts = { ...searchOptions ?? {}, signal: signalFor(execution, searchOptions?.signal) };
564
568
  const { envelope, plan } = await lineage(execution, {
565
569
  name: SEARCH_TOOL,
566
- input: { query, goal: opts.goal, context: opts.context }
570
+ input: { query, goal: opts.goal, context: opts.context, topic: opts.topic }
567
571
  });
568
572
  const response = await state.sendWithOmissionRetry(
569
573
  plan,
@@ -622,7 +626,12 @@ function createTelemVercelAgent(options) {
622
626
  telem_search: {
623
627
  description: "Search the public web. One query per call; returns the top results with provider, title, url and summary. Use telem_fetch to read a page in full.",
624
628
  inputSchema: SEARCH_SCHEMA,
625
- execute: async (input, execution) => renderSearch(await search(input.query, { goal: input.goal, context: input.context }, execution))
629
+ execute: async (input, execution) => {
630
+ const topic = input.topic?.trim() || void 0;
631
+ return renderSearch(
632
+ await search(input.query, { goal: input.goal, context: input.context, topic }, execution)
633
+ );
634
+ }
626
635
  },
627
636
  telem_fetch: {
628
637
  description: "Read the text of one web page by URL. telem_search returns snippets; this returns the page.",
@@ -141,6 +141,7 @@ type TelemVercelSearchInput = {
141
141
  query: string;
142
142
  goal?: string;
143
143
  context?: string;
144
+ topic?: string;
144
145
  };
145
146
  type TelemVercelFetchInput = {
146
147
  url: string;
@@ -141,6 +141,7 @@ type TelemVercelSearchInput = {
141
141
  query: string;
142
142
  goal?: string;
143
143
  context?: string;
144
+ topic?: string;
144
145
  };
145
146
  type TelemVercelFetchInput = {
146
147
  url: string;
@@ -311,6 +311,10 @@ var SEARCH_SCHEMA = jsonSchema({
311
311
  context: {
312
312
  type: "string",
313
313
  description: "Two or three sentences of your reasoning: what you want to find out and why, given what you already know. Not a restatement of the query."
314
+ },
315
+ topic: {
316
+ type: "string",
317
+ description: "Optional. Set it only when the answer must come from one site: linkedin, reddit, or x (twitter is also accepted). Leave it unset otherwise."
314
318
  }
315
319
  },
316
320
  required: ["query"],
@@ -401,7 +405,7 @@ function createTelemVercelAgent(options) {
401
405
  const opts = { ...searchOptions ?? {}, signal: signalFor(execution, searchOptions?.signal) };
402
406
  const { envelope, plan } = await lineage(execution, {
403
407
  name: SEARCH_TOOL,
404
- input: { query, goal: opts.goal, context: opts.context }
408
+ input: { query, goal: opts.goal, context: opts.context, topic: opts.topic }
405
409
  });
406
410
  const response = await state.sendWithOmissionRetry(
407
411
  plan,
@@ -460,7 +464,12 @@ function createTelemVercelAgent(options) {
460
464
  telem_search: {
461
465
  description: "Search the public web. One query per call; returns the top results with provider, title, url and summary. Use telem_fetch to read a page in full.",
462
466
  inputSchema: SEARCH_SCHEMA,
463
- execute: async (input, execution) => renderSearch(await search(input.query, { goal: input.goal, context: input.context }, execution))
467
+ execute: async (input, execution) => {
468
+ const topic = input.topic?.trim() || void 0;
469
+ return renderSearch(
470
+ await search(input.query, { goal: input.goal, context: input.context, topic }, execution)
471
+ );
472
+ }
464
473
  },
465
474
  telem_fetch: {
466
475
  description: "Read the text of one web page by URL. telem_search returns snippets; this returns the page.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telemai/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Telem web search and fetch for JavaScript and TypeScript.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",