@tangle-network/tcloud 0.4.9 → 0.4.11
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/README.md +34 -0
- package/dist/{chunk-27OTTDMZ.js → chunk-IWDE7ZPN.js} +2 -2
- package/dist/{chunk-YWN4JOCW.js → chunk-THOMQXU5.js} +1 -1
- package/dist/{chunk-CVWEKCQ3.js → chunk-U4VOGRVW.js} +23 -1
- package/dist/cli.cjs +52 -1
- package/dist/cli.js +32 -3
- package/dist/{client-CF-tpVsi.d.ts → client-CaD5Oal0.d.cts} +71 -1
- package/dist/{client-CF-tpVsi.d.cts → client-CaD5Oal0.d.ts} +71 -1
- package/dist/index.cjs +23 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/instance.cjs +23 -1
- package/dist/instance.d.cts +1 -1
- package/dist/instance.d.ts +1 -1
- package/dist/instance.js +1 -1
- package/dist/shielded.cjs +23 -1
- package/dist/shielded.d.cts +1 -1
- package/dist/shielded.d.ts +1 -1
- package/dist/shielded.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ Zero framework dependencies. Pure `fetch` + SSE. Works in Node.js, Deno, Bun, an
|
|
|
14
14
|
- [Full Chat Completion](#full-chat-completion)
|
|
15
15
|
- [Private Inference](#private-inference)
|
|
16
16
|
- [Embeddings](#embeddings)
|
|
17
|
+
- [Web Search](#web-search)
|
|
17
18
|
- [Video & Avatar Generation](#video--avatar-generation)
|
|
18
19
|
- [Async Jobs](#async-jobs)
|
|
19
20
|
- [Operator Routing](#operator-routing)
|
|
@@ -177,6 +178,32 @@ const response = await client.embeddings({
|
|
|
177
178
|
console.log(response.data[0].embedding.length) // 1536
|
|
178
179
|
```
|
|
179
180
|
|
|
181
|
+
### Web Search
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
const results = await client.search({
|
|
185
|
+
query: 'latest Tangle docs',
|
|
186
|
+
provider: 'exa',
|
|
187
|
+
maxResults: 5,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
console.log(results.data[0].title)
|
|
191
|
+
console.log(results.citations)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Use search inside chat with either the typed gateway shorthand or OpenRouter-compatible plugins:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
await client.ask('What changed in Tangle this week?', {
|
|
198
|
+
webSearch: { provider: 'exa', maxResults: 5, searchRecency: 'week' },
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
await client.chat({
|
|
202
|
+
messages: [{ role: 'user', content: 'Summarize recent AI video model releases.' }],
|
|
203
|
+
plugins: [{ id: 'web', engine: 'parallel', max_results: 5 }],
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
180
207
|
### Video & Avatar Generation
|
|
181
208
|
|
|
182
209
|
```ts
|
|
@@ -345,6 +372,7 @@ tcloud chat # Interactive mode
|
|
|
345
372
|
```bash
|
|
346
373
|
tcloud models # List available models
|
|
347
374
|
tcloud models -s llama # Search models
|
|
375
|
+
tcloud search "Tangle docs" --provider exa --max-results 5
|
|
348
376
|
tcloud operators # List active operators
|
|
349
377
|
```
|
|
350
378
|
|
|
@@ -437,6 +465,12 @@ See the [`examples/`](./examples/) directory — each is a self-contained script
|
|
|
437
465
|
| 08 | [OpenAI SDK](./examples/08-openai-compat.ts) | Drop-in replacement via baseURL |
|
|
438
466
|
| 09 | [Vercel AI SDK](./examples/09-vercel-ai-sdk.ts) | generateText + streamText with Tangle |
|
|
439
467
|
| 10 | [Spending Limits](./examples/10-spending-limits.ts) | Budget caps, request limits, warning callbacks |
|
|
468
|
+
| 11 | [Inference Strategies](./examples/11-inference-strategies.ts) | Min-exposure + operator rotation patterns |
|
|
469
|
+
| 12 | [Bridge Sessions](./examples/12-bridge-sessions.ts) | Persistent bridge sessions for harness routing |
|
|
470
|
+
| 13 | [Bridge Chat App](./examples/13-bridge-chat-app.ts) | Multi-turn bridge application |
|
|
471
|
+
| 14 | [Direct cli-bridge](./examples/14-direct-cli-bridge.ts) | Local cli-bridge, no router |
|
|
472
|
+
| 15 | [Sandbox Agents](./examples/15-sandbox-agents.ts) | Sandbox agents + inline AgentProfile |
|
|
473
|
+
| 16 | [Tangle Intelligence Hook](./examples/16-tangle-intelligence-hook.ts) | Trace inference into hosted intelligence (one OTLP block) |
|
|
440
474
|
|
|
441
475
|
Run any example:
|
|
442
476
|
```bash
|
|
@@ -289,6 +289,8 @@ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
289
289
|
"tools",
|
|
290
290
|
"tool_choice",
|
|
291
291
|
"toolChoice",
|
|
292
|
+
"plugins",
|
|
293
|
+
"webSearch",
|
|
292
294
|
"gateway",
|
|
293
295
|
"bridge",
|
|
294
296
|
"agent_profile",
|
|
@@ -647,6 +649,10 @@ var TCloudClient = class _TCloudClient {
|
|
|
647
649
|
/** Build the chat completions request body */
|
|
648
650
|
_chatBody(options, stream) {
|
|
649
651
|
const providerOptions = sanitizeProviderOptions(options.providerOptions);
|
|
652
|
+
const gateway = options.gateway || options.webSearch !== void 0 ? {
|
|
653
|
+
...options.gateway,
|
|
654
|
+
...options.webSearch !== void 0 && options.gateway?.webSearch === void 0 ? { webSearch: options.webSearch } : {}
|
|
655
|
+
} : void 0;
|
|
650
656
|
const sandboxBody = {};
|
|
651
657
|
if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
|
|
652
658
|
if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
|
|
@@ -667,7 +673,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
667
673
|
response_format: options.responseFormat,
|
|
668
674
|
tools: options.tools,
|
|
669
675
|
tool_choice: options.toolChoice,
|
|
670
|
-
|
|
676
|
+
plugins: options.plugins,
|
|
677
|
+
...gateway ? { gateway } : {},
|
|
671
678
|
...sandboxBody
|
|
672
679
|
});
|
|
673
680
|
}
|
|
@@ -976,6 +983,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
976
983
|
})
|
|
977
984
|
});
|
|
978
985
|
}
|
|
986
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
987
|
+
async search(options) {
|
|
988
|
+
return this._request(`${this.baseURL}/search`, {
|
|
989
|
+
method: "POST",
|
|
990
|
+
body: JSON.stringify({
|
|
991
|
+
query: options.query,
|
|
992
|
+
provider: options.provider,
|
|
993
|
+
model: options.model,
|
|
994
|
+
maxResults: options.maxResults,
|
|
995
|
+
searchRecency: options.searchRecency,
|
|
996
|
+
includeDomains: options.includeDomains,
|
|
997
|
+
excludeDomains: options.excludeDomains
|
|
998
|
+
})
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
979
1001
|
/** Text-to-speech */
|
|
980
1002
|
async speech(options) {
|
|
981
1003
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
package/dist/cli.cjs
CHANGED
|
@@ -317,6 +317,8 @@ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
317
317
|
"tools",
|
|
318
318
|
"tool_choice",
|
|
319
319
|
"toolChoice",
|
|
320
|
+
"plugins",
|
|
321
|
+
"webSearch",
|
|
320
322
|
"gateway",
|
|
321
323
|
"bridge",
|
|
322
324
|
"agent_profile",
|
|
@@ -675,6 +677,10 @@ var TCloudClient = class _TCloudClient {
|
|
|
675
677
|
/** Build the chat completions request body */
|
|
676
678
|
_chatBody(options, stream) {
|
|
677
679
|
const providerOptions = sanitizeProviderOptions(options.providerOptions);
|
|
680
|
+
const gateway = options.gateway || options.webSearch !== void 0 ? {
|
|
681
|
+
...options.gateway,
|
|
682
|
+
...options.webSearch !== void 0 && options.gateway?.webSearch === void 0 ? { webSearch: options.webSearch } : {}
|
|
683
|
+
} : void 0;
|
|
678
684
|
const sandboxBody = {};
|
|
679
685
|
if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
|
|
680
686
|
if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
|
|
@@ -695,7 +701,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
695
701
|
response_format: options.responseFormat,
|
|
696
702
|
tools: options.tools,
|
|
697
703
|
tool_choice: options.toolChoice,
|
|
698
|
-
|
|
704
|
+
plugins: options.plugins,
|
|
705
|
+
...gateway ? { gateway } : {},
|
|
699
706
|
...sandboxBody
|
|
700
707
|
});
|
|
701
708
|
}
|
|
@@ -1004,6 +1011,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
1004
1011
|
})
|
|
1005
1012
|
});
|
|
1006
1013
|
}
|
|
1014
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1015
|
+
async search(options) {
|
|
1016
|
+
return this._request(`${this.baseURL}/search`, {
|
|
1017
|
+
method: "POST",
|
|
1018
|
+
body: JSON.stringify({
|
|
1019
|
+
query: options.query,
|
|
1020
|
+
provider: options.provider,
|
|
1021
|
+
model: options.model,
|
|
1022
|
+
maxResults: options.maxResults,
|
|
1023
|
+
searchRecency: options.searchRecency,
|
|
1024
|
+
includeDomains: options.includeDomains,
|
|
1025
|
+
excludeDomains: options.excludeDomains
|
|
1026
|
+
})
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1007
1029
|
/** Text-to-speech */
|
|
1008
1030
|
async speech(options) {
|
|
1009
1031
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
|
@@ -2330,6 +2352,35 @@ program.command("models").description("List available models").option("-s, --sea
|
|
|
2330
2352
|
console.error("Error:", e.message);
|
|
2331
2353
|
}
|
|
2332
2354
|
});
|
|
2355
|
+
program.command("search").description("Search the web").argument("<query>", "Search query").option("--provider <provider>", "Search provider: perplexity, exa, you, parallel, tavily, brave").option("-n, --max-results <n>", "Maximum results").option("--recency <period>", "day, week, month, or year").option("--include-domain <domain...>", "Restrict to domains").option("--exclude-domain <domain...>", "Exclude domains").option("--json", "Print raw JSON response").action(async (query, opts) => {
|
|
2356
|
+
const client = getClient();
|
|
2357
|
+
try {
|
|
2358
|
+
const resp = await client.search({
|
|
2359
|
+
query,
|
|
2360
|
+
provider: opts.provider,
|
|
2361
|
+
maxResults: optionalNumber(opts.maxResults),
|
|
2362
|
+
searchRecency: opts.recency,
|
|
2363
|
+
includeDomains: opts.includeDomain,
|
|
2364
|
+
excludeDomains: opts.excludeDomain
|
|
2365
|
+
});
|
|
2366
|
+
if (opts.json) {
|
|
2367
|
+
printJson(resp);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
console.log(`${resp.provider} results for "${resp.query}":`);
|
|
2371
|
+
resp.data.forEach((hit, index) => {
|
|
2372
|
+
console.log(`${index + 1}. ${hit.title}`);
|
|
2373
|
+
console.log(` ${hit.url}`);
|
|
2374
|
+
if (hit.snippet) console.log(` ${hit.snippet}`);
|
|
2375
|
+
});
|
|
2376
|
+
if (resp.usage?.billed_cost != null) {
|
|
2377
|
+
console.log(` \u21B3 $${resp.usage.billed_cost.toFixed(6)} billed`);
|
|
2378
|
+
}
|
|
2379
|
+
} catch (e) {
|
|
2380
|
+
console.error("Error:", e.message);
|
|
2381
|
+
process.exit(1);
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2333
2384
|
program.command("image-generate").description("Generate an image").requiredOption("-p, --prompt <prompt>", "Prompt").option("-m, --model <model>", "Image model").option("--size <size>", "Output size").option("--quality <quality>", "Output quality").option("-n, --count <n>", "Number of images").option("--response-format <format>", "url or b64_json").option("--json", "Print raw JSON response").action(async (opts) => {
|
|
2334
2385
|
const client = getClient();
|
|
2335
2386
|
try {
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
TCloud
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IWDE7ZPN.js";
|
|
5
5
|
import {
|
|
6
6
|
TCloudSandbox
|
|
7
7
|
} from "./chunk-DRCOPW7D.js";
|
|
8
8
|
import {
|
|
9
9
|
generateWallet
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-THOMQXU5.js";
|
|
11
|
+
import "./chunk-U4VOGRVW.js";
|
|
12
12
|
|
|
13
13
|
// src/cli.ts
|
|
14
14
|
import { Command } from "commander";
|
|
@@ -357,6 +357,35 @@ program.command("models").description("List available models").option("-s, --sea
|
|
|
357
357
|
console.error("Error:", e.message);
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
+
program.command("search").description("Search the web").argument("<query>", "Search query").option("--provider <provider>", "Search provider: perplexity, exa, you, parallel, tavily, brave").option("-n, --max-results <n>", "Maximum results").option("--recency <period>", "day, week, month, or year").option("--include-domain <domain...>", "Restrict to domains").option("--exclude-domain <domain...>", "Exclude domains").option("--json", "Print raw JSON response").action(async (query, opts) => {
|
|
361
|
+
const client = getClient();
|
|
362
|
+
try {
|
|
363
|
+
const resp = await client.search({
|
|
364
|
+
query,
|
|
365
|
+
provider: opts.provider,
|
|
366
|
+
maxResults: optionalNumber(opts.maxResults),
|
|
367
|
+
searchRecency: opts.recency,
|
|
368
|
+
includeDomains: opts.includeDomain,
|
|
369
|
+
excludeDomains: opts.excludeDomain
|
|
370
|
+
});
|
|
371
|
+
if (opts.json) {
|
|
372
|
+
printJson(resp);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
console.log(`${resp.provider} results for "${resp.query}":`);
|
|
376
|
+
resp.data.forEach((hit, index) => {
|
|
377
|
+
console.log(`${index + 1}. ${hit.title}`);
|
|
378
|
+
console.log(` ${hit.url}`);
|
|
379
|
+
if (hit.snippet) console.log(` ${hit.snippet}`);
|
|
380
|
+
});
|
|
381
|
+
if (resp.usage?.billed_cost != null) {
|
|
382
|
+
console.log(` \u21B3 $${resp.usage.billed_cost.toFixed(6)} billed`);
|
|
383
|
+
}
|
|
384
|
+
} catch (e) {
|
|
385
|
+
console.error("Error:", e.message);
|
|
386
|
+
process.exit(1);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
360
389
|
program.command("image-generate").description("Generate an image").requiredOption("-p, --prompt <prompt>", "Prompt").option("-m, --model <model>", "Image model").option("--size <size>", "Output size").option("--quality <quality>", "Output quality").option("-n, --count <n>", "Number of images").option("--response-format <format>", "url or b64_json").option("--json", "Print raw JSON response").action(async (opts) => {
|
|
361
390
|
const client = getClient();
|
|
362
391
|
try {
|
|
@@ -150,6 +150,60 @@ interface RerankResponse {
|
|
|
150
150
|
relevance_score: number;
|
|
151
151
|
}[];
|
|
152
152
|
}
|
|
153
|
+
type SearchProvider = 'perplexity' | 'exa' | 'you' | 'parallel' | 'tavily' | 'brave';
|
|
154
|
+
type SearchRecency = 'day' | 'week' | 'month' | 'year';
|
|
155
|
+
interface SearchOptions {
|
|
156
|
+
query: string;
|
|
157
|
+
provider?: SearchProvider;
|
|
158
|
+
/** Alias accepted by the Router for provider-compatible clients. */
|
|
159
|
+
model?: SearchProvider;
|
|
160
|
+
maxResults?: number;
|
|
161
|
+
searchRecency?: SearchRecency;
|
|
162
|
+
includeDomains?: string[];
|
|
163
|
+
excludeDomains?: string[];
|
|
164
|
+
}
|
|
165
|
+
interface SearchHit {
|
|
166
|
+
title: string;
|
|
167
|
+
url: string;
|
|
168
|
+
snippet?: string;
|
|
169
|
+
publishedAt?: string;
|
|
170
|
+
score?: number;
|
|
171
|
+
source?: string;
|
|
172
|
+
}
|
|
173
|
+
interface SearchResponse {
|
|
174
|
+
id: string;
|
|
175
|
+
object: 'search.result' | string;
|
|
176
|
+
provider: SearchProvider;
|
|
177
|
+
model: string;
|
|
178
|
+
query: string;
|
|
179
|
+
data: SearchHit[];
|
|
180
|
+
citations: string[];
|
|
181
|
+
usage?: {
|
|
182
|
+
upstream_cost?: number;
|
|
183
|
+
billed_cost?: number;
|
|
184
|
+
gross_margin?: number;
|
|
185
|
+
markup?: number;
|
|
186
|
+
billing_units?: Record<string, unknown>;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
interface WebSearchPlugin {
|
|
190
|
+
id: 'web';
|
|
191
|
+
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
192
|
+
provider?: SearchProvider;
|
|
193
|
+
maxResults?: number;
|
|
194
|
+
max_results?: number;
|
|
195
|
+
searchPrompt?: string;
|
|
196
|
+
search_prompt?: string;
|
|
197
|
+
includeDomains?: string[];
|
|
198
|
+
include_domains?: string[];
|
|
199
|
+
excludeDomains?: string[];
|
|
200
|
+
exclude_domains?: string[];
|
|
201
|
+
searchRecency?: SearchRecency;
|
|
202
|
+
search_recency?: SearchRecency;
|
|
203
|
+
}
|
|
204
|
+
type ChatPlugin = WebSearchPlugin | ({
|
|
205
|
+
id: string;
|
|
206
|
+
} & Record<string, unknown>);
|
|
153
207
|
interface CompletionOptions {
|
|
154
208
|
model?: string;
|
|
155
209
|
prompt: string;
|
|
@@ -331,6 +385,16 @@ interface GatewayOptions {
|
|
|
331
385
|
optimize?: 'cost' | 'latency' | 'quality';
|
|
332
386
|
/** Disable response cache for this request. */
|
|
333
387
|
cache?: boolean;
|
|
388
|
+
/** Enable or configure router-managed web search for chat completions. */
|
|
389
|
+
webSearch?: boolean | {
|
|
390
|
+
provider?: SearchProvider;
|
|
391
|
+
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
392
|
+
maxResults?: number;
|
|
393
|
+
searchPrompt?: string;
|
|
394
|
+
includeDomains?: string[];
|
|
395
|
+
excludeDomains?: string[];
|
|
396
|
+
searchRecency?: SearchRecency;
|
|
397
|
+
};
|
|
334
398
|
/**
|
|
335
399
|
* RSA / MoA: population-based quality amplification.
|
|
336
400
|
* Spawns N parallel calls, aggregates K at a time, refines over T rounds.
|
|
@@ -430,6 +494,10 @@ interface ChatOptions {
|
|
|
430
494
|
name: string;
|
|
431
495
|
};
|
|
432
496
|
};
|
|
497
|
+
/** OpenRouter-compatible plugins, e.g. `[{ id: 'web', max_results: 5 }]`. */
|
|
498
|
+
plugins?: ChatPlugin[];
|
|
499
|
+
/** Shorthand for `gateway.webSearch`; explicit `gateway.webSearch` wins when both are set. */
|
|
500
|
+
webSearch?: GatewayOptions['webSearch'];
|
|
433
501
|
/**
|
|
434
502
|
* Gateway options: routing, compliance, inference strategies (RSA/MoA/Best-of-N).
|
|
435
503
|
* Sent as `body.gateway` to the Router.
|
|
@@ -969,6 +1037,8 @@ declare class TCloudClient {
|
|
|
969
1037
|
imagesEdit(options: ImageEditOptions): Promise<ImageResponse>;
|
|
970
1038
|
/** Rerank documents by relevance to a query */
|
|
971
1039
|
rerank(options: RerankOptions): Promise<RerankResponse>;
|
|
1040
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1041
|
+
search(options: SearchOptions): Promise<SearchResponse>;
|
|
972
1042
|
/** Text-to-speech */
|
|
973
1043
|
speech(options: {
|
|
974
1044
|
model?: string;
|
|
@@ -1286,4 +1356,4 @@ declare class TCloudError extends Error {
|
|
|
1286
1356
|
constructor(status: number, message: string);
|
|
1287
1357
|
}
|
|
1288
1358
|
|
|
1289
|
-
export { type
|
|
1359
|
+
export { type SpendAuth as $, type ApiKeyInfo as A, type BatchJobResponse as B, type ChatCompletion as C, type RerankOptions as D, type EmbeddingOptions as E, type FineTuningJob as F, type GatewayOptions as G, type RerankResponse as H, type ImageEditAttachment as I, type JobEvent as J, type RetryConfig as K, type RotatingRoutingConfig as L, type Model as M, type RotationStats as N, type Operator as O, type PricingTier as P, type RoutingConfig as Q, type RotatingClientConfig as R, type RoutingStrategy as S, TCloudClient as T, type SandboxChatOptions as U, type SearchHit as V, type SearchOptions as W, type SearchProvider as X, type SearchRecency as Y, type SearchResponse as Z, type ShieldedConfig as _, type TCloudConfig as a, type SpendingLimits as a0, TCloudError as a1, type TierConfig as a2, type TranscriptionResponse as a3, type UpdateKeyOptions as a4, type VideoGenerateOptions as a5, type VideoResponse as a6, type WatchJobOptions as a7, type WebSearchPlugin as a8, type AvatarGenerateRequest as b, type AvatarGenerateResponse as c, type AvatarJobStatus as d, type AvatarResult as e, type BatchRequest as f, type BridgeOptions as g, BridgeSession as h, type ChatCompletionChunk as i, type ChatMessage as j, type ChatOptions as k, type ChatPlugin as l, type CompletionOptions as m, type CompletionResponse as n, type CreateKeyOptions as o, type CreatedKey as p, type CreditBalance as q, type EmbeddingResponse as r, type FineTuningJobOptions as s, type ImageEditOptions as t, type ImageGenerateOptions as u, type ImageResponse as v, type OperatorInfo as w, type PrivacyConfig as x, PrivateRouter as y, type PrivateRouterConfig as z };
|
|
@@ -150,6 +150,60 @@ interface RerankResponse {
|
|
|
150
150
|
relevance_score: number;
|
|
151
151
|
}[];
|
|
152
152
|
}
|
|
153
|
+
type SearchProvider = 'perplexity' | 'exa' | 'you' | 'parallel' | 'tavily' | 'brave';
|
|
154
|
+
type SearchRecency = 'day' | 'week' | 'month' | 'year';
|
|
155
|
+
interface SearchOptions {
|
|
156
|
+
query: string;
|
|
157
|
+
provider?: SearchProvider;
|
|
158
|
+
/** Alias accepted by the Router for provider-compatible clients. */
|
|
159
|
+
model?: SearchProvider;
|
|
160
|
+
maxResults?: number;
|
|
161
|
+
searchRecency?: SearchRecency;
|
|
162
|
+
includeDomains?: string[];
|
|
163
|
+
excludeDomains?: string[];
|
|
164
|
+
}
|
|
165
|
+
interface SearchHit {
|
|
166
|
+
title: string;
|
|
167
|
+
url: string;
|
|
168
|
+
snippet?: string;
|
|
169
|
+
publishedAt?: string;
|
|
170
|
+
score?: number;
|
|
171
|
+
source?: string;
|
|
172
|
+
}
|
|
173
|
+
interface SearchResponse {
|
|
174
|
+
id: string;
|
|
175
|
+
object: 'search.result' | string;
|
|
176
|
+
provider: SearchProvider;
|
|
177
|
+
model: string;
|
|
178
|
+
query: string;
|
|
179
|
+
data: SearchHit[];
|
|
180
|
+
citations: string[];
|
|
181
|
+
usage?: {
|
|
182
|
+
upstream_cost?: number;
|
|
183
|
+
billed_cost?: number;
|
|
184
|
+
gross_margin?: number;
|
|
185
|
+
markup?: number;
|
|
186
|
+
billing_units?: Record<string, unknown>;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
interface WebSearchPlugin {
|
|
190
|
+
id: 'web';
|
|
191
|
+
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
192
|
+
provider?: SearchProvider;
|
|
193
|
+
maxResults?: number;
|
|
194
|
+
max_results?: number;
|
|
195
|
+
searchPrompt?: string;
|
|
196
|
+
search_prompt?: string;
|
|
197
|
+
includeDomains?: string[];
|
|
198
|
+
include_domains?: string[];
|
|
199
|
+
excludeDomains?: string[];
|
|
200
|
+
exclude_domains?: string[];
|
|
201
|
+
searchRecency?: SearchRecency;
|
|
202
|
+
search_recency?: SearchRecency;
|
|
203
|
+
}
|
|
204
|
+
type ChatPlugin = WebSearchPlugin | ({
|
|
205
|
+
id: string;
|
|
206
|
+
} & Record<string, unknown>);
|
|
153
207
|
interface CompletionOptions {
|
|
154
208
|
model?: string;
|
|
155
209
|
prompt: string;
|
|
@@ -331,6 +385,16 @@ interface GatewayOptions {
|
|
|
331
385
|
optimize?: 'cost' | 'latency' | 'quality';
|
|
332
386
|
/** Disable response cache for this request. */
|
|
333
387
|
cache?: boolean;
|
|
388
|
+
/** Enable or configure router-managed web search for chat completions. */
|
|
389
|
+
webSearch?: boolean | {
|
|
390
|
+
provider?: SearchProvider;
|
|
391
|
+
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
392
|
+
maxResults?: number;
|
|
393
|
+
searchPrompt?: string;
|
|
394
|
+
includeDomains?: string[];
|
|
395
|
+
excludeDomains?: string[];
|
|
396
|
+
searchRecency?: SearchRecency;
|
|
397
|
+
};
|
|
334
398
|
/**
|
|
335
399
|
* RSA / MoA: population-based quality amplification.
|
|
336
400
|
* Spawns N parallel calls, aggregates K at a time, refines over T rounds.
|
|
@@ -430,6 +494,10 @@ interface ChatOptions {
|
|
|
430
494
|
name: string;
|
|
431
495
|
};
|
|
432
496
|
};
|
|
497
|
+
/** OpenRouter-compatible plugins, e.g. `[{ id: 'web', max_results: 5 }]`. */
|
|
498
|
+
plugins?: ChatPlugin[];
|
|
499
|
+
/** Shorthand for `gateway.webSearch`; explicit `gateway.webSearch` wins when both are set. */
|
|
500
|
+
webSearch?: GatewayOptions['webSearch'];
|
|
433
501
|
/**
|
|
434
502
|
* Gateway options: routing, compliance, inference strategies (RSA/MoA/Best-of-N).
|
|
435
503
|
* Sent as `body.gateway` to the Router.
|
|
@@ -969,6 +1037,8 @@ declare class TCloudClient {
|
|
|
969
1037
|
imagesEdit(options: ImageEditOptions): Promise<ImageResponse>;
|
|
970
1038
|
/** Rerank documents by relevance to a query */
|
|
971
1039
|
rerank(options: RerankOptions): Promise<RerankResponse>;
|
|
1040
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1041
|
+
search(options: SearchOptions): Promise<SearchResponse>;
|
|
972
1042
|
/** Text-to-speech */
|
|
973
1043
|
speech(options: {
|
|
974
1044
|
model?: string;
|
|
@@ -1286,4 +1356,4 @@ declare class TCloudError extends Error {
|
|
|
1286
1356
|
constructor(status: number, message: string);
|
|
1287
1357
|
}
|
|
1288
1358
|
|
|
1289
|
-
export { type
|
|
1359
|
+
export { type SpendAuth as $, type ApiKeyInfo as A, type BatchJobResponse as B, type ChatCompletion as C, type RerankOptions as D, type EmbeddingOptions as E, type FineTuningJob as F, type GatewayOptions as G, type RerankResponse as H, type ImageEditAttachment as I, type JobEvent as J, type RetryConfig as K, type RotatingRoutingConfig as L, type Model as M, type RotationStats as N, type Operator as O, type PricingTier as P, type RoutingConfig as Q, type RotatingClientConfig as R, type RoutingStrategy as S, TCloudClient as T, type SandboxChatOptions as U, type SearchHit as V, type SearchOptions as W, type SearchProvider as X, type SearchRecency as Y, type SearchResponse as Z, type ShieldedConfig as _, type TCloudConfig as a, type SpendingLimits as a0, TCloudError as a1, type TierConfig as a2, type TranscriptionResponse as a3, type UpdateKeyOptions as a4, type VideoGenerateOptions as a5, type VideoResponse as a6, type WatchJobOptions as a7, type WebSearchPlugin as a8, type AvatarGenerateRequest as b, type AvatarGenerateResponse as c, type AvatarJobStatus as d, type AvatarResult as e, type BatchRequest as f, type BridgeOptions as g, BridgeSession as h, type ChatCompletionChunk as i, type ChatMessage as j, type ChatOptions as k, type ChatPlugin as l, type CompletionOptions as m, type CompletionResponse as n, type CreateKeyOptions as o, type CreatedKey as p, type CreditBalance as q, type EmbeddingResponse as r, type FineTuningJobOptions as s, type ImageEditOptions as t, type ImageGenerateOptions as u, type ImageResponse as v, type OperatorInfo as w, type PrivacyConfig as x, PrivateRouter as y, type PrivateRouterConfig as z };
|
package/dist/index.cjs
CHANGED
|
@@ -348,6 +348,8 @@ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
348
348
|
"tools",
|
|
349
349
|
"tool_choice",
|
|
350
350
|
"toolChoice",
|
|
351
|
+
"plugins",
|
|
352
|
+
"webSearch",
|
|
351
353
|
"gateway",
|
|
352
354
|
"bridge",
|
|
353
355
|
"agent_profile",
|
|
@@ -706,6 +708,10 @@ var TCloudClient = class _TCloudClient {
|
|
|
706
708
|
/** Build the chat completions request body */
|
|
707
709
|
_chatBody(options, stream) {
|
|
708
710
|
const providerOptions = sanitizeProviderOptions(options.providerOptions);
|
|
711
|
+
const gateway = options.gateway || options.webSearch !== void 0 ? {
|
|
712
|
+
...options.gateway,
|
|
713
|
+
...options.webSearch !== void 0 && options.gateway?.webSearch === void 0 ? { webSearch: options.webSearch } : {}
|
|
714
|
+
} : void 0;
|
|
709
715
|
const sandboxBody = {};
|
|
710
716
|
if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
|
|
711
717
|
if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
|
|
@@ -726,7 +732,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
726
732
|
response_format: options.responseFormat,
|
|
727
733
|
tools: options.tools,
|
|
728
734
|
tool_choice: options.toolChoice,
|
|
729
|
-
|
|
735
|
+
plugins: options.plugins,
|
|
736
|
+
...gateway ? { gateway } : {},
|
|
730
737
|
...sandboxBody
|
|
731
738
|
});
|
|
732
739
|
}
|
|
@@ -1035,6 +1042,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
1035
1042
|
})
|
|
1036
1043
|
});
|
|
1037
1044
|
}
|
|
1045
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1046
|
+
async search(options) {
|
|
1047
|
+
return this._request(`${this.baseURL}/search`, {
|
|
1048
|
+
method: "POST",
|
|
1049
|
+
body: JSON.stringify({
|
|
1050
|
+
query: options.query,
|
|
1051
|
+
provider: options.provider,
|
|
1052
|
+
model: options.model,
|
|
1053
|
+
maxResults: options.maxResults,
|
|
1054
|
+
searchRecency: options.searchRecency,
|
|
1055
|
+
includeDomains: options.includeDomains,
|
|
1056
|
+
excludeDomains: options.excludeDomains
|
|
1057
|
+
})
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1038
1060
|
/** Text-to-speech */
|
|
1039
1061
|
async speech(options) {
|
|
1040
1062
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ShieldedWallet, generateWallet } from './shielded.cjs';
|
|
2
2
|
export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.cjs';
|
|
3
|
-
import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-
|
|
4
|
-
export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as
|
|
3
|
+
import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-CaD5Oal0.cjs';
|
|
4
|
+
export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as RetryConfig, L as RotatingRoutingConfig, N as RotationStats, Q as RoutingConfig, S as RoutingStrategy, U as SandboxChatOptions, V as SearchHit, W as SearchOptions, X as SearchProvider, Y as SearchRecency, Z as SearchResponse, _ as ShieldedConfig, $ as SpendAuth, a0 as SpendingLimits, a1 as TCloudError, a2 as TierConfig, a3 as TranscriptionResponse, a4 as UpdateKeyOptions, a5 as VideoGenerateOptions, a6 as VideoResponse, a7 as WatchJobOptions, a8 as WebSearchPlugin } from './client-CaD5Oal0.cjs';
|
|
5
5
|
import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.cjs';
|
|
6
6
|
export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.cjs';
|
|
7
7
|
export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, NitroAttestationDocument, NitroVerifierOptions, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createNitroHardwareVerifier, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseNitroAttestationDocument, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ShieldedWallet, generateWallet } from './shielded.js';
|
|
2
2
|
export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.js';
|
|
3
|
-
import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-
|
|
4
|
-
export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as
|
|
3
|
+
import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-CaD5Oal0.js';
|
|
4
|
+
export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as RetryConfig, L as RotatingRoutingConfig, N as RotationStats, Q as RoutingConfig, S as RoutingStrategy, U as SandboxChatOptions, V as SearchHit, W as SearchOptions, X as SearchProvider, Y as SearchRecency, Z as SearchResponse, _ as ShieldedConfig, $ as SpendAuth, a0 as SpendingLimits, a1 as TCloudError, a2 as TierConfig, a3 as TranscriptionResponse, a4 as UpdateKeyOptions, a5 as VideoGenerateOptions, a6 as VideoResponse, a7 as WatchJobOptions, a8 as WebSearchPlugin } from './client-CaD5Oal0.js';
|
|
5
5
|
import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.js';
|
|
6
6
|
export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.js';
|
|
7
7
|
export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, NitroAttestationDocument, NitroVerifierOptions, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createNitroHardwareVerifier, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseNitroAttestationDocument, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
toHex,
|
|
12
12
|
verifyAttestation,
|
|
13
13
|
verifyAttestationAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IWDE7ZPN.js";
|
|
15
15
|
import {
|
|
16
16
|
TCloudSandbox,
|
|
17
17
|
createTeeAttestationChallenge,
|
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
estimateCost,
|
|
24
24
|
generateWallet,
|
|
25
25
|
signSpendAuth
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-THOMQXU5.js";
|
|
27
27
|
import {
|
|
28
28
|
BridgeSession,
|
|
29
29
|
PrivateRouter,
|
|
30
30
|
TCloudClient,
|
|
31
31
|
TCloudError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-U4VOGRVW.js";
|
|
33
33
|
export {
|
|
34
34
|
BridgeSession,
|
|
35
35
|
PrivateRouter,
|
package/dist/instance.cjs
CHANGED
|
@@ -332,6 +332,8 @@ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
332
332
|
"tools",
|
|
333
333
|
"tool_choice",
|
|
334
334
|
"toolChoice",
|
|
335
|
+
"plugins",
|
|
336
|
+
"webSearch",
|
|
335
337
|
"gateway",
|
|
336
338
|
"bridge",
|
|
337
339
|
"agent_profile",
|
|
@@ -690,6 +692,10 @@ var TCloudClient = class _TCloudClient {
|
|
|
690
692
|
/** Build the chat completions request body */
|
|
691
693
|
_chatBody(options, stream) {
|
|
692
694
|
const providerOptions = sanitizeProviderOptions(options.providerOptions);
|
|
695
|
+
const gateway = options.gateway || options.webSearch !== void 0 ? {
|
|
696
|
+
...options.gateway,
|
|
697
|
+
...options.webSearch !== void 0 && options.gateway?.webSearch === void 0 ? { webSearch: options.webSearch } : {}
|
|
698
|
+
} : void 0;
|
|
693
699
|
const sandboxBody = {};
|
|
694
700
|
if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
|
|
695
701
|
if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
|
|
@@ -710,7 +716,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
710
716
|
response_format: options.responseFormat,
|
|
711
717
|
tools: options.tools,
|
|
712
718
|
tool_choice: options.toolChoice,
|
|
713
|
-
|
|
719
|
+
plugins: options.plugins,
|
|
720
|
+
...gateway ? { gateway } : {},
|
|
714
721
|
...sandboxBody
|
|
715
722
|
});
|
|
716
723
|
}
|
|
@@ -1019,6 +1026,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
1019
1026
|
})
|
|
1020
1027
|
});
|
|
1021
1028
|
}
|
|
1029
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1030
|
+
async search(options) {
|
|
1031
|
+
return this._request(`${this.baseURL}/search`, {
|
|
1032
|
+
method: "POST",
|
|
1033
|
+
body: JSON.stringify({
|
|
1034
|
+
query: options.query,
|
|
1035
|
+
provider: options.provider,
|
|
1036
|
+
model: options.model,
|
|
1037
|
+
maxResults: options.maxResults,
|
|
1038
|
+
searchRecency: options.searchRecency,
|
|
1039
|
+
includeDomains: options.includeDomains,
|
|
1040
|
+
excludeDomains: options.excludeDomains
|
|
1041
|
+
})
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1022
1044
|
/** Text-to-speech */
|
|
1023
1045
|
async speech(options) {
|
|
1024
1046
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
package/dist/instance.d.cts
CHANGED
package/dist/instance.d.ts
CHANGED
package/dist/instance.js
CHANGED
package/dist/shielded.cjs
CHANGED
|
@@ -330,6 +330,8 @@ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
330
330
|
"tools",
|
|
331
331
|
"tool_choice",
|
|
332
332
|
"toolChoice",
|
|
333
|
+
"plugins",
|
|
334
|
+
"webSearch",
|
|
333
335
|
"gateway",
|
|
334
336
|
"bridge",
|
|
335
337
|
"agent_profile",
|
|
@@ -688,6 +690,10 @@ var TCloudClient = class _TCloudClient {
|
|
|
688
690
|
/** Build the chat completions request body */
|
|
689
691
|
_chatBody(options, stream) {
|
|
690
692
|
const providerOptions = sanitizeProviderOptions(options.providerOptions);
|
|
693
|
+
const gateway = options.gateway || options.webSearch !== void 0 ? {
|
|
694
|
+
...options.gateway,
|
|
695
|
+
...options.webSearch !== void 0 && options.gateway?.webSearch === void 0 ? { webSearch: options.webSearch } : {}
|
|
696
|
+
} : void 0;
|
|
691
697
|
const sandboxBody = {};
|
|
692
698
|
if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
|
|
693
699
|
if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
|
|
@@ -708,7 +714,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
708
714
|
response_format: options.responseFormat,
|
|
709
715
|
tools: options.tools,
|
|
710
716
|
tool_choice: options.toolChoice,
|
|
711
|
-
|
|
717
|
+
plugins: options.plugins,
|
|
718
|
+
...gateway ? { gateway } : {},
|
|
712
719
|
...sandboxBody
|
|
713
720
|
});
|
|
714
721
|
}
|
|
@@ -1017,6 +1024,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
1017
1024
|
})
|
|
1018
1025
|
});
|
|
1019
1026
|
}
|
|
1027
|
+
/** Search the web through Tangle Router billing and provider routing. */
|
|
1028
|
+
async search(options) {
|
|
1029
|
+
return this._request(`${this.baseURL}/search`, {
|
|
1030
|
+
method: "POST",
|
|
1031
|
+
body: JSON.stringify({
|
|
1032
|
+
query: options.query,
|
|
1033
|
+
provider: options.provider,
|
|
1034
|
+
model: options.model,
|
|
1035
|
+
maxResults: options.maxResults,
|
|
1036
|
+
searchRecency: options.searchRecency,
|
|
1037
|
+
includeDomains: options.includeDomains,
|
|
1038
|
+
excludeDomains: options.excludeDomains
|
|
1039
|
+
})
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1020
1042
|
/** Text-to-speech */
|
|
1021
1043
|
async speech(options) {
|
|
1022
1044
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
package/dist/shielded.d.cts
CHANGED
package/dist/shielded.d.ts
CHANGED
package/dist/shielded.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/tcloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Tangle AI Cloud — decentralized LLM inference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@scure/bip32": "^2.2.0",
|
|
73
73
|
"@scure/bip39": "^2.2.0",
|
|
74
|
-
"@tangle-network/sandbox": "^0.
|
|
74
|
+
"@tangle-network/sandbox": "^0.3.0",
|
|
75
75
|
"commander": "^14.0.3",
|
|
76
76
|
"viem": "^2.48.4",
|
|
77
77
|
"@tangle-network/tcloud-attestation": "^0.1.1"
|