pi-provider-litellm 3.2.0 → 3.4.0
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 +58 -10
- package/package.json +6 -6
- package/src/backend-identity.ts +17 -1
- package/src/discover.ts +246 -48
- package/src/index.ts +548 -155
- package/src/mcp-tools.ts +191 -9
- package/src/model-groups.ts +16 -12
- package/src/provider.ts +27 -12
- package/src/proxy-version.ts +68 -0
- package/src/skills.ts +10 -0
- package/src/types.ts +25 -1
package/src/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Model } from "@earendil-works/pi-ai";
|
|
2
2
|
import type { BackendFamily, LITELLM_DISCOVERY_VERSION } from "./backend-identity.js";
|
|
3
|
+
import type { ProxyVersion } from "./proxy-version.js";
|
|
3
4
|
|
|
4
5
|
export type DiscoverySource = "model_info" | "models_list" | "health";
|
|
5
6
|
|
|
@@ -27,6 +28,14 @@ export interface LiteLLMModelPolicy {
|
|
|
27
28
|
// Gemini-backed deployments require lowercase effort values. Discovery carries
|
|
28
29
|
// this evidence so the request hook does not infer a backend from the route name.
|
|
29
30
|
normalizeGeminiReasoningEffort?: boolean;
|
|
31
|
+
// GPT-5.5 and later reject `reasoning_effort` alongside function tools on
|
|
32
|
+
// /v1/chat/completions. Discovery sets this for Chat routes from deployment
|
|
33
|
+
// evidence so tool requests drop reasoning instead of failing over.
|
|
34
|
+
dropToolReasoning?: boolean;
|
|
35
|
+
// GPT-6 falls back to its default effort when `reasoning_effort` is omitted, and
|
|
36
|
+
// that is rejected alongside tools too, so these tool requests send `none` unless
|
|
37
|
+
// the model declares its own off effort.
|
|
38
|
+
explicitToolReasoningOff?: boolean;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
export type DiscoveredModelFor<TApi extends LiteLLMApi> = Omit<Model<TApi>, "provider" | "baseUrl"> & {
|
|
@@ -56,6 +65,9 @@ export type LiteLLMModel = Model<LiteLLMApi> & {
|
|
|
56
65
|
export interface DiscoveryResult {
|
|
57
66
|
models: DiscoveredModel[];
|
|
58
67
|
source: DiscoverySource;
|
|
68
|
+
// Present only when a `/model/info` discovery had to read it and the proxy
|
|
69
|
+
// answered. Absent means unknown, not old: discovery asks only when it must.
|
|
70
|
+
proxyVersion?: ProxyVersion;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
export interface DiscoveryOptions {
|
|
@@ -82,7 +94,7 @@ export interface ModelInfoEntry {
|
|
|
82
94
|
mode?: string | null;
|
|
83
95
|
base_model?: string;
|
|
84
96
|
litellm_provider?: string;
|
|
85
|
-
supported_endpoints?: string[];
|
|
97
|
+
supported_endpoints?: string[] | null;
|
|
86
98
|
supported_openai_params?: string[];
|
|
87
99
|
input_cost_per_token?: number;
|
|
88
100
|
output_cost_per_token?: number;
|
|
@@ -138,6 +150,14 @@ export interface ResolvedCredentials {
|
|
|
138
150
|
apiKeyFromGcloudAdc?: boolean;
|
|
139
151
|
}
|
|
140
152
|
|
|
153
|
+
// The boolean MCP tool annotation hints, with the meaning Pi gives `ToolAnnotations`.
|
|
154
|
+
export interface McpToolAnnotations {
|
|
155
|
+
readOnlyHint?: boolean;
|
|
156
|
+
destructiveHint?: boolean;
|
|
157
|
+
idempotentHint?: boolean;
|
|
158
|
+
openWorldHint?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
141
161
|
export interface LiteLLMMcpTool {
|
|
142
162
|
name: string;
|
|
143
163
|
server_name: string;
|
|
@@ -147,6 +167,10 @@ export interface LiteLLMMcpTool {
|
|
|
147
167
|
input_schema: Record<string, unknown>;
|
|
148
168
|
// True when the proxy supplied an `inputSchema`/`input_schema` that was not a JSON object.
|
|
149
169
|
input_schema_malformed?: boolean;
|
|
170
|
+
// Boolean hints from the proxy-supplied `annotations`; every other annotation field is dropped.
|
|
171
|
+
annotations?: McpToolAnnotations;
|
|
172
|
+
// `mcp_info.description` of the server, when the proxy supplies one.
|
|
173
|
+
server_description?: string;
|
|
150
174
|
}
|
|
151
175
|
|
|
152
176
|
export interface LiteLLMSkill {
|