ai-functions 0.2.14 → 0.2.16

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.
@@ -61,11 +61,11 @@ const generateSchema = (propDescriptions) => {
61
61
  const itemType = typeof itemValue;
62
62
  if (itemType == 'string') {
63
63
  // If the item is a string, then it is an array of strings
64
- return { type: 'array', description: itemValue, items: { type: 'string' } };
64
+ properties[key] = { type: 'array', description: itemValue, items: { type: 'string' } };
65
65
  }
66
66
  else if (itemType == 'object') {
67
67
  // If the item is an object, then it is an array of objects, and get the schema for the object
68
- return { type: 'array', items: (0, exports.generateSchema)(itemValue) };
68
+ properties[key] = { type: 'array', items: (0, exports.generateSchema)(itemValue) };
69
69
  }
70
70
  }
71
71
  else {
@@ -57,11 +57,11 @@ export const generateSchema = (propDescriptions) => {
57
57
  const itemType = typeof itemValue;
58
58
  if (itemType == 'string') {
59
59
  // If the item is a string, then it is an array of strings
60
- return { type: 'array', description: itemValue, items: { type: 'string' } };
60
+ properties[key] = { type: 'array', description: itemValue, items: { type: 'string' } };
61
61
  }
62
62
  else if (itemType == 'object') {
63
63
  // If the item is an object, then it is an array of objects, and get the schema for the object
64
- return { type: 'array', items: generateSchema(itemValue) };
64
+ properties[key] = { type: 'array', items: generateSchema(itemValue) };
65
65
  }
66
66
  }
67
67
  else {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "ai-functions",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "Library for Developing and Managing AI Functions (including OpenAI GPT4 / GPT3.5)",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/mjs/index.js",
7
7
  "exports": {
8
- ".": {
9
- "import": "./dist/mjs/index.js",
10
- "require": "./dist/cjs/index.js"
11
- }
8
+ ".": {
9
+ "import": "./dist/mjs/index.js",
10
+ "require": "./dist/cjs/index.js"
11
+ }
12
12
  },
13
13
  "scripts": {
14
14
  "build": "tsc",
@@ -48,7 +48,7 @@
48
48
  "kafkajs": "^2.2.4",
49
49
  "lodash-es": "^4.17.21",
50
50
  "mongodb": "^6.2.0",
51
- "openai": "^4.16.1",
51
+ "openai": "^4.26.0",
52
52
  "p-queue": "^7.4.1",
53
53
  "partial-json-parser": "^1.2.2",
54
54
  "xstate": "^5.0.0-beta.40"
package/utils/schema.ts CHANGED
@@ -60,10 +60,10 @@ export const generateSchema = (propDescriptions: Record<string, string | Record<
60
60
  const itemType = typeof itemValue
61
61
  if (itemType == 'string') {
62
62
  // If the item is a string, then it is an array of strings
63
- return { type: 'array', description: itemValue, items: { type: 'string' }}
63
+ properties[key] = { type: 'array', description: itemValue, items: { type: 'string' }}
64
64
  } else if (itemType == 'object') {
65
65
  // If the item is an object, then it is an array of objects, and get the schema for the object
66
- return { type: 'array', items: generateSchema(itemValue)}
66
+ properties[key] = { type: 'array', items: generateSchema(itemValue)}
67
67
  }
68
68
  } else {
69
69
  throw new Error(`Invalid description for key "${key}".`)