@tool-bridge/server 0.21.1 → 0.22.1
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/admin.js +170 -0
- package/dist/airtable-ML2GIGCH.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
- package/dist/anthropic-6ZK24TBB.js +203 -0
- package/dist/apify-VDGYHP6W.js +248 -0
- package/dist/brave_search-TAATLZOS.js +302 -0
- package/dist/chunk-2IAI3XQM.js +302 -0
- package/dist/chunk-7ISGFRC6.js +161 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
- package/dist/chunk-HA4BGL6C.js +8429 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
- package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/chunk-UY6ANCOY.js +378 -0
- package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
- package/dist/circleci-BQ2UWXL2.js +389 -0
- package/dist/clerk-2JYWQNOI.js +1019 -0
- package/dist/cohere-6MI7AQM4.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
- package/dist/deepseek-OSPASO7O.js +210 -0
- package/dist/docker_hub-3ATQOY5L.js +933 -0
- package/dist/dropbox-LSA4GM2Y.js +1305 -0
- package/dist/dub-VZPJSPI6.js +680 -0
- package/dist/e2b-6SDYQZL2.js +278 -0
- package/dist/exa-B6EUYDVP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
- package/dist/figma-OUKSZLD5.js +777 -0
- package/dist/firehydrant-7MOYL7QH.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
- package/dist/fly-PXKY6PNH.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
- package/dist/geocodio-NSYO7TFP.js +213 -0
- package/dist/ghost-QBKKQQMF.js +338 -0
- package/dist/github-ENLSJ4CL.js +5421 -0
- package/dist/gmail-KQSDEB47.js +1887 -0
- package/dist/googlecalendar-5YCX4SZF.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
- package/dist/graphhopper-CURBVHYK.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
- package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
- package/dist/ipqualityscore-OT63L4TI.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
- package/dist/langsmith-IM5N4YAU.js +593 -0
- package/dist/lemlist-277SHUQF.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
- package/dist/logsnag-VEWRAGBG.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
- package/dist/mem0-AXS7GZGI.js +544 -0
- package/dist/memos-7TXG4ZTU.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
- package/dist/mistral_ai-YZ52RGD4.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
- package/dist/ngrok-4O4W3WZW.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
- package/dist/notion-4W4O7J7V.js +940 -0
- package/dist/open_exchange_rates-23QJXVO5.js +215 -0
- package/dist/openai-ZS7GLSLH.js +800 -0
- package/dist/opengraph_io-PMVH7OYI.js +362 -0
- package/dist/openrouter-ONRGFNB6.js +441 -0
- package/dist/outline-UCUYZZ7J.js +599 -0
- package/dist/paddle-35HTKTUL.js +454 -0
- package/dist/perplexity-NVOBYN24.js +220 -0
- package/dist/pinecone-55CJY73C.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
- package/dist/polar-SM4ZM53B.js +395 -0
- package/dist/posthog-NWCXVXNJ.js +3464 -0
- package/dist/postmark-QJV5PHUQ.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
- package/dist/readwise-AGHTQB42.js +470 -0
- package/dist/render-O4HBROCK.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
- package/dist/rootly-XGCUDW6X.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
- package/dist/semantic_scholar-3UJRLKES.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
- package/dist/shopify-LJ2EV2HH.js +610 -0
- package/dist/stripe-3LHMV55K.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
- package/dist/tavily-FBEWGH3Z.js +326 -0
- package/dist/telegram-MYYO3JND.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
- package/dist/todoist-OBWICA5Q.js +664 -0
- package/dist/trello-GUFUJRWO.js +1080 -0
- package/dist/turso-NIAK4UMS.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
- package/dist/umami-42RS2EPS.js +389 -0
- package/dist/unsplash-V7TOTETT.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
- package/dist/uptimerobot-AZC2DHOT.js +483 -0
- package/dist/v2ex-4TVRNMLS.js +667 -0
- package/dist/vercel-DPHTJ3XR.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
- package/dist/wordpress-KMPKVGUX.js +812 -0
- package/dist/workos-PKB2YR7S.js +664 -0
- package/dist/zhihu-Y4H4XYPB.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
package/dist/cohere-XCJ5AJ6B.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAuthedClient
|
|
3
|
-
} from "./chunk-XYBU3WZH.js";
|
|
4
|
-
import "./chunk-E6JCVKW6.js";
|
|
5
|
-
import {
|
|
6
|
-
asJsonObject,
|
|
7
|
-
trimmedText
|
|
8
|
-
} from "./chunk-JXHMDBAY.js";
|
|
9
|
-
import {
|
|
10
|
-
createProviderPlugin,
|
|
11
|
-
upstreamError
|
|
12
|
-
} from "./chunk-ATK45BXV.js";
|
|
13
|
-
import "./chunk-U7B6DS2O.js";
|
|
14
|
-
import {
|
|
15
|
-
external_exports
|
|
16
|
-
} from "./chunk-UZM2RXZH.js";
|
|
17
|
-
import "./chunk-U67V476Y.js";
|
|
18
|
-
|
|
19
|
-
// ../plugins/src/cohere/api.ts
|
|
20
|
-
var SERVICE = "cohere";
|
|
21
|
-
function errorMessage(payload, status) {
|
|
22
|
-
const fallback = trimmedText(payload) ?? `cohere request failed with ${status}`;
|
|
23
|
-
const root = asJsonObject(payload);
|
|
24
|
-
return trimmedText(asJsonObject(root?.error)?.message) ?? trimmedText(root?.message) ?? fallback;
|
|
25
|
-
}
|
|
26
|
-
var http = createAuthedClient({
|
|
27
|
-
baseUrl: "https://api.cohere.com/",
|
|
28
|
-
service: SERVICE,
|
|
29
|
-
auth: { kind: "bearer" },
|
|
30
|
-
headers: { accept: "application/json" },
|
|
31
|
-
// 498 是 Cohere 表达"token 无效"的私有码,改判 401 让它落 permission_denied。
|
|
32
|
-
mapError: ({ data: payload, status }) => upstreamError(
|
|
33
|
-
status === 498 ? 401 : status,
|
|
34
|
-
errorMessage(payload, status)
|
|
35
|
-
)
|
|
36
|
-
});
|
|
37
|
-
async function post(ctx, path, body) {
|
|
38
|
-
const { data } = await http.request(ctx, {
|
|
39
|
-
path,
|
|
40
|
-
method: "POST",
|
|
41
|
-
json: body,
|
|
42
|
-
invalidJsonMessage: "cohere returned an invalid JSON response"
|
|
43
|
-
});
|
|
44
|
-
const result = asJsonObject(data);
|
|
45
|
-
if (result === void 0) throw upstreamError(502, "cohere returned an invalid JSON response");
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
function chat(input, ctx) {
|
|
49
|
-
return post(ctx, "v2/chat", input);
|
|
50
|
-
}
|
|
51
|
-
function embedTexts(input, ctx) {
|
|
52
|
-
return post(ctx, "v2/embed", input);
|
|
53
|
-
}
|
|
54
|
-
function rerankDocuments(input, ctx) {
|
|
55
|
-
return post(ctx, "v2/rerank", input);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ../plugins/src/cohere/schema.ts
|
|
59
|
-
var chatInput = external_exports.strictObject({
|
|
60
|
-
model: external_exports.string().min(1).describe("The name of a compatible Cohere chat model."),
|
|
61
|
-
messages: external_exports.array(external_exports.strictObject({
|
|
62
|
-
role: external_exports.enum(["system", "user", "assistant", "tool"]).describe("The author role for the message."),
|
|
63
|
-
content: external_exports.union([external_exports.string().describe("Plain text message content."), external_exports.array(external_exports.looseObject({
|
|
64
|
-
type: external_exports.string().describe("The content block type, such as text or image_url.")
|
|
65
|
-
}).describe("A Cohere chat message content block.")).min(1).describe("Structured content blocks for the message.")]).describe("The content of a Cohere chat message.").optional(),
|
|
66
|
-
tool_calls: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Tool calls made by the assistant message.").optional(),
|
|
67
|
-
tool_call_id: external_exports.string().describe("The identifier of the tool call this tool message responds to.").optional()
|
|
68
|
-
}).describe("A message in the conversation sent to the Cohere Chat API.")).min(1).describe("The ordered conversation messages to send to Cohere."),
|
|
69
|
-
tools: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Function tools available to the model.").optional(),
|
|
70
|
-
strict_tools: external_exports.boolean().describe("Whether tool calls must strictly follow the tool definition.").optional(),
|
|
71
|
-
documents: external_exports.array(external_exports.union([external_exports.string().describe("Document text."), external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")]).describe("A document supplied to the model.")).describe("Documents that the model can cite while generating the response.").optional(),
|
|
72
|
-
citation_options: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
73
|
-
response_format: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
74
|
-
safety_mode: external_exports.string().describe("The Cohere safety mode to use for the request.").optional(),
|
|
75
|
-
max_tokens: external_exports.int().describe("The maximum number of output tokens the model will generate.").optional(),
|
|
76
|
-
stop_sequences: external_exports.array(external_exports.string().describe("A stop sequence.")).max(5).describe("Stop sequences that halt generation.").optional(),
|
|
77
|
-
temperature: external_exports.number().describe("Randomness used for generation.").optional(),
|
|
78
|
-
seed: external_exports.int().describe("A best-effort deterministic sampling seed.").optional(),
|
|
79
|
-
frequency_penalty: external_exports.number().describe("Penalty used to reduce repeated tokens.").optional(),
|
|
80
|
-
presence_penalty: external_exports.number().describe("Penalty used to reduce reused token content.").optional(),
|
|
81
|
-
k: external_exports.int().describe("Top-k sampling value. Use 0 to disable k-sampling.").optional(),
|
|
82
|
-
p: external_exports.number().describe("Top-p sampling value.").optional(),
|
|
83
|
-
logprobs: external_exports.boolean().describe("Whether to include generated-token log probabilities.").optional(),
|
|
84
|
-
tool_choice: external_exports.union([external_exports.string().describe("A predefined tool choice value."), external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")]).describe("Tool selection behavior for the model.").optional(),
|
|
85
|
-
thinking: external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.").optional(),
|
|
86
|
-
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
87
|
-
}).describe("Input for generating a synchronous response with the Cohere Chat API.");
|
|
88
|
-
var chatOutput = external_exports.looseObject({
|
|
89
|
-
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
90
|
-
finish_reason: external_exports.string().describe("Why generation finished."),
|
|
91
|
-
message: external_exports.looseObject({
|
|
92
|
-
role: external_exports.string().describe("The role of the returned message.").optional(),
|
|
93
|
-
content: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Content blocks returned by the assistant message.").optional(),
|
|
94
|
-
tool_calls: external_exports.array(external_exports.looseObject({}).describe("A JSON object accepted or returned by the Cohere API.")).describe("Tool calls returned by Cohere.").optional()
|
|
95
|
-
}).describe("The assistant message returned by Cohere."),
|
|
96
|
-
usage: external_exports.looseObject({}).describe("Usage statistics returned by Cohere.")
|
|
97
|
-
}).describe("The response returned by the Cohere Chat API.");
|
|
98
|
-
var embedTextsInput = external_exports.strictObject({
|
|
99
|
-
model: external_exports.string().min(1).describe("The Cohere embedding model identifier."),
|
|
100
|
-
input_type: external_exports.enum(["search_document", "search_query", "classification", "clustering"]).describe("The type of input passed to the embedding model."),
|
|
101
|
-
texts: external_exports.array(external_exports.string().describe("A text value to embed.")).min(1).max(96).describe("Text strings for the model to embed."),
|
|
102
|
-
max_tokens: external_exports.int().describe("The maximum number of tokens to embed per input.").optional(),
|
|
103
|
-
output_dimension: external_exports.int().describe("The number of dimensions for embed-v4 and newer models.").optional(),
|
|
104
|
-
embedding_types: external_exports.array(external_exports.enum(["float", "int8", "uint8", "binary", "ubinary", "base64"]).describe("The embedding representation to return.")).min(1).describe("Embedding representations to return.").optional(),
|
|
105
|
-
truncate: external_exports.enum(["NONE", "START", "END"]).describe("How Cohere handles inputs longer than the model limit.").optional(),
|
|
106
|
-
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
107
|
-
}).describe("Input for generating text embeddings with the Cohere Embed API.");
|
|
108
|
-
var embedTextsOutput = external_exports.looseObject({
|
|
109
|
-
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
110
|
-
embeddings: external_exports.looseObject({}).describe("Embeddings grouped by requested representation type."),
|
|
111
|
-
texts: external_exports.array(external_exports.string().describe("A text input.")).describe("Text inputs echoed by Cohere."),
|
|
112
|
-
meta: external_exports.looseObject({
|
|
113
|
-
api_version: external_exports.looseObject({
|
|
114
|
-
version: external_exports.string().describe("The API version used for the response.").optional(),
|
|
115
|
-
is_deprecated: external_exports.boolean().describe("Whether this API version is deprecated.").optional(),
|
|
116
|
-
is_experimental: external_exports.boolean().describe("Whether this API version is experimental.").optional()
|
|
117
|
-
}).describe("The Cohere API version metadata.").optional(),
|
|
118
|
-
billed_units: external_exports.looseObject({}).describe("Billing unit counts reported by Cohere.").optional(),
|
|
119
|
-
tokens: external_exports.looseObject({}).describe("Token usage counts reported by Cohere.").optional(),
|
|
120
|
-
warnings: external_exports.array(external_exports.string().describe("A warning message.")).describe("Warnings returned by Cohere.").optional()
|
|
121
|
-
}).describe("Cohere API metadata including usage and billing details.")
|
|
122
|
-
}).describe("The response returned by the Cohere Embed API.");
|
|
123
|
-
var rerankDocumentsInput = external_exports.strictObject({
|
|
124
|
-
model: external_exports.string().min(1).describe("The Cohere rerank model identifier."),
|
|
125
|
-
query: external_exports.string().min(1).describe("The search query used to rank documents."),
|
|
126
|
-
documents: external_exports.array(external_exports.string().describe("A text document to rank.")).min(1).describe("Texts that will be compared to the query."),
|
|
127
|
-
top_n: external_exports.int().describe("Maximum number of rerank results to return.").optional(),
|
|
128
|
-
max_tokens_per_doc: external_exports.int().describe("Maximum tokens to keep per document before ranking.").optional(),
|
|
129
|
-
priority: external_exports.int().describe("Lower values are handled earlier by Cohere.").optional()
|
|
130
|
-
}).describe("Input for ranking documents by relevance with the Cohere Rerank API.");
|
|
131
|
-
var rerankDocumentsOutput = external_exports.looseObject({
|
|
132
|
-
id: external_exports.string().describe("The unique Cohere response identifier."),
|
|
133
|
-
results: external_exports.array(external_exports.strictObject({
|
|
134
|
-
index: external_exports.int().describe("The original zero-based index of the ranked document.").optional(),
|
|
135
|
-
relevance_score: external_exports.number().describe("Normalized relevance score between 0 and 1.").optional()
|
|
136
|
-
}).describe("A ranked document result returned by Cohere.")).describe("Ranked document results."),
|
|
137
|
-
meta: external_exports.looseObject({
|
|
138
|
-
api_version: external_exports.looseObject({
|
|
139
|
-
version: external_exports.string().describe("The API version used for the response.").optional(),
|
|
140
|
-
is_deprecated: external_exports.boolean().describe("Whether this API version is deprecated.").optional(),
|
|
141
|
-
is_experimental: external_exports.boolean().describe("Whether this API version is experimental.").optional()
|
|
142
|
-
}).describe("The Cohere API version metadata.").optional(),
|
|
143
|
-
billed_units: external_exports.looseObject({}).describe("Billing unit counts reported by Cohere.").optional(),
|
|
144
|
-
tokens: external_exports.looseObject({}).describe("Token usage counts reported by Cohere.").optional(),
|
|
145
|
-
warnings: external_exports.array(external_exports.string().describe("A warning message.")).describe("Warnings returned by Cohere.").optional()
|
|
146
|
-
}).describe("Cohere API metadata including usage and billing details.")
|
|
147
|
-
}).describe("The response returned by the Cohere Rerank API.");
|
|
148
|
-
var cohereActions = {
|
|
149
|
-
chat: {
|
|
150
|
-
description: "Generate a synchronous text response using the Cohere Chat API.",
|
|
151
|
-
effect: "write",
|
|
152
|
-
inputSchema: chatInput,
|
|
153
|
-
outputSchema: external_exports.toJSONSchema(chatOutput, { io: "output", unrepresentable: "any" })
|
|
154
|
-
},
|
|
155
|
-
embed_texts: {
|
|
156
|
-
description: "Generate embeddings for text inputs using the Cohere Embed API.",
|
|
157
|
-
effect: "write",
|
|
158
|
-
inputSchema: embedTextsInput,
|
|
159
|
-
outputSchema: external_exports.toJSONSchema(embedTextsOutput, { io: "output", unrepresentable: "any" })
|
|
160
|
-
},
|
|
161
|
-
rerank_documents: {
|
|
162
|
-
description: "Rank text documents by relevance to a query using the Cohere Rerank API.",
|
|
163
|
-
effect: "write",
|
|
164
|
-
inputSchema: rerankDocumentsInput,
|
|
165
|
-
outputSchema: external_exports.toJSONSchema(rerankDocumentsOutput, { io: "output", unrepresentable: "any" })
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// ../plugins/src/cohere/index.ts
|
|
170
|
-
function createCoherePlugin() {
|
|
171
|
-
return createProviderPlugin({
|
|
172
|
-
description: "Cohere",
|
|
173
|
-
actions: cohereActions,
|
|
174
|
-
handlers: {
|
|
175
|
-
chat,
|
|
176
|
-
embed_texts: embedTexts,
|
|
177
|
-
rerank_documents: rerankDocuments
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
var cohere_default = createCoherePlugin();
|
|
182
|
-
export {
|
|
183
|
-
createCoherePlugin,
|
|
184
|
-
cohere_default as default
|
|
185
|
-
};
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createAuthedClient
|
|
3
|
-
} from "./chunk-XYBU3WZH.js";
|
|
4
|
-
import "./chunk-E6JCVKW6.js";
|
|
5
|
-
import {
|
|
6
|
-
asJsonObject,
|
|
7
|
-
compactDefined,
|
|
8
|
-
trimmedText
|
|
9
|
-
} from "./chunk-JXHMDBAY.js";
|
|
10
|
-
import {
|
|
11
|
-
createProviderPlugin,
|
|
12
|
-
upstreamError
|
|
13
|
-
} from "./chunk-ATK45BXV.js";
|
|
14
|
-
import "./chunk-U7B6DS2O.js";
|
|
15
|
-
import {
|
|
16
|
-
TBError,
|
|
17
|
-
external_exports
|
|
18
|
-
} from "./chunk-UZM2RXZH.js";
|
|
19
|
-
import "./chunk-U67V476Y.js";
|
|
20
|
-
|
|
21
|
-
// ../plugins/src/deepseek/api.ts
|
|
22
|
-
var SERVICE = "deepseek";
|
|
23
|
-
var API_BASE = "https://api.deepseek.com";
|
|
24
|
-
var ANTHROPIC_API_PREFIX = "/anthropic";
|
|
25
|
-
function errorMessage(payload, bodyKind, status) {
|
|
26
|
-
const fallback = `deepseek request failed with ${status}`;
|
|
27
|
-
const body = asJsonObject(payload);
|
|
28
|
-
const nested = asJsonObject(body?.error);
|
|
29
|
-
return trimmedText(nested?.message) ?? trimmedText(body?.message) ?? (bodyKind === "invalid-json" || bodyKind === "text" ? trimmedText(payload) : void 0) ?? fallback;
|
|
30
|
-
}
|
|
31
|
-
function mapDeepseekError({ bodyKind, data: payload, status }) {
|
|
32
|
-
return upstreamError(status, errorMessage(payload, bodyKind, status));
|
|
33
|
-
}
|
|
34
|
-
var openaiHttp = createAuthedClient({
|
|
35
|
-
baseUrl: API_BASE,
|
|
36
|
-
service: SERVICE,
|
|
37
|
-
auth: { kind: "bearer" },
|
|
38
|
-
headers: { "content-type": "application/json" },
|
|
39
|
-
mapError: mapDeepseekError
|
|
40
|
-
});
|
|
41
|
-
var anthropicHttp = createAuthedClient({
|
|
42
|
-
baseUrl: `${API_BASE}${ANTHROPIC_API_PREFIX}/`,
|
|
43
|
-
service: SERVICE,
|
|
44
|
-
auth: { kind: "header", name: "x-api-key" },
|
|
45
|
-
headers: { "content-type": "application/json" },
|
|
46
|
-
mapError: mapDeepseekError
|
|
47
|
-
});
|
|
48
|
-
function assertStreamingDisabled(input) {
|
|
49
|
-
if (input.stream === true) {
|
|
50
|
-
throw new TBError("invalid_argument", "stream=true is not supported by connector actions");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function request(ctx, options) {
|
|
54
|
-
const client = options.anthropic === true ? anthropicHttp : openaiHttp;
|
|
55
|
-
const { data } = await client.request(ctx, {
|
|
56
|
-
path: options.path,
|
|
57
|
-
method: options.method ?? "GET",
|
|
58
|
-
...options.body === void 0 ? {} : { json: options.body },
|
|
59
|
-
invalidJsonMessage: "deepseek returned malformed JSON"
|
|
60
|
-
});
|
|
61
|
-
if (data === void 0) throw upstreamError(502, "deepseek returned malformed JSON");
|
|
62
|
-
return data;
|
|
63
|
-
}
|
|
64
|
-
function listModels(_input, ctx) {
|
|
65
|
-
return request(ctx, { path: "/models" });
|
|
66
|
-
}
|
|
67
|
-
function getUserBalance(_input, ctx) {
|
|
68
|
-
return request(ctx, { path: "/user/balance" });
|
|
69
|
-
}
|
|
70
|
-
function createChatCompletion(input, ctx) {
|
|
71
|
-
assertStreamingDisabled(input);
|
|
72
|
-
return request(ctx, { path: "/chat/completions", method: "POST", body: compactDefined(input) });
|
|
73
|
-
}
|
|
74
|
-
function createAnthropicMessage(input, ctx) {
|
|
75
|
-
assertStreamingDisabled(input);
|
|
76
|
-
return request(ctx, { path: "/v1/messages", method: "POST", body: compactDefined(input), anthropic: true });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ../plugins/src/deepseek/schema.ts
|
|
80
|
-
var listModelsInput = external_exports.strictObject({}).describe("No input parameters are required for this action.");
|
|
81
|
-
var listModelsOutput = external_exports.strictObject({
|
|
82
|
-
object: external_exports.string().describe("The top-level object type returned by the API.").optional(),
|
|
83
|
-
data: external_exports.array(external_exports.looseObject({
|
|
84
|
-
id: external_exports.string().describe("The model identifier.").optional(),
|
|
85
|
-
object: external_exports.string().describe("The object type returned by the API.").optional(),
|
|
86
|
-
owned_by: external_exports.string().describe("The owner of the model.").optional()
|
|
87
|
-
}).describe("A DeepSeek model summary.")).describe("The list of available models.").optional()
|
|
88
|
-
});
|
|
89
|
-
var getUserBalanceInput = external_exports.strictObject({}).describe("No input parameters are required for this action.");
|
|
90
|
-
var getUserBalanceOutput = external_exports.strictObject({
|
|
91
|
-
is_available: external_exports.boolean().describe("Whether the account balance information is currently available.").optional(),
|
|
92
|
-
balance_infos: external_exports.array(external_exports.looseObject({
|
|
93
|
-
currency: external_exports.string().describe("The currency code for the balance.").optional(),
|
|
94
|
-
total_balance: external_exports.string().describe("The total available balance.").optional(),
|
|
95
|
-
granted_balance: external_exports.string().describe("The promotional or granted balance.").optional(),
|
|
96
|
-
topped_up_balance: external_exports.string().describe("The manually topped-up balance.").optional()
|
|
97
|
-
}).describe("A balance entry returned by the DeepSeek balance API.")).describe("The list of balances grouped by currency.").optional()
|
|
98
|
-
});
|
|
99
|
-
var createChatCompletionInput = external_exports.strictObject({
|
|
100
|
-
model: external_exports.enum(["deepseek-chat", "deepseek-reasoner"]).describe("The DeepSeek model identifier."),
|
|
101
|
-
messages: external_exports.array(external_exports.looseObject({
|
|
102
|
-
role: external_exports.enum(["system", "user", "assistant", "tool"]).describe("The role of the message author.").optional(),
|
|
103
|
-
content: external_exports.string().describe("The text content of the message.").nullable().optional(),
|
|
104
|
-
name: external_exports.string().describe("The optional participant name for the message.").optional(),
|
|
105
|
-
prefix: external_exports.boolean().describe("Whether the assistant message should be treated as a prefix.").optional(),
|
|
106
|
-
tool_call_id: external_exports.string().describe("The identifier of the tool call that this tool message responds to.").optional(),
|
|
107
|
-
reasoning_content: external_exports.string().describe("Reasoning content provided for assistant context.").optional()
|
|
108
|
-
}).describe("A message in the OpenAI-compatible chat completion request.")).describe("The ordered conversation history to send to the model."),
|
|
109
|
-
frequency_penalty: external_exports.number().min(-2).max(2).describe("The frequency penalty to apply to repeated tokens.").optional(),
|
|
110
|
-
logprobs: external_exports.boolean().describe("Whether to include token-level log probability details in the response.").optional(),
|
|
111
|
-
max_tokens: external_exports.int().min(1).describe("The maximum number of tokens to generate.").optional(),
|
|
112
|
-
presence_penalty: external_exports.number().min(-2).max(2).describe("The presence penalty to apply to newly introduced tokens.").optional(),
|
|
113
|
-
response_format: external_exports.strictObject({
|
|
114
|
-
type: external_exports.enum(["text", "json_object"]).describe("The response format type requested from the model.").optional()
|
|
115
|
-
}).optional(),
|
|
116
|
-
stop: external_exports.union([external_exports.string().describe("A single stop sequence."), external_exports.array(external_exports.string().describe("A stop sequence.")).describe("A list of stop sequences.")]).describe("One or more sequences that stop generation.").optional(),
|
|
117
|
-
stream: external_exports.boolean().describe("Whether to request a streaming response. This connector only accepts false or omission.").optional(),
|
|
118
|
-
stream_options: external_exports.strictObject({
|
|
119
|
-
include_usage: external_exports.boolean().describe("Whether usage information should be included in stream chunks.").optional()
|
|
120
|
-
}).describe("Streaming options for the request.").optional(),
|
|
121
|
-
temperature: external_exports.number().min(0).max(2).describe("The sampling temperature to use for generation.").optional(),
|
|
122
|
-
thinking: external_exports.strictObject({
|
|
123
|
-
type: external_exports.enum(["enabled", "disabled"]).describe("Whether reasoning mode should be enabled for the request.").optional()
|
|
124
|
-
}).optional(),
|
|
125
|
-
tool_choice: external_exports.union([external_exports.enum(["none", "auto", "required"]).describe("A predefined tool selection strategy for the request."), external_exports.looseObject({
|
|
126
|
-
type: external_exports.literal("function").describe("The tool choice type. Must be function.").optional(),
|
|
127
|
-
function: external_exports.strictObject({
|
|
128
|
-
name: external_exports.string().describe("The name of the function tool to force.").optional()
|
|
129
|
-
}).optional()
|
|
130
|
-
}).describe("A tool choice that forces one specific function tool.")]).describe("The tool selection policy for the chat completion request.").optional(),
|
|
131
|
-
tools: external_exports.array(external_exports.looseObject({
|
|
132
|
-
type: external_exports.literal("function").describe("The tool type. Must be function.").optional(),
|
|
133
|
-
function: external_exports.looseObject({
|
|
134
|
-
name: external_exports.string().describe("The function name exposed to the model.").optional(),
|
|
135
|
-
description: external_exports.string().describe("A human-readable description of the function.").optional(),
|
|
136
|
-
parameters: external_exports.record(external_exports.string(), external_exports.unknown().describe("Any JSON value accepted by the DeepSeek API.")).describe("A JSON object passed through to the DeepSeek API.").optional(),
|
|
137
|
-
strict: external_exports.boolean().describe("Whether the model must follow the declared parameter schema exactly.").optional()
|
|
138
|
-
}).describe("The function definition for an OpenAI-compatible tool.").optional()
|
|
139
|
-
}).describe("An OpenAI-compatible tool definition.")).describe("The tools available to the model.").optional(),
|
|
140
|
-
top_logprobs: external_exports.int().min(0).max(20).describe("The number of top token log probabilities to return.").optional(),
|
|
141
|
-
top_p: external_exports.number().min(0).max(1).describe("The nucleus sampling threshold.").optional()
|
|
142
|
-
}).describe("The input payload for the OpenAI-compatible chat completion action.");
|
|
143
|
-
var createChatCompletionOutput = external_exports.looseObject({}).describe("The response payload for the chat completion action.");
|
|
144
|
-
var createAnthropicMessageInput = external_exports.strictObject({
|
|
145
|
-
model: external_exports.enum(["deepseek-chat", "deepseek-reasoner"]).describe("The DeepSeek model identifier."),
|
|
146
|
-
max_tokens: external_exports.int().min(1).describe("The maximum number of tokens to generate."),
|
|
147
|
-
messages: external_exports.array(external_exports.strictObject({
|
|
148
|
-
role: external_exports.enum(["user", "assistant"]).describe("The role of the message author.").optional(),
|
|
149
|
-
content: external_exports.union([external_exports.string().describe("Plain text content."), external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown().describe("Any JSON value accepted by the DeepSeek API.")).describe("A JSON object passed through to the DeepSeek API.")).describe("Structured content blocks.")]).describe("Message content as plain text or structured blocks.").optional()
|
|
150
|
-
})).describe("The ordered conversation history to send to the model."),
|
|
151
|
-
stop_sequences: external_exports.array(external_exports.string().describe("A stop sequence.")).describe("Sequences that stop generation.").optional(),
|
|
152
|
-
stream: external_exports.boolean().describe("Whether to request a streaming response. This connector only accepts false or omission.").optional(),
|
|
153
|
-
system: external_exports.union([external_exports.string().describe("Plain text content."), external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown().describe("Any JSON value accepted by the DeepSeek API.")).describe("A JSON object passed through to the DeepSeek API.")).describe("Structured content blocks.")]).describe("Message content as plain text or structured blocks.").optional(),
|
|
154
|
-
temperature: external_exports.number().min(0).max(2).describe("The sampling temperature to use for generation.").optional(),
|
|
155
|
-
thinking: external_exports.looseObject({
|
|
156
|
-
type: external_exports.string().describe("The thinking mode requested by the Anthropic-compatible API.").optional(),
|
|
157
|
-
budget_tokens: external_exports.int().describe("The maximum number of tokens allocated to thinking.").optional()
|
|
158
|
-
}).describe("Thinking configuration for the Anthropic-compatible request.").optional(),
|
|
159
|
-
tool_choice: external_exports.union([external_exports.enum(["auto", "any", "none"]).describe("A predefined Anthropic-compatible tool choice mode."), external_exports.record(external_exports.string(), external_exports.unknown().describe("Any JSON value accepted by the DeepSeek API.")).describe("A JSON object passed through to the DeepSeek API.")]).describe("How the model should choose tools for the request.").optional(),
|
|
160
|
-
tools: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown().describe("Any JSON value accepted by the DeepSeek API.")).describe("A JSON object passed through to the DeepSeek API.")).describe("The tools available to the model.").optional(),
|
|
161
|
-
top_p: external_exports.number().describe("The nucleus sampling threshold.").optional()
|
|
162
|
-
}).describe("The input payload for the Anthropic-compatible message action.");
|
|
163
|
-
var createAnthropicMessageOutput = external_exports.looseObject({}).describe("The response payload for the Anthropic-compatible message action.");
|
|
164
|
-
var deepseekActions = {
|
|
165
|
-
list_models: {
|
|
166
|
-
description: "List the available DeepSeek models.",
|
|
167
|
-
effect: "read",
|
|
168
|
-
inputSchema: listModelsInput,
|
|
169
|
-
outputSchema: external_exports.toJSONSchema(listModelsOutput, { io: "output", unrepresentable: "any" })
|
|
170
|
-
},
|
|
171
|
-
get_user_balance: {
|
|
172
|
-
description: "Get the current DeepSeek account balance.",
|
|
173
|
-
effect: "read",
|
|
174
|
-
inputSchema: getUserBalanceInput,
|
|
175
|
-
outputSchema: external_exports.toJSONSchema(getUserBalanceOutput, { io: "output", unrepresentable: "any" })
|
|
176
|
-
},
|
|
177
|
-
create_chat_completion: {
|
|
178
|
-
description: "Create a DeepSeek chat completion via the OpenAI-compatible API.",
|
|
179
|
-
effect: "write",
|
|
180
|
-
inputSchema: createChatCompletionInput,
|
|
181
|
-
outputSchema: external_exports.toJSONSchema(createChatCompletionOutput, { io: "output", unrepresentable: "any" })
|
|
182
|
-
},
|
|
183
|
-
create_anthropic_message: {
|
|
184
|
-
description: "Create a DeepSeek message via the Anthropic-compatible API.",
|
|
185
|
-
effect: "write",
|
|
186
|
-
inputSchema: createAnthropicMessageInput,
|
|
187
|
-
outputSchema: external_exports.toJSONSchema(createAnthropicMessageOutput, { io: "output", unrepresentable: "any" })
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// ../plugins/src/deepseek/index.ts
|
|
192
|
-
function createDeepseekPlugin() {
|
|
193
|
-
return createProviderPlugin({
|
|
194
|
-
description: "DeepSeek",
|
|
195
|
-
credentialProbe: "list_models",
|
|
196
|
-
actions: deepseekActions,
|
|
197
|
-
handlers: {
|
|
198
|
-
list_models: listModels,
|
|
199
|
-
get_user_balance: getUserBalance,
|
|
200
|
-
create_chat_completion: createChatCompletion,
|
|
201
|
-
create_anthropic_message: createAnthropicMessage
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
var deepseek_default = createDeepseekPlugin();
|
|
206
|
-
export {
|
|
207
|
-
createDeepseekPlugin,
|
|
208
|
-
deepseek_default as default
|
|
209
|
-
};
|