backend-manager 3.2.27 → 3.2.29

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.27",
3
+ "version": "3.2.29",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -266,8 +266,11 @@ Module.prototype.addToSendGridList = function (user) {
266
266
  body: {
267
267
  backendManagerKey: Manager.config.backend_manager.key,
268
268
  service: 'sendgrid',
269
- command: `/v3/marketing/contacts`,
269
+ command: `v3/marketing/contacts`,
270
270
  method: `put`,
271
+ supplemental: {
272
+ user: user,
273
+ },
271
274
  body: {
272
275
  contacts: [
273
276
  {
@@ -5,6 +5,10 @@ const _ = require('lodash');
5
5
 
6
6
  const TOKEN_COST_TABLE = {
7
7
  // Nov 6th, 2023
8
+ 'gpt-4-turbo-preview': {
9
+ input: 0.0100,
10
+ output: 0.0300,
11
+ },
8
12
  'gpt-4-1106-preview': {
9
13
  input: 0.0100,
10
14
  output: 0.0300,
@@ -60,10 +64,12 @@ OpenAI.prototype.request = function (options) {
60
64
 
61
65
  options.prompt = options.prompt || {};
62
66
  options.prompt.path = options.prompt.path || '';
67
+ options.prompt.content = options.prompt.content || '';
63
68
  options.prompt.settings = options.prompt.settings || {};
64
69
 
65
70
  options.message = options.message || {};
66
71
  options.message.path = options.message.path || '';
72
+ options.message.content = options.message.content || '';
67
73
  options.message.settings = options.message.settings || {};
68
74
 
69
75
  options.history = options.history || {};
@@ -77,15 +83,17 @@ OpenAI.prototype.request = function (options) {
77
83
  assistant.log('callOpenAI(): Starting', self.key);
78
84
  assistant.log('callOpenAI(): Starting', options);
79
85
 
86
+ function _load(input) {
87
+ return powertools.template(
88
+ input.content || jetpack.read(input.path),
89
+ input.settings,
90
+ )
91
+ .trim();
92
+ }
93
+
80
94
  // Load prompt
81
- const prompt = powertools.template(
82
- jetpack.read(options.prompt.path),
83
- options.prompt.settings,
84
- ).trim();
85
- const message = powertools.template(
86
- jetpack.read(options.message.path),
87
- options.message.settings,
88
- ).trim();
95
+ const prompt = _load(options.prompt);
96
+ const message = _load(options.message);
89
97
  const user = options.user?.auth?.uid || assistant.request.geolocation.ip;
90
98
  const responseFormat = options.response === 'json' && !options.model.includes('gpt-3.5')
91
99
  ? { type: 'json_object' }