@builder.io/ai-utils 0.0.22 → 0.0.24

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.
@@ -10,7 +10,9 @@ export interface CompletionOptions {
10
10
  */
11
11
  assistantType?: string;
12
12
  /**
13
- * Model identifier to lookup which sdk and model to use. If not provided the default model will be used.
13
+ * LLM Model identifier to lookup which sdk and model to use.
14
+ * If not provided the default model will be used.
15
+ * Note: This is not the Builder.io data model.
14
16
  */
15
17
  modelId?: string;
16
18
  /**
@@ -37,47 +39,58 @@ export interface CompletionOptions {
37
39
  * User id is stored in localStorage for this domain, its not the builder user id.
38
40
  */
39
41
  userId: string;
42
+ /**
43
+ * The state of the builder editor.
44
+ */
45
+ builderState?: BuiderEditorState;
46
+ /**
47
+ * Persist the thread conversation context.
48
+ * Defaults to `true`.
49
+ */
50
+ persistThread?: boolean;
51
+ /**
52
+ * Additional console logs
53
+ */
54
+ debug?: boolean;
55
+ /**
56
+ * Date.now() timestamp of when the assistant was started.
57
+ * This is used to calculate the time taken between all events.
58
+ */
59
+ startMs?: number;
60
+ }
61
+ export interface BuiderEditorState {
40
62
  /**
41
63
  * The active locale of the builder editor.
42
64
  */
43
- builderActiveLocale?: string;
65
+ activeLocale?: string;
44
66
  /**
45
67
  * The locale of the provided builder content.
46
68
  */
47
- builderContentLocale?: string;
69
+ contentLocale?: string;
48
70
  /**
49
71
  * Top level Builder content. The data.blocks array contains the BuilderElement.
50
72
  */
51
- builderContent?: BuilderContent;
73
+ content?: BuilderContent;
52
74
  /**
53
75
  * Builder custom components.
54
76
  */
55
- builderComponents?: Component[];
77
+ components?: Component[];
56
78
  /**
57
79
  * Builder design tokens.
58
80
  */
59
- builderDesignTokens?: Record<string, string>;
81
+ designTokens?: Record<string, string>;
60
82
  /**
61
- * Builder model.
83
+ * Builder model. (not the LLM model)
62
84
  */
63
- builderModel?: BuilderModel;
85
+ model?: BuilderModel;
64
86
  /**
65
87
  * Selected ids in the builder.
66
88
  */
67
- builderSelectedIds?: string[];
89
+ selectedIds?: string[];
68
90
  /**
69
91
  * Builder space id.
70
92
  */
71
- builderSpaceId?: string;
72
- /**
73
- * Additional console logs
74
- */
75
- debug?: boolean;
76
- /**
77
- * Date.now() timestamp of when the assistant was started.
78
- * This is used to calculate the time taken between all
79
- */
80
- start: number;
93
+ spaceId?: string;
81
94
  }
82
95
  export type OnPromptSubmit = (opts: {
83
96
  prompt?: string;
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BuilderContent, BuilderElement, Component } from "@builder.io/sdk";
1
+ import type { BuilderContent, BuilderElement } from "@builder.io/sdk";
2
2
  import type { Thread } from "./thread";
3
3
  import type { AssistantMessage } from "./messages";
4
4
  import { AssistantSettings } from "./settings";
@@ -67,16 +67,6 @@ export interface ResultEvent {
67
67
  resolveId: string;
68
68
  data: any;
69
69
  }
70
- export interface BuiderEditorState {
71
- activeLocale?: string;
72
- contentLocale?: string;
73
- content?: BuilderContent;
74
- components?: Component[];
75
- designTokens?: Record<string, string>;
76
- model?: BuilderModel;
77
- selectedIds?: string[];
78
- spaceId?: string;
79
- }
80
70
  export interface ContentCreatePatch {
81
71
  parentId: string;
82
72
  insertBeforeId: string;
@@ -131,6 +121,9 @@ export interface ContentCompleteEvent {
131
121
  }
132
122
  export interface ContentComplete {
133
123
  threadId: string;
124
+ completionId: string;
125
+ modelId: string;
126
+ duration: number;
134
127
  message: AssistantMessage;
135
128
  ts: number;
136
129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",