190proof 1.0.3 → 1.0.5

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.mjs CHANGED
@@ -31427,11 +31427,15 @@ function parseStreamedResponse(identifier, paragraph, functionCallName, function
31427
31427
  "Stream error: received function call with unknown name: " + functionCallName
31428
31428
  );
31429
31429
  }
31430
- functionCall = {
31431
- name: functionCallName,
31432
- arguments: JSON.parse(functionCallArgs)
31433
- // allow JSON.parse to throw
31434
- };
31430
+ try {
31431
+ functionCall = {
31432
+ name: functionCallName,
31433
+ arguments: JSON.parse(functionCallArgs)
31434
+ };
31435
+ } catch (error) {
31436
+ console.error("Error parsing functionCallArgs:", functionCallArgs);
31437
+ throw error;
31438
+ }
31435
31439
  }
31436
31440
  if (!paragraph && !functionCall) {
31437
31441
  console.error(
@@ -31528,6 +31532,7 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31528
31532
  baseUrl: defaultOpenAIBaseUrl
31529
31533
  };
31530
31534
  }
31535
+ console.log("payload", openAiPayload);
31531
31536
  let response;
31532
31537
  const controller = new AbortController();
31533
31538
  if (openAiConfig.service === "azure") {
@@ -31903,7 +31908,8 @@ function prepareOpenAIPayload(payload) {
31903
31908
  content: normalizeMessageContent(message.content)
31904
31909
  // TODO: Handle files
31905
31910
  })),
31906
- functions: payload.functions
31911
+ functions: payload.functions,
31912
+ function_call: payload.function_call
31907
31913
  };
31908
31914
  }
31909
31915
  function isGroqPayload(payload) {
@@ -31917,10 +31923,15 @@ function prepareGroqPayload(payload) {
31917
31923
  role: message.role,
31918
31924
  content: normalizeMessageContent(message.content)
31919
31925
  })),
31920
- functions: (_a3 = payload.functions) == null ? void 0 : _a3.map((fn) => ({
31926
+ tools: (_a3 = payload.functions) == null ? void 0 : _a3.map((fn) => ({
31921
31927
  type: "function",
31922
31928
  function: fn
31923
- }))
31929
+ })),
31930
+ tool_choice: payload.function_call ? typeof payload.function_call === "string" ? payload.function_call : {
31931
+ type: "function",
31932
+ function: payload.function_call
31933
+ } : void 0,
31934
+ temperature: payload.temperature
31924
31935
  };
31925
31936
  }
31926
31937
  function normalizeMessageContent(content) {
@@ -31929,11 +31940,7 @@ function normalizeMessageContent(content) {
31929
31940
  async function callGroq(identifier, payload) {
31930
31941
  const response = await axios_default.post(
31931
31942
  "https://api.groq.com/openai/v1/chat/completions",
31932
- {
31933
- model: payload.model,
31934
- messages: payload.messages,
31935
- tools: payload.functions
31936
- },
31943
+ payload,
31937
31944
  {
31938
31945
  headers: {
31939
31946
  "content-type": "application/json",