@oh-my-pi/pi-ai 14.9.0 → 14.9.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/package.json +3 -3
- package/src/providers/amazon-bedrock.ts +1 -1
- package/src/providers/anthropic.ts +8 -1
- package/src/providers/azure-openai-responses.ts +1 -1
- package/src/providers/google-gemini-cli.ts +1 -1
- package/src/providers/google-vertex.ts +1 -1
- package/src/providers/google.ts +1 -1
- package/src/providers/openai-responses.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-ai",
|
|
4
|
-
"version": "14.9.
|
|
4
|
+
"version": "14.9.1",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@aws-sdk/credential-provider-node": "^3.972.39",
|
|
47
47
|
"@bufbuild/protobuf": "^2.12.0",
|
|
48
48
|
"@google/genai": "^1.52.0",
|
|
49
|
-
"@oh-my-pi/pi-natives": "14.9.
|
|
50
|
-
"@oh-my-pi/pi-utils": "14.9.
|
|
49
|
+
"@oh-my-pi/pi-natives": "14.9.1",
|
|
50
|
+
"@oh-my-pi/pi-utils": "14.9.1",
|
|
51
51
|
"@sinclair/typebox": "^0.34.49",
|
|
52
52
|
"@smithy/node-http-handler": "^4.6.1",
|
|
53
53
|
"ajv": "^8.20.0",
|
|
@@ -259,7 +259,7 @@ export const streamBedrock: StreamFunction<"bedrock-converse-stream"> = (
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
if (output.stopReason === "error" || output.stopReason === "aborted") {
|
|
262
|
-
throw new Error("An unknown error occurred");
|
|
262
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
output.duration = Date.now() - startTime;
|
|
@@ -1195,6 +1195,13 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
|
|
1195
1195
|
output.stopReason = mapStopReason(event.delta.stop_reason);
|
|
1196
1196
|
sawTerminalEnvelope = true;
|
|
1197
1197
|
}
|
|
1198
|
+
const stopDetails = event.delta.stop_details;
|
|
1199
|
+
if (stopDetails && stopDetails.type === "refusal") {
|
|
1200
|
+
const explanation = stopDetails.explanation?.trim();
|
|
1201
|
+
const category = stopDetails.category;
|
|
1202
|
+
const label = category ? `Refusal (${category})` : "Refusal";
|
|
1203
|
+
output.errorMessage = explanation ? `${label}: ${explanation}` : label;
|
|
1204
|
+
}
|
|
1198
1205
|
if (event.usage.input_tokens != null) {
|
|
1199
1206
|
output.usage.input = event.usage.input_tokens;
|
|
1200
1207
|
}
|
|
@@ -1231,7 +1238,7 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
|
|
1231
1238
|
}
|
|
1232
1239
|
|
|
1233
1240
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
1234
|
-
throw new Error("An unknown error occurred");
|
|
1241
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
1235
1242
|
}
|
|
1236
1243
|
break;
|
|
1237
1244
|
} catch (streamError) {
|
|
@@ -172,7 +172,7 @@ export const streamAzureOpenAIResponses: StreamFunction<"azure-openai-responses"
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
175
|
-
throw new Error("An unknown error occurred");
|
|
175
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
output.duration = Date.now() - startTime;
|
|
@@ -748,7 +748,7 @@ export const streamGoogleGeminiCli: StreamFunction<"google-gemini-cli"> = (
|
|
|
748
748
|
}
|
|
749
749
|
|
|
750
750
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
751
|
-
throw new Error("An unknown error occurred");
|
|
751
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
output.duration = Date.now() - startTime;
|
|
@@ -287,7 +287,7 @@ export const streamGoogleVertex: StreamFunction<"google-vertex"> = (
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
290
|
-
throw new Error("An unknown error occurred");
|
|
290
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
output.duration = Date.now() - startTime;
|
package/src/providers/google.ts
CHANGED
|
@@ -267,7 +267,7 @@ export const streamGoogle: StreamFunction<"google-generative-ai"> = (
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
270
|
-
throw new Error("An unknown error occurred");
|
|
270
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
output.duration = Date.now() - startTime;
|
|
@@ -283,7 +283,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
286
|
-
throw new Error("An unknown error occurred");
|
|
286
|
+
throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
output.providerPayload = createOpenAIResponsesHistoryPayload(model.provider, nativeOutputItems);
|