@midsummer-ai/sdk 0.1.0-staging.4966 → 0.1.0-staging.4970
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/ai/contract.mjs +1 -1
- package/ai/index.d.mts +24 -0
- package/ai/index.mjs +1 -1
- package/ai/stand-in.mjs +1 -1
- package/{ai-2T_Qya-j.mjs → ai-DUfnNSnz.mjs} +3 -1
- package/here-C2jhTheQ.mjs +1 -1
- package/package.json +1 -1
package/ai/contract.mjs
CHANGED
package/ai/index.d.mts
CHANGED
|
@@ -86,6 +86,21 @@ interface Ask {
|
|
|
86
86
|
readonly reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
87
87
|
/** Up to three Models asked in turn when the one before can't answer. */
|
|
88
88
|
readonly fallback?: ReadonlyArray<string>;
|
|
89
|
+
/**
|
|
90
|
+
* What pays: `team-credits`, or one of the team's own API keys (`google-key`, any provider `ai account add` takes),
|
|
91
|
+
* which its provider bills. The same as naming the model `<key>/<model>`, as `google-key/gemini-3-flash`.
|
|
92
|
+
*/
|
|
93
|
+
readonly paidWith?: "team-credits" | `${string}-key`;
|
|
94
|
+
/** Ask the model named, or a fallback, that this call likely costs least on first (`price`); in the order named unless given. */
|
|
95
|
+
readonly sort?: "price";
|
|
96
|
+
/** Ask only the models named that these companies make, as `ai model list` shows each one's `provider`, such as `["google"]`. */
|
|
97
|
+
readonly makers?: ReadonlyArray<string>;
|
|
98
|
+
/** Leave out the models named that these companies make. */
|
|
99
|
+
readonly excludeMakers?: ReadonlyArray<string>;
|
|
100
|
+
/** Leave out a model named whose input costs more than this many credits per million tokens. */
|
|
101
|
+
readonly maxInputCredits?: number;
|
|
102
|
+
/** Leave out a model named whose output costs more than this many credits per million tokens. */
|
|
103
|
+
readonly maxOutputCredits?: number;
|
|
89
104
|
/**
|
|
90
105
|
* Names this call for a day. A retry with it after a lost answer gets the first call's answer and
|
|
91
106
|
* is not charged again; while the first still runs, it fails as `conflict`.
|
|
@@ -102,6 +117,15 @@ interface Spent {
|
|
|
102
117
|
readonly outputTokens: number;
|
|
103
118
|
readonly credits: number;
|
|
104
119
|
readonly catalogue: string;
|
|
120
|
+
/** How a call that asked a route (`sort`, `makers`, `excludeMakers`, a price limit) chose: by price or as named, what it asked in order, and each it left out and why. */
|
|
121
|
+
readonly route?: {
|
|
122
|
+
readonly by: string;
|
|
123
|
+
readonly asked: ReadonlyArray<string>;
|
|
124
|
+
readonly dropped: ReadonlyArray<{
|
|
125
|
+
readonly model: string;
|
|
126
|
+
readonly why: string;
|
|
127
|
+
}>;
|
|
128
|
+
};
|
|
105
129
|
}
|
|
106
130
|
/** A piece of a tool call: `index` tells calls apart, `id` and `name` come with its first piece, `arguments` add up. */
|
|
107
131
|
interface ToolCallPiece {
|
package/ai/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as boundAi, n as ai, r as aiClient, t as AiError } from "../ai-
|
|
1
|
+
import { i as boundAi, n as ai, r as aiClient, t as AiError } from "../ai-DUfnNSnz.mjs";
|
|
2
2
|
export { AiError, ai, aiClient, boundAi };
|
package/ai/stand-in.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as aiStandIn } from "../ai-
|
|
1
|
+
import { a as aiStandIn } from "../ai-DUfnNSnz.mjs";
|
|
2
2
|
export { aiStandIn };
|
|
@@ -327,13 +327,15 @@ function parsed(line) {
|
|
|
327
327
|
const done = event.done;
|
|
328
328
|
if (object(done)) {
|
|
329
329
|
if (typeof done.model !== "string" || !count(done.inputTokens) || !count(done.outputTokens) || typeof done.credits !== "number" || !(done.credits >= 0) || typeof done.catalogue !== "string" || done.cachedTokens !== void 0 && !count(done.cachedTokens)) throw broken();
|
|
330
|
+
const route = object(done.route) && typeof done.route.by === "string" && Array.isArray(done.route.asked) && Array.isArray(done.route.dropped) ? done.route : void 0;
|
|
330
331
|
return { done: {
|
|
331
332
|
model: done.model,
|
|
332
333
|
inputTokens: done.inputTokens,
|
|
333
334
|
...done.cachedTokens ? { cachedTokens: done.cachedTokens } : {},
|
|
334
335
|
outputTokens: done.outputTokens,
|
|
335
336
|
credits: done.credits,
|
|
336
|
-
catalogue: done.catalogue
|
|
337
|
+
catalogue: done.catalogue,
|
|
338
|
+
...route ? { route } : {}
|
|
337
339
|
} };
|
|
338
340
|
}
|
|
339
341
|
const error = event.error;
|
package/here-C2jhTheQ.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function processEnv() {
|
|
|
12
12
|
* This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
|
|
13
13
|
* release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
|
|
14
14
|
*/
|
|
15
|
-
const SDK_VERSION = "0.1.0-staging.
|
|
15
|
+
const SDK_VERSION = "0.1.0-staging.4970";
|
|
16
16
|
/**
|
|
17
17
|
* The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
|
|
18
18
|
* <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midsummer-ai/sdk",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.4970",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",
|