@arnilo/prism-provider-zai 0.2.9 → 0.3.1
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/models.js +2 -2
- package/dist/provider.js +2 -1
- package/package.json +2 -2
package/dist/models.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { redactSecrets, resolveCredentialValue, } from "@arnilo/prism";
|
|
1
|
+
import { redactSecrets, resolveCredentialValue, trimTrailingSlashes, } from "@arnilo/prism";
|
|
2
2
|
import { readBoundedResponseJson, readBoundedResponseText } from "@arnilo/prism/providers/transport";
|
|
3
3
|
export function defineZaiModel(config) {
|
|
4
4
|
return {
|
|
@@ -24,7 +24,7 @@ export function defineZaiModel(config) {
|
|
|
24
24
|
*/
|
|
25
25
|
export async function listZaiModels(options = {}) {
|
|
26
26
|
const provider = options.provider ?? "zai";
|
|
27
|
-
const baseUrl = (options.baseUrl ?? "https://api.z.ai/api/paas/v4")
|
|
27
|
+
const baseUrl = trimTrailingSlashes(options.baseUrl ?? "https://api.z.ai/api/paas/v4");
|
|
28
28
|
const token = await resolveCredentialValue(options.apiKey, { provider, name: "apiKey" });
|
|
29
29
|
const response = await (options.fetch ?? fetch)(`${baseUrl}/models`, {
|
|
30
30
|
method: "GET",
|
package/dist/provider.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { trimTrailingSlashes } from "@arnilo/prism";
|
|
1
2
|
import { applyOpenAIChatStructuredOutput } from "@arnilo/prism/providers/openai";
|
|
2
3
|
import { buildOpenAIChatBody, createOpenAICompatibleProvider, openAIChatEvents } from "@arnilo/prism/providers/openai-compatible";
|
|
3
4
|
import { zaiPreserveThinking, zaiReasoningEffort, zaiThinking, zaiToolStream } from "./thinking.js";
|
|
@@ -6,7 +7,7 @@ export const ZAI_DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4";
|
|
|
6
7
|
export function createZaiProvider(options = {}) {
|
|
7
8
|
return createOpenAICompatibleProvider({
|
|
8
9
|
id: options.id ?? "zai",
|
|
9
|
-
baseUrl: (options.baseUrl ?? ZAI_DEFAULT_BASE_URL)
|
|
10
|
+
baseUrl: trimTrailingSlashes(options.baseUrl ?? ZAI_DEFAULT_BASE_URL),
|
|
10
11
|
apiKey: options.apiKey,
|
|
11
12
|
fetch: options.fetch,
|
|
12
13
|
doneUsage: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism-provider-zai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Z.AI provider package for Prism.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pack:dry-run": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@arnilo/prism": "0.
|
|
28
|
+
"@arnilo/prism": "^0.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@arnilo/prism": "file:../.."
|