@f5-sales-demo/pi-ai 20.13.0 → 20.13.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-ai",
|
|
4
|
-
"version": "20.13.
|
|
4
|
+
"version": "20.13.2",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@anthropic-ai/sdk": "^0.115",
|
|
47
47
|
"@aws-sdk/client-bedrock-runtime": "^3",
|
|
48
48
|
"@bufbuild/protobuf": "^2.11",
|
|
49
|
-
"@f5-sales-demo/pi-utils": "20.13.
|
|
49
|
+
"@f5-sales-demo/pi-utils": "20.13.2",
|
|
50
50
|
"@google/genai": "^2.15",
|
|
51
51
|
"@sinclair/typebox": "^0.34",
|
|
52
52
|
"@smithy/node-http-handler": "^4.4",
|
|
@@ -689,6 +689,7 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
|
|
689
689
|
api: model.api as Api,
|
|
690
690
|
provider: model.provider,
|
|
691
691
|
model: model.id,
|
|
692
|
+
responseAttribution: { requestedModel: model.id },
|
|
692
693
|
usage: createEmptyUsage(copilotDynamicHeaders?.premiumRequests),
|
|
693
694
|
stopReason: "stop",
|
|
694
695
|
timestamp: Date.now(),
|
|
@@ -789,6 +790,13 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
|
|
789
790
|
}
|
|
790
791
|
sawMessageStart = true;
|
|
791
792
|
output.responseId = event.message.id;
|
|
793
|
+
if (event.message.model) {
|
|
794
|
+
output.responseAttribution = {
|
|
795
|
+
...(output.responseAttribution ?? { requestedModel: model.id }),
|
|
796
|
+
responseModel: event.message.model,
|
|
797
|
+
responseModelSource: "response-body",
|
|
798
|
+
};
|
|
799
|
+
}
|
|
792
800
|
output.usage.input = event.message.usage.input_tokens || 0;
|
|
793
801
|
output.usage.output = event.message.usage.output_tokens || 0;
|
|
794
802
|
output.usage.cacheRead = event.message.usage.cache_read_input_tokens || 0;
|
|
@@ -242,6 +242,13 @@ export async function processResponsesStream<TApi extends Api>(
|
|
|
242
242
|
for await (const event of openaiStream) {
|
|
243
243
|
if (event.type === "response.created") {
|
|
244
244
|
output.responseId = event.response.id;
|
|
245
|
+
if (event.response.model) {
|
|
246
|
+
output.responseAttribution = {
|
|
247
|
+
...(output.responseAttribution ?? { requestedModel: model.id }),
|
|
248
|
+
responseModel: event.response.model,
|
|
249
|
+
responseModelSource: "response-body",
|
|
250
|
+
};
|
|
251
|
+
}
|
|
245
252
|
} else if (event.type === "response.output_item.added") {
|
|
246
253
|
if (!sawFirstToken) {
|
|
247
254
|
sawFirstToken = true;
|
|
@@ -397,6 +404,13 @@ export async function processResponsesStream<TApi extends Api>(
|
|
|
397
404
|
}
|
|
398
405
|
} else if (event.type === "response.completed") {
|
|
399
406
|
const response = event.response;
|
|
407
|
+
if (response?.model) {
|
|
408
|
+
output.responseAttribution = {
|
|
409
|
+
...(output.responseAttribution ?? { requestedModel: model.id }),
|
|
410
|
+
responseModel: response.model,
|
|
411
|
+
responseModelSource: "response-body",
|
|
412
|
+
};
|
|
413
|
+
}
|
|
400
414
|
if (response?.id) {
|
|
401
415
|
output.responseId = response.id;
|
|
402
416
|
}
|
|
@@ -153,6 +153,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|
|
153
153
|
api: "openai-responses" as Api,
|
|
154
154
|
provider: model.provider,
|
|
155
155
|
model: model.id,
|
|
156
|
+
responseAttribution: { requestedModel: model.id },
|
|
156
157
|
usage: {
|
|
157
158
|
input: 0,
|
|
158
159
|
output: 0,
|
package/src/types.ts
CHANGED
|
@@ -362,6 +362,17 @@ export interface AssistantMessage {
|
|
|
362
362
|
api: Api;
|
|
363
363
|
provider: Provider;
|
|
364
364
|
model: string;
|
|
365
|
+
/**
|
|
366
|
+
* Transport evidence reported by the server. Unlike `provider` and `model`,
|
|
367
|
+
* these optional fields must never be populated from the request.
|
|
368
|
+
*/
|
|
369
|
+
responseAttribution?: {
|
|
370
|
+
requestedModel: string;
|
|
371
|
+
responseModel?: string;
|
|
372
|
+
responseModelSource?: "response-body" | "response-header";
|
|
373
|
+
upstreamProvider?: string;
|
|
374
|
+
upstreamProviderSource?: "response-body" | "response-header";
|
|
375
|
+
};
|
|
365
376
|
responseId?: string; // Provider-specific response/message identifier when the upstream API exposes one
|
|
366
377
|
usage: Usage;
|
|
367
378
|
stopReason: StopReason;
|