@wengine-ai/llms 2.3.2422 → 2.3.2423
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/README.md +1 -0
- package/dist/ccr/request-pipeline.d.ts +6 -0
- package/dist/cjs/server.cjs +176 -194
- package/dist/cjs/server.cjs.map +3 -3
- package/dist/esm/server.mjs +176 -194
- package/dist/esm/server.mjs.map +3 -3
- package/dist/transformer/openai.responses.transformer.d.ts +23 -0
- package/package.json +2 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { UnifiedChatRequest } from "../types/llm";
|
|
2
2
|
import { Transformer } from "../types/transformer";
|
|
3
|
+
/**
|
|
4
|
+
* Response protocol the CLIENT expects for this attempt. Routes derive it from
|
|
5
|
+
* the client (endpoint + user agent) so the transformer chain knows which wire
|
|
6
|
+
* format to hand back instead of guessing from the upstream payload alone.
|
|
7
|
+
*/
|
|
8
|
+
export type ResponsesClientFormat = "responses" | "chat" | "anthropic";
|
|
3
9
|
export declare class OpenAIResponsesTransformer implements Transformer {
|
|
4
10
|
name: string;
|
|
5
11
|
endPoint: string;
|
|
@@ -9,6 +15,23 @@ export declare class OpenAIResponsesTransformer implements Transformer {
|
|
|
9
15
|
transformRequestIn(request: UnifiedChatRequest): Promise<UnifiedChatRequest>;
|
|
10
16
|
transformResponseOut(response: Response, context?: any): Promise<Response>;
|
|
11
17
|
private normalizeRequestContent;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve which protocol the client of THIS attempt expects. Routes set
|
|
20
|
+
* `responseTargetFormat` per attempt (client, not upstream). An unset format
|
|
21
|
+
* is backward compatible with the historical behavior: native Responses
|
|
22
|
+
* streams pass through untouched.
|
|
23
|
+
*/
|
|
24
|
+
private getClientFormat;
|
|
25
|
+
/**
|
|
26
|
+
* Convert a native Responses API SSE stream into Chat-completion chunks so a
|
|
27
|
+
* Chat/Anthropic client can consume it. Model identity comes from the
|
|
28
|
+
* `response` envelope of created/in_progress/completed events, terminal usage
|
|
29
|
+
* from `response.completed`, and each function call keeps its own tool_call
|
|
30
|
+
* index. A terminal failure is surfaced as an `error` event instead of an
|
|
31
|
+
* empty successful completion, and a stream that ends before any terminal
|
|
32
|
+
* event only reports `finish_reason` when it actually delivered content.
|
|
33
|
+
*/
|
|
34
|
+
private buildResponsesToChatStream;
|
|
12
35
|
transformResponseIn(response: Response, context?: any): Promise<Response>;
|
|
13
36
|
/**
|
|
14
37
|
* Convert an OpenAI Chat SSE stream to Responses API SSE events.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/llms",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2423",
|
|
4
4
|
"description": "A universal LLM API transformation server",
|
|
5
5
|
"main": "dist/cjs/server.cjs",
|
|
6
6
|
"module": "dist/esm/server.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^11.1.0",
|
|
65
65
|
"@fastify/multipart": "^9.0.0",
|
|
66
66
|
"@fastify/static": "^8.2.0",
|
|
67
|
-
"@wengine-ai/claude-code-router-shared": "^2.3.
|
|
67
|
+
"@wengine-ai/claude-code-router-shared": "^2.3.2423",
|
|
68
68
|
"adm-zip": "^0.5.16",
|
|
69
69
|
"better-sqlite3": "^12.10.0",
|
|
70
70
|
"rotating-file-stream": "^3.2.7"
|