@f5xc-salesdemos/pi-ai 19.7.0 → 19.9.0

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": "@f5xc-salesdemos/pi-ai",
4
- "version": "19.7.0",
4
+ "version": "19.9.0",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/f5xc-salesdemos/xcsh",
7
7
  "author": "Can Boluk",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/client-bedrock-runtime": "^3",
46
46
  "@bufbuild/protobuf": "^2.11",
47
47
  "@google/genai": "^1.43",
48
- "@f5xc-salesdemos/pi-utils": "19.7.0",
48
+ "@f5xc-salesdemos/pi-utils": "19.9.0",
49
49
  "@sinclair/typebox": "^0.34",
50
50
  "@smithy/node-http-handler": "^4.4",
51
51
  "ajv": "^8.20",
@@ -1144,7 +1144,7 @@ function disableThinkingIfToolChoiceForced(params: MessageCreateParamsStreaming)
1144
1144
 
1145
1145
  function ensureMaxTokensForThinking(params: MessageCreateParamsStreaming, model: Model<"anthropic-messages">): void {
1146
1146
  const thinking = params.thinking;
1147
- if (!thinking || thinking.type !== "enabled") return;
1147
+ if (thinking?.type !== "enabled") return;
1148
1148
 
1149
1149
  const budgetTokens = thinking.budget_tokens ?? 0;
1150
1150
  if (budgetTokens <= 0) return;
@@ -289,7 +289,7 @@ export const streamOpenAICompletions: StreamFunction<"openai-completions"> = (
289
289
  eventStream: AssistantMessageEventStream,
290
290
  text: string,
291
291
  ): void => {
292
- if (!currentBlock || currentBlock.type !== "text") {
292
+ if (currentBlock?.type !== "text") {
293
293
  finishCurrentBlock(currentBlock);
294
294
  currentBlock = { type: "text", text: "" };
295
295
  message.content.push(currentBlock);
@@ -310,8 +310,7 @@ export const streamOpenAICompletions: StreamFunction<"openai-completions"> = (
310
310
  signature?: string,
311
311
  ): void => {
312
312
  if (
313
- !currentBlock ||
314
- currentBlock.type !== "thinking" ||
313
+ currentBlock?.type !== "thinking" ||
315
314
  (signature !== undefined && currentBlock.thinkingSignature !== signature)
316
315
  ) {
317
316
  finishCurrentBlock(currentBlock);
@@ -456,11 +455,7 @@ export const streamOpenAICompletions: StreamFunction<"openai-completions"> = (
456
455
 
457
456
  if (choice?.delta?.tool_calls) {
458
457
  for (const toolCall of choice.delta.tool_calls) {
459
- if (
460
- !currentBlock ||
461
- currentBlock.type !== "toolCall" ||
462
- (toolCall.id && currentBlock.id !== toolCall.id)
463
- ) {
458
+ if (currentBlock?.type !== "toolCall" || (toolCall.id && currentBlock.id !== toolCall.id)) {
464
459
  finishCurrentBlock(currentBlock);
465
460
  currentBlock = {
466
461
  type: "toolCall",