@staticeng/opencode-litellm 0.1.1 → 0.1.2
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mapping.d.ts +0 -4
- package/dist/mapping.js +7 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const LiteLLMPlugin: (ctx: PluginInput, options?: LiteLLMPluginOp
|
|
|
4
4
|
config: (cfg: Config) => Promise<void>;
|
|
5
5
|
}>;
|
|
6
6
|
export default LiteLLMPlugin;
|
|
7
|
-
export { buildProvider, mapModels, normalizeModelListResponse, modelListResponseShape
|
|
7
|
+
export { buildProvider, mapModels, normalizeModelListResponse, modelListResponseShape } from "./mapping.js";
|
|
8
8
|
export { fetchModelInfo } from "./litellm.js";
|
|
9
9
|
export { deepMerge } from "./merge.js";
|
|
10
10
|
export type { LiteLLMPluginOptions, LiteLLMModelInfo, OpenCodeProvider, OpenCodeModel } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,6 @@ export const LiteLLMPlugin = async (ctx, options) => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export default LiteLLMPlugin;
|
|
37
|
-
export { buildProvider, mapModels, normalizeModelListResponse, modelListResponseShape
|
|
37
|
+
export { buildProvider, mapModels, normalizeModelListResponse, modelListResponseShape } from "./mapping.js";
|
|
38
38
|
export { fetchModelInfo } from "./litellm.js";
|
|
39
39
|
export { deepMerge } from "./merge.js";
|
package/dist/mapping.d.ts
CHANGED
|
@@ -8,10 +8,6 @@ export type ModelListResponseShape = {
|
|
|
8
8
|
scalarValueCount?: number;
|
|
9
9
|
};
|
|
10
10
|
export declare function modelListResponseShape(value: unknown): ModelListResponseShape;
|
|
11
|
-
export declare class LiteLLMModelListResponseError extends Error {
|
|
12
|
-
responseShape: ModelListResponseShape;
|
|
13
|
-
constructor(response: unknown);
|
|
14
|
-
}
|
|
15
11
|
export declare function normalizeModelListResponse(response: unknown): LiteLLMModelInfo[];
|
|
16
12
|
export declare function mapModels(response: unknown, options?: LiteLLMPluginOptions): {
|
|
17
13
|
[k: string]: OpenCodeModel;
|
package/dist/mapping.js
CHANGED
|
@@ -42,13 +42,11 @@ export function modelListResponseShape(value) {
|
|
|
42
42
|
scalarValueCount: values.filter((entry) => !isRecord(entry) && !Array.isArray(entry)).length,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.responseShape = modelListResponseShape(response);
|
|
51
|
-
}
|
|
45
|
+
function modelListResponseError(response) {
|
|
46
|
+
return Object.assign(new Error(MODEL_LIST_RESPONSE_ERROR_MESSAGE), {
|
|
47
|
+
name: "LiteLLMModelListResponseError",
|
|
48
|
+
responseShape: modelListResponseShape(response),
|
|
49
|
+
});
|
|
52
50
|
}
|
|
53
51
|
function asString(value) {
|
|
54
52
|
return typeof value === "string" && value.trim() ? value : undefined;
|
|
@@ -96,14 +94,14 @@ export function normalizeModelListResponse(response) {
|
|
|
96
94
|
return response[field];
|
|
97
95
|
}
|
|
98
96
|
if (MODEL_ARRAY_FIELDS.some((field) => field in response))
|
|
99
|
-
throw
|
|
97
|
+
throw modelListResponseError(response);
|
|
100
98
|
const mappedModels = Object.entries(response)
|
|
101
99
|
.map(([name, value]) => normalizeMappedModel(name, value))
|
|
102
100
|
.filter((model) => Boolean(model));
|
|
103
101
|
if (mappedModels.length > 0)
|
|
104
102
|
return mappedModels;
|
|
105
103
|
}
|
|
106
|
-
throw
|
|
104
|
+
throw modelListResponseError(response);
|
|
107
105
|
}
|
|
108
106
|
function mode(model) {
|
|
109
107
|
return asString(model.model_info?.mode) ?? "chat";
|