@steipete/oracle 0.4.3 → 0.4.4
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { APIConnectionError, APIConnectionTimeoutError, APIUserAbortError
|
|
1
|
+
import { APIConnectionError, APIConnectionTimeoutError, APIUserAbortError } from 'openai';
|
|
2
|
+
import { APIError } from 'openai/error';
|
|
2
3
|
import { formatElapsed } from './format.js';
|
|
3
4
|
export class OracleUserError extends Error {
|
|
4
5
|
category;
|
|
@@ -86,6 +87,11 @@ export function toTransportError(error) {
|
|
|
86
87
|
if (error instanceof APIConnectionError) {
|
|
87
88
|
return new OracleTransportError('connection-lost', 'Connection to OpenAI dropped before the response completed.', error);
|
|
88
89
|
}
|
|
90
|
+
if (error instanceof APIError) {
|
|
91
|
+
if (error.status === 404 || error.status === 405) {
|
|
92
|
+
return new OracleTransportError('unsupported-endpoint', 'HTTP 404/405 from the Responses API; this base URL or gateway likely does not expose /v1/responses. Set OPENAI_BASE_URL to api.openai.com/v1, update your Azure API version/deployment, or use the browser engine.', error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
89
95
|
return new OracleTransportError('unknown', error instanceof Error ? error.message : 'Unknown transport failure.', error);
|
|
90
96
|
}
|
|
91
97
|
export function describeTransportError(error, deadlineMs) {
|
|
@@ -98,6 +104,8 @@ export function describeTransportError(error, deadlineMs) {
|
|
|
98
104
|
return 'Connection to OpenAI ended unexpectedly before the response completed.';
|
|
99
105
|
case 'client-abort':
|
|
100
106
|
return 'Request was aborted before OpenAI completed the response.';
|
|
107
|
+
case 'unsupported-endpoint':
|
|
108
|
+
return 'The Responses API returned 404/405 — your base URL/gateway probably lacks /v1/responses (check OPENAI_BASE_URL or switch to api.openai.com / browser engine).';
|
|
101
109
|
default:
|
|
102
110
|
return 'OpenAI streaming call ended with an unknown transport error.';
|
|
103
111
|
}
|
package/package.json
CHANGED