pi-provider-litellm 3.3.0 → 4.0.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 +18 -60
- package/package.json +3 -3
- package/src/backend-identity.ts +1 -1
- package/src/discover.ts +67 -8
- package/src/index.ts +128 -399
- package/src/model-groups.ts +4 -1
- package/src/provider.ts +1 -1
- package/src/skills.ts +1 -2
- package/src/types.ts +9 -24
- package/src/mcp-tools.ts +0 -1536
package/src/model-groups.ts
CHANGED
|
@@ -798,9 +798,12 @@ export function reduceModelGroup(
|
|
|
798
798
|
// Strict tools require affirmative evidence from every routable deployment.
|
|
799
799
|
const messagesStrictTools =
|
|
800
800
|
catalogs.length > 0 && catalogs.every((catalog) => catalog?.messagesStrictTools === true) ? true : undefined;
|
|
801
|
+
// LiteLLM v1.100+ reports `supported_endpoints: null` for every model its model map does not
|
|
802
|
+
// list, so null means unknown, like an absent field. Only a list without Messages, or a
|
|
803
|
+
// malformed non-null value, withholds the transport.
|
|
801
804
|
const messagesEndpointAllowed = deployments.every((entry) => {
|
|
802
805
|
const endpoints = entry.model_info?.supported_endpoints;
|
|
803
|
-
return endpoints
|
|
806
|
+
return endpoints == null || (Array.isArray(endpoints) && endpoints.includes("/v1/messages"));
|
|
804
807
|
});
|
|
805
808
|
const api = candidateModes.every((mode) => mode === "responses")
|
|
806
809
|
? "openai-responses"
|
package/src/provider.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type LiteLLMProviderOptions = {
|
|
|
29
29
|
discover(credential: Credential, signal?: AbortSignal): Promise<DiscoveryResult & { baseUrl?: string }>;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
// Chat models may omit `type
|
|
32
|
+
// Chat models may omit `type`.
|
|
33
33
|
function isChatModel(model: AnyModel): model is Model<Api> {
|
|
34
34
|
return (model.type ?? "chat") === "chat";
|
|
35
35
|
}
|
package/src/skills.ts
CHANGED
|
@@ -169,8 +169,7 @@ function parseJsonObject(value: string, fieldName: string): Record<string, unkno
|
|
|
169
169
|
return parsed as Record<string, unknown>;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
// Pi
|
|
173
|
-
// Pi ignores both fields.
|
|
172
|
+
// Pi groups tools by namespace and lets permission extensions read annotation hints.
|
|
174
173
|
const SKILLS_NAMESPACE = { name: "litellm_skills", description: "LiteLLM Skills Gateway" };
|
|
175
174
|
|
|
176
175
|
export function createSkillToolDefinitions(
|
package/src/types.ts
CHANGED
|
@@ -28,6 +28,14 @@ export interface LiteLLMModelPolicy {
|
|
|
28
28
|
// Gemini-backed deployments require lowercase effort values. Discovery carries
|
|
29
29
|
// this evidence so the request hook does not infer a backend from the route name.
|
|
30
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;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export type DiscoveredModelFor<TApi extends LiteLLMApi> = Omit<Model<TApi>, "provider" | "baseUrl"> & {
|
|
@@ -86,7 +94,7 @@ export interface ModelInfoEntry {
|
|
|
86
94
|
mode?: string | null;
|
|
87
95
|
base_model?: string;
|
|
88
96
|
litellm_provider?: string;
|
|
89
|
-
supported_endpoints?: string[];
|
|
97
|
+
supported_endpoints?: string[] | null;
|
|
90
98
|
supported_openai_params?: string[];
|
|
91
99
|
input_cost_per_token?: number;
|
|
92
100
|
output_cost_per_token?: number;
|
|
@@ -142,29 +150,6 @@ export interface ResolvedCredentials {
|
|
|
142
150
|
apiKeyFromGcloudAdc?: boolean;
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
// The boolean MCP tool annotation hints, with the meaning Pi gives `ToolAnnotations`.
|
|
146
|
-
export interface McpToolAnnotations {
|
|
147
|
-
readOnlyHint?: boolean;
|
|
148
|
-
destructiveHint?: boolean;
|
|
149
|
-
idempotentHint?: boolean;
|
|
150
|
-
openWorldHint?: boolean;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface LiteLLMMcpTool {
|
|
154
|
-
name: string;
|
|
155
|
-
server_name: string;
|
|
156
|
-
server_id?: string;
|
|
157
|
-
description: string;
|
|
158
|
-
// Absent or `{}` means the proxy supplied no schema; both use the extension-owned envelope.
|
|
159
|
-
input_schema: Record<string, unknown>;
|
|
160
|
-
// True when the proxy supplied an `inputSchema`/`input_schema` that was not a JSON object.
|
|
161
|
-
input_schema_malformed?: boolean;
|
|
162
|
-
// Boolean hints from the proxy-supplied `annotations`; every other annotation field is dropped.
|
|
163
|
-
annotations?: McpToolAnnotations;
|
|
164
|
-
// `mcp_info.description` of the server, when the proxy supplies one.
|
|
165
|
-
server_description?: string;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
153
|
export interface LiteLLMSkill {
|
|
169
154
|
id?: string;
|
|
170
155
|
name: string;
|