@midsummer-ai/sdk 0.1.0-staging.3698 → 0.1.0-staging.3701

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/index.d.mts CHANGED
@@ -61,9 +61,9 @@ interface Ask {
61
61
  readonly prompt?: string;
62
62
  readonly system?: string;
63
63
  readonly messages?: ReadonlyArray<Message>;
64
- /** The most tokens the answer may have: 1 to 32,000, 1,024 unless given. */
64
+ /** The most tokens the answer may have: 1 to 32,000 and at most what the Model writes, 1,024 unless given. */
65
65
  readonly maxTokens?: number;
66
- /** 0 to 2. */
66
+ /** 0 to 2, sent as given; Claude models take 0 to 1, and a Model that `ai model list` shows with `temperature: false` takes none. */
67
67
  readonly temperature?: number;
68
68
  readonly tools?: ReadonlyArray<Tool>;
69
69
  /** Whether the Model may call tools (`auto`), must not (`none`), must call one (`required`) or the one named. */
package/ai/index.mjs CHANGED
@@ -51,12 +51,13 @@ function toolCalls() {
51
51
  whole: () => calls.size ? { toolCalls: [...calls.entries()].sort(([a], [b]) => a - b).map(([, made]) => made) } : {}
52
52
  };
53
53
  }
54
- /** Checks a question before it leaves the caller. */
54
+ /**
55
+ * Checks a question's shape before it leaves the caller. Its parameters' ranges are the AI Gateway's to check, against
56
+ * the Models asked, so its errors are the only ones that name them.
57
+ */
55
58
  function checked(input) {
56
59
  if (Boolean(input.prompt) === Boolean(input.messages)) throw new AiError("invalid", "Give a prompt or messages.");
57
60
  if (input.messages && !input.messages.length) throw new AiError("invalid", "Give at least one message.");
58
- if (input.maxTokens !== void 0 && !(Number.isInteger(input.maxTokens) && input.maxTokens >= 1 && input.maxTokens <= 32e3)) throw new AiError("invalid", "maxTokens is a whole number from 1 to 32,000.");
59
- if (input.temperature !== void 0 && !(input.temperature >= 0 && input.temperature <= 2)) throw new AiError("invalid", "temperature is from 0 to 2.");
60
61
  if ((input.fallback?.length ?? 0) > 3) throw new AiError("invalid", "Name at most 3 fallback models.");
61
62
  return input;
62
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.3698",
3
+ "version": "0.1.0-staging.3701",
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.",