@contentgrowth/llm-service 1.2.3 → 1.2.4

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/index.d.cts CHANGED
@@ -517,7 +517,10 @@ declare class GoogleProvider extends BaseLLMProvider {
517
517
  thought_signature: any;
518
518
  tool_calls: {
519
519
  type: string;
520
- function: _google_genai.FunctionCall;
520
+ function: {
521
+ name: string;
522
+ arguments: string;
523
+ };
521
524
  thought_signature: any;
522
525
  }[];
523
526
  finishReason: string;
@@ -536,7 +539,10 @@ declare class GoogleProvider extends BaseLLMProvider {
536
539
  thought_signature: any;
537
540
  tool_calls: {
538
541
  type: string;
539
- function: _google_genai.FunctionCall;
542
+ function: {
543
+ name: string;
544
+ arguments: string;
545
+ };
540
546
  thought_signature: any;
541
547
  }[];
542
548
  finishReason: string;
package/dist/index.d.ts CHANGED
@@ -517,7 +517,10 @@ declare class GoogleProvider extends BaseLLMProvider {
517
517
  thought_signature: any;
518
518
  tool_calls: {
519
519
  type: string;
520
- function: _google_genai.FunctionCall;
520
+ function: {
521
+ name: string;
522
+ arguments: string;
523
+ };
521
524
  thought_signature: any;
522
525
  }[];
523
526
  finishReason: string;
@@ -536,7 +539,10 @@ declare class GoogleProvider extends BaseLLMProvider {
536
539
  thought_signature: any;
537
540
  tool_calls: {
538
541
  type: string;
539
- function: _google_genai.FunctionCall;
542
+ function: {
543
+ name: string;
544
+ arguments: string;
545
+ };
540
546
  thought_signature: any;
541
547
  }[];
542
548
  finishReason: string;
package/dist/index.js CHANGED
@@ -726,8 +726,20 @@ ${msg.content}`;
726
726
  const isLastAssistantMessage = index === geminiMessages.map((m, i) => m.role === "assistant" ? i : -1).filter((i) => i >= 0).pop();
727
727
  if (msg.tool_calls) {
728
728
  parts2 = msg.tool_calls.map((tc) => {
729
+ let args = tc.function.args;
730
+ if (tc.function.arguments) {
731
+ if (typeof tc.function.arguments === "string") {
732
+ try {
733
+ args = JSON.parse(tc.function.arguments);
734
+ } catch (e) {
735
+ args = {};
736
+ }
737
+ } else {
738
+ args = tc.function.arguments;
739
+ }
740
+ }
729
741
  const part = {
730
- functionCall: { name: tc.function.name, args: tc.function.arguments || tc.function.args }
742
+ functionCall: { name: tc.function.name, args }
731
743
  };
732
744
  if (tc.thought_signature) {
733
745
  part.thoughtSignature = tc.thought_signature;
@@ -812,7 +824,10 @@ ${msg.content}`;
812
824
  thought_signature: responseThoughtSignature,
813
825
  tool_calls: toolCalls ? (Array.isArray(toolCalls) ? toolCalls : [toolCalls]).map((fc) => ({
814
826
  type: "function",
815
- function: fc,
827
+ function: {
828
+ name: fc.name,
829
+ arguments: JSON.stringify(fc.args || {})
830
+ },
816
831
  thought_signature: fc.thought_signature
817
832
  })) : null,
818
833
  finishReason: normalizedFinishReason,