@scout9/app 1.0.0-alpha.0.4.7 → 1.0.0-alpha.0.4.9

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.
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Utility runtime class used to guide event output
2
+ * Utility runtime class for entity APIs methods
3
+ * @deprecated this is only valid for entity APIs, not workflow templates
3
4
  * @template T
4
5
  */
5
6
  export class EventResponse {
@@ -56,3 +57,4 @@ export class EventResponse {
56
57
 
57
58
  }
58
59
 
60
+
@@ -44,7 +44,8 @@ export async function did(prompt) {
44
44
  const {value} = (await (new Scout9Api(new Configuration({apiKey: process.env.SCOUT9_API_KEY}))).did(processPayload({
45
45
  prompt,
46
46
  convoId,
47
- event
47
+ event,
48
+ cache: !event.context?.__no_cache
48
49
  }))
49
50
  .then(handleAxiosResponse)
50
51
  .catch((err) => {
@@ -76,7 +77,8 @@ export async function does(prompt, relation = 'customer') {
76
77
  prompt,
77
78
  convoId,
78
79
  role: relation,
79
- event
80
+ event,
81
+ cache: !event.context?.__no_cache
80
82
  })
81
83
  )
82
84
  .then(handleAxiosResponse)
@@ -122,7 +124,8 @@ export async function context(prompt, examples) {
122
124
  prompt,
123
125
  examples,
124
126
  convoId,
125
- event
127
+ event,
128
+ cache: !event.context?.__no_cache
126
129
  }))
127
130
  .then(handleAxiosResponse)
128
131
  .catch((err) => {
@@ -3,6 +3,7 @@ import { zId } from './utils.js';
3
3
 
4
4
  export const ConversationContext = z.record(
5
5
  z.union([
6
+ z.any(),
6
7
  z.string(),
7
8
  z.number(),
8
9
  z.boolean(),
@@ -123,7 +123,7 @@ export class Scout9Test {
123
123
  this._cwd = cwd;
124
124
  this._src = src;
125
125
  this._mode = mode;
126
- this.context = context || {};
126
+ this.context = {...(context || {}), __no_cache: true};
127
127
  this.conversation = conversation;
128
128
  if (api) {
129
129
  this._api = api;
@@ -470,10 +470,10 @@ export const Spirits = {
470
470
  addInstruction(instruction.content, previousLockAttempt, instruction.id);
471
471
  }
472
472
  }
473
- } else if (typeof instructions === 'object' && 'content' in instructions && 'id' in instructions) {
473
+ } else if (typeof instructions === 'object' && 'content' in instructions) {
474
474
  addInstruction(instructions.content, previousLockAttempt, instructions.id);
475
475
  } else {
476
- throw new Error('SpiritsError: instructions must be a string or array or {content: "", id: ""}');
476
+ throw new Error(`SpiritsError: instructions must be a string or array or {content: "<instruction>"}, got: ${JSON.stringify(instructions)}`);
477
477
  }
478
478
  }
479
479