@steve31415/baselib 3.8.2 → 3.8.3
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/llm/complete.js +7 -1
- package/dist/llm/types.d.ts +3 -2
- package/dist/llm/types.js +1 -1
- package/package.json +1 -1
package/dist/llm/complete.js
CHANGED
|
@@ -126,7 +126,13 @@ export async function llmComplete(request) {
|
|
|
126
126
|
request.logger?.warn('llm.failover_attempt', {
|
|
127
127
|
failedModel: modelName,
|
|
128
128
|
failedProvider: modelEntry.provider,
|
|
129
|
-
|
|
129
|
+
// Provider/network/parse errors can echo prompts, credentials or private
|
|
130
|
+
// response bodies. Keep their text in the returned API only, never logs.
|
|
131
|
+
errorClass: err instanceof LLMError ? 'LLMError' : err instanceof Error ? 'Error' : 'NonError',
|
|
132
|
+
...(err instanceof LLMError && typeof err.statusCode === 'number' && Number.isFinite(err.statusCode)
|
|
133
|
+
? { statusCode: err.statusCode } : {}),
|
|
134
|
+
isRetryable: err instanceof LLMError && err.isRetryable === true,
|
|
135
|
+
declined: err instanceof LLMError && err.declined === true,
|
|
130
136
|
attemptNumber: failedAttempts.length,
|
|
131
137
|
nextModel: modelsToTry[failedAttempts.length] ?? 'none',
|
|
132
138
|
});
|
package/dist/llm/types.d.ts
CHANGED
|
@@ -116,18 +116,19 @@ export interface LLMResponse {
|
|
|
116
116
|
latencyMs: number;
|
|
117
117
|
/** True if the primary model failed and a fallback was used. */
|
|
118
118
|
failedOver: boolean;
|
|
119
|
-
/** Details of each failed attempt before
|
|
119
|
+
/** Details of each failed attempt before success; error text can contain private input. Do not log verbatim. */
|
|
120
120
|
failedAttempts: FailedAttempt[];
|
|
121
121
|
}
|
|
122
122
|
/** Details of a failed provider attempt. */
|
|
123
123
|
export interface FailedAttempt {
|
|
124
124
|
provider: ProviderName;
|
|
125
125
|
model: string;
|
|
126
|
+
/** Provider detail may echo private input or credentials. Do not log verbatim. */
|
|
126
127
|
error: string;
|
|
127
128
|
/** True when this attempt failed because the model declined (vs. an infra error). */
|
|
128
129
|
declined?: boolean;
|
|
129
130
|
}
|
|
130
|
-
/** Error thrown when an LLM provider call fails. */
|
|
131
|
+
/** Error thrown when an LLM provider call fails. Its message may contain private input; do not log verbatim. */
|
|
131
132
|
export declare class LLMError extends Error {
|
|
132
133
|
provider: ProviderName;
|
|
133
134
|
model: string;
|
package/dist/llm/types.js
CHANGED
package/package.json
CHANGED