@vertesia/common 0.79.3 → 0.79.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/common",
3
- "version": "0.79.3",
3
+ "version": "0.79.4",
4
4
  "type": "module",
5
5
  "types": "./lib/types/index.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "ajv": "^8.16.0",
29
29
  "json-schema": "^0.4.0",
30
- "@llumiverse/common": "0.22.2"
30
+ "@llumiverse/common": "0.22.3"
31
31
  },
32
32
  "ts_dual_module": {
33
33
  "outDir": "lib"
@@ -255,7 +255,8 @@ export interface InteractionExecutionPayload {
255
255
  */
256
256
  data?: Record<string, any> | `memory:${string}`;
257
257
  config?: InteractionExecutionConfiguration;
258
- result_schema?: JSONSchema4;
258
+ //Use null to explicitly state no schema, will not fallback to interaction schema
259
+ result_schema?: JSONSchema4 | null;
259
260
  stream?: boolean;
260
261
  do_validate?: boolean;
261
262
  tags?: string | string[]; // tags to be added to the execution run
@@ -5,6 +5,28 @@ import { InteractionRefWithSchema, PopulatedInteraction } from "../interaction.j
5
5
  import { PopulatedPromptSegmentDef, PromptSegmentDef, PromptSegmentDefType, PromptTemplateRefWithSchema } from "../prompt.js";
6
6
 
7
7
 
8
+ // Remove custom properties from the JSON before sending further down execution pipeline
9
+ export function removeExtraProperties<T>(schema: T): T {
10
+ if (!schema) return schema;
11
+ if (Array.isArray(schema)) {
12
+ for (const item of schema) {
13
+ removeExtraProperties(item);
14
+ }
15
+ } else if (typeof schema === 'object') {
16
+ const obj = schema as Record<string, any>;
17
+ for (const [key, value] of Object.entries(obj)) {
18
+ if (key === 'editor' && (value === 'textarea' || value === 'document' || value === 'media')) {
19
+ delete obj[key];
20
+ } else if (key === 'format' && (value === 'textarea' || value === 'document' || value === 'media')) {
21
+ delete obj[key];
22
+ } else if (typeof value === 'object') {
23
+ removeExtraProperties(value)
24
+ }
25
+ }
26
+ }
27
+ return schema;
28
+ }
29
+
8
30
  export function mergeJSONSchemas(schemas: JSONSchema[]) {
9
31
  const props: Record<string, JSONSchema4> = {};
10
32
  let required: string[] = [];