@saltcorn/large-language-model 0.3.3 → 0.3.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.
Files changed (2) hide show
  1. package/generate.js +7 -1
  2. package/package.json +1 -1
package/generate.js CHANGED
@@ -127,8 +127,14 @@ const getCompletionOpenAICompatible = async (
127
127
  body: JSON.stringify(body),
128
128
  });
129
129
  const results = await rawResponse.json();
130
+ //console.log(JSON.stringify(results, null, 2));
130
131
 
131
- return results?.choices?.[0]?.message?.content;
132
+ return (
133
+ results?.choices?.[0]?.message?.content ||
134
+ (results?.choices?.[0]?.message?.tool_calls
135
+ ? { tool_calls: results?.choices?.[0]?.message?.tool_calls }
136
+ : null)
137
+ );
132
138
  };
133
139
 
134
140
  const getEmbeddingOpenAICompatible = async (config, { prompt, model }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/large-language-model",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Large language models and functionality for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {