@jaypie/llm 1.2.32 → 1.2.34
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/cjs/index.cjs +196 -74
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/operate/adapters/OpenRouterAdapter.d.ts +20 -1
- package/dist/cjs/operate/retry/createStaleRejectionGuard.d.ts +19 -0
- package/dist/esm/index.js +196 -74
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operate/adapters/OpenRouterAdapter.d.ts +20 -1
- package/dist/esm/operate/retry/createStaleRejectionGuard.d.ts +19 -0
- package/package.json +1 -1
|
@@ -82,11 +82,26 @@ interface OpenRouterRequest {
|
|
|
82
82
|
user?: string;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* OpenRouter content part types
|
|
85
|
+
* OpenRouter content part types. OpenRouter follows the OpenAI Chat
|
|
86
|
+
* Completions multimodal schema and forwards `image_url` and `file` parts
|
|
87
|
+
* to vision/PDF-capable backends. The SDK accepts camelCase fields at the
|
|
88
|
+
* input boundary (`imageUrl`, `fileData`) and transforms to snake_case on
|
|
89
|
+
* the wire.
|
|
86
90
|
*/
|
|
87
91
|
type OpenRouterContentPart = {
|
|
88
92
|
type: "text";
|
|
89
93
|
text: string;
|
|
94
|
+
} | {
|
|
95
|
+
type: "image_url";
|
|
96
|
+
imageUrl: {
|
|
97
|
+
url: string;
|
|
98
|
+
};
|
|
99
|
+
} | {
|
|
100
|
+
type: "file";
|
|
101
|
+
file: {
|
|
102
|
+
filename?: string;
|
|
103
|
+
fileData: string;
|
|
104
|
+
};
|
|
90
105
|
};
|
|
91
106
|
/**
|
|
92
107
|
* OpenRouterAdapter implements the ProviderAdapter interface for OpenRouter's API.
|
|
@@ -101,6 +116,10 @@ export declare class OpenRouterAdapter extends BaseProviderAdapter {
|
|
|
101
116
|
rememberModelRejectsStructuredOutput(model: string): void;
|
|
102
117
|
clearRuntimeNoStructuredOutputModels(): void;
|
|
103
118
|
private supportsStructuredOutput;
|
|
119
|
+
private runtimeNoTemperatureModels;
|
|
120
|
+
rememberModelRejectsTemperature(model: string): void;
|
|
121
|
+
clearRuntimeNoTemperatureModels(): void;
|
|
122
|
+
private supportsTemperature;
|
|
104
123
|
buildRequest(request: OperateRequest): OpenRouterRequest;
|
|
105
124
|
formatTools(toolkit: Toolkit, _outputSchema?: JsonObject): ProviderToolDefinition[];
|
|
106
125
|
formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface StaleRejectionGuard {
|
|
2
|
+
/** Install the unhandledRejection listener (idempotent) */
|
|
3
|
+
install(): void;
|
|
4
|
+
/** Remove the listener and forget recorded errors */
|
|
5
|
+
remove(): void;
|
|
6
|
+
/** Record an error the retry loop has caught and is handling */
|
|
7
|
+
recordCaught(error: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create a guard that suppresses unhandled rejections firing as siblings of
|
|
11
|
+
* an error the retry loop has already caught. Provider SDKs occasionally
|
|
12
|
+
* surface a single upstream failure as twin rejections — the retry layer
|
|
13
|
+
* accepts responsibility for the first; this guard prevents the second from
|
|
14
|
+
* crashing the host while the retry is in flight.
|
|
15
|
+
*
|
|
16
|
+
* The guard also continues to suppress transient socket teardown errors
|
|
17
|
+
* (e.g. undici `TypeError: terminated`) emitted between attempts.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createStaleRejectionGuard(): StaleRejectionGuard;
|