backend-manager 3.2.77 → 3.2.78

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,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.2.77",
3
+ "version": "3.2.78",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -5,7 +5,7 @@ const _ = require('lodash');
5
5
  const JSON5 = require('json5');
6
6
 
7
7
  const TOKEN_COST_TABLE = {
8
- // Nov 6th, 2023
8
+ // Mar 6th, 2024
9
9
  'gpt-4-turbo-preview': {
10
10
  input: 0.0100,
11
11
  output: 0.0300,
@@ -19,9 +19,27 @@ const TOKEN_COST_TABLE = {
19
19
  output: 0.0600,
20
20
  },
21
21
  'gpt-3.5-turbo': {
22
- input: 0.0010,
23
- output: 0.0020,
22
+ input: 0.0005,
23
+ output: 0.0015,
24
24
  },
25
+
26
+ // Nov 6th, 2023
27
+ // 'gpt-4-turbo-preview': {
28
+ // input: 0.0100,
29
+ // output: 0.0300,
30
+ // },
31
+ // 'gpt-4-1106-preview': {
32
+ // input: 0.0100,
33
+ // output: 0.0300,
34
+ // },
35
+ // 'gpt-4': {
36
+ // input: 0.0300,
37
+ // output: 0.0600,
38
+ // },
39
+ // 'gpt-3.5-turbo': {
40
+ // input: 0.0010,
41
+ // output: 0.0020,
42
+ // },
25
43
  }
26
44
 
27
45
  function OpenAI(assistant, key) {
@@ -120,8 +138,7 @@ OpenAI.prototype.request = function (options) {
120
138
  }
121
139
 
122
140
  // Log
123
- _log('Starting', self.key);
124
- _log('Starting', options);
141
+ _log('Starting', self.key, options);
125
142
 
126
143
  // Load prompt
127
144
  const prompt = _load(options.prompt);
@@ -235,8 +252,10 @@ OpenAI.prototype.request = function (options) {
235
252
  // Request
236
253
  await _request('chatgpt', options)
237
254
  .then((r) => {
255
+ _log('Response', r);
256
+
257
+ // Try to parse JSON response if needed
238
258
  try {
239
- // Parse JSON response if needed
240
259
  const content = options.response === 'json' ? JSON5.parse(r) : r;
241
260
 
242
261
  // Return