@absolutejs/ai 0.2.8 → 0.2.10

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.
@@ -18,7 +18,9 @@ export type AIInputCapacity = {
18
18
  };
19
19
  export declare class AIInputError extends Error {
20
20
  readonly code: "capacity_unavailable" | "input_too_large" | "unsupported_content";
21
- constructor(code: "capacity_unavailable" | "input_too_large" | "unsupported_content", message: string);
21
+ readonly status?: number | undefined;
22
+ readonly requestId?: string | undefined;
23
+ constructor(code: "capacity_unavailable" | "input_too_large" | "unsupported_content", message: string, status?: number | undefined, requestId?: string | undefined);
22
24
  }
23
25
  export declare const positiveTokenLimit: (value: unknown) => number;
24
26
  export declare const inputTokenCount: (value: unknown) => number;
@@ -1,6 +1,7 @@
1
1
  import { modelCapabilities } from "./index";
2
2
  /** Display names for the providers the directory covers. */
3
3
  export declare const MODEL_PROVIDERS: Readonly<Record<string, string>>;
4
+ export type ModelTier = "frontier" | "balanced" | "fast";
4
5
  export type ModelDirectoryEntry = {
5
6
  provider: string;
6
7
  /** The exact model ID sent to the provider. */
@@ -8,8 +9,10 @@ export type ModelDirectoryEntry = {
8
9
  name: string;
9
10
  /** One short, plain sentence for pickers. */
10
11
  description: string;
11
- /** A current flagship worth showing first. */
12
+ /** The provider's current frontier model; at most one per provider. */
12
13
  featured?: boolean;
14
+ /** Relative capability within the provider's current line, for recommendations. */
15
+ tier?: ModelTier;
13
16
  /** Superseded by a newer model in the same line; hide by default. */
14
17
  legacy?: boolean;
15
18
  };
@@ -36,3 +39,20 @@ export declare const listModels: (options?: {
36
39
  includeLegacy?: boolean;
37
40
  }) => ListedModel[];
38
41
  export declare const findModel: (provider: string, id: string) => ModelDirectoryEntry | undefined;
42
+ /** Chooses a tier from the request text: quick edits and simple questions are
43
+ * fast, deep analysis or very long requests are frontier, everything else is
44
+ * balanced. `depth: "deep"` forces frontier. Adapted from AbsoluteJS PAAS. */
45
+ export declare const recommendTier: (input: {
46
+ message: string;
47
+ depth?: "auto" | "deep";
48
+ }) => ModelTier;
49
+ /** Picks a current model for a request from the first listed provider that
50
+ * has one at the recommended tier. Providers are in preference order and
51
+ * should only include ones the application can call. */
52
+ export declare const recommendModel: (input: {
53
+ message: string;
54
+ providers: readonly string[];
55
+ depth?: "auto" | "deep";
56
+ }) => (ModelDirectoryEntry & {
57
+ tier: ModelTier;
58
+ }) | undefined;
@@ -30,4 +30,4 @@ export type ModelCapability = keyof typeof MODEL_CAPABILITY_DESCRIPTIONS;
30
30
  export declare const modelCapabilities: (metadata?: ModelMetadata) => ModelCapability[];
31
31
  export { MODEL_METADATA, getModelMetadata } from "./catalog";
32
32
  export { MODEL_REASONING, REASONING_EFFORTS, getModelReasoning, isReasoningSelection, supportsReasoningSelection, reasoningSelectionLabel, type ModelReasoning, type ReasoningSelection, } from "./reasoning";
33
- export { MODEL_DIRECTORY, MODEL_PROVIDERS, findModel, listModels, modelKey, type ListedModel, type ModelDirectoryEntry, } from "./directory";
33
+ export { MODEL_DIRECTORY, MODEL_PROVIDERS, findModel, listModels, modelKey, recommendModel, recommendTier, type ListedModel, type ModelDirectoryEntry, type ModelTier, } from "./directory";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/ai",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "homepage": "https://github.com/absolutejs/ai",
5
5
  "bugs": {
6
6
  "url": "https://github.com/absolutejs/ai/issues"