@builder.io/ai-utils 0.0.40 → 0.0.42
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/dist/completion.d.ts +9 -3
- package/dist/events.d.ts +13 -3
- package/dist/messages.d.ts +1 -17
- package/dist/settings.d.ts +0 -9
- package/package.json +2 -2
package/dist/completion.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderContent, BuilderElement, Component } from "@builder.io/sdk";
|
|
2
|
-
import type { Message, MessageParam
|
|
2
|
+
import type { Message, MessageParam } from "./messages";
|
|
3
3
|
import type { BuilderModel } from "./events";
|
|
4
4
|
export type BuilderContentData = BuilderContent["data"];
|
|
5
5
|
export type { BuilderContent, BuilderElement, Component };
|
|
@@ -93,6 +93,10 @@ export interface BuilderEditorState {
|
|
|
93
93
|
* Email of the user in the builder.
|
|
94
94
|
*/
|
|
95
95
|
userEmail?: string;
|
|
96
|
+
/**
|
|
97
|
+
* User's jobs
|
|
98
|
+
*/
|
|
99
|
+
userJobs?: string[];
|
|
96
100
|
/**
|
|
97
101
|
* Selected ids in the builder.
|
|
98
102
|
*/
|
|
@@ -113,6 +117,10 @@ export interface BuilderEditorState {
|
|
|
113
117
|
* Custom instructions that could be add into the prompt.
|
|
114
118
|
*/
|
|
115
119
|
customInstructions?: Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* All targeting attributes of the content.
|
|
122
|
+
*/
|
|
123
|
+
allTargetingAttributes?: Record<string, any>;
|
|
116
124
|
}
|
|
117
125
|
/**
|
|
118
126
|
* @deprecated Uggh, spelling is hard. Use `BuilderEditorState` instead.
|
|
@@ -120,6 +128,4 @@ export interface BuilderEditorState {
|
|
|
120
128
|
export type BuiderEditorState = BuilderEditorState;
|
|
121
129
|
export type OnPromptSubmit = (opts: {
|
|
122
130
|
prompt?: string;
|
|
123
|
-
snippetId?: string;
|
|
124
|
-
snippetParams?: SnippetParams;
|
|
125
131
|
}) => void;
|
package/dist/events.d.ts
CHANGED
|
@@ -26,9 +26,11 @@ export interface AppMessagesGenerationEvent {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* idle
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* idle: no messages are being generated or queued to be generated
|
|
30
|
+
*
|
|
31
|
+
* queued: messages have been sent to the LLM, but no response has been received yet
|
|
32
|
+
*
|
|
33
|
+
* generating: messages are actively being generated and streaming back to the UI
|
|
32
34
|
*/
|
|
33
35
|
export type GenerationState = "idle" | "queued" | "generating";
|
|
34
36
|
export interface AppPromptAbortEvent {
|
|
@@ -221,6 +223,14 @@ export interface AssistantStats {
|
|
|
221
223
|
* Error message if there was one.
|
|
222
224
|
*/
|
|
223
225
|
errorMessage?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Input tokens
|
|
228
|
+
*/
|
|
229
|
+
inputTokens?: number;
|
|
230
|
+
/**
|
|
231
|
+
* Output tokens
|
|
232
|
+
*/
|
|
233
|
+
outputTokens?: number;
|
|
224
234
|
}
|
|
225
235
|
export interface ModelCreateEvent {
|
|
226
236
|
type: "assistant.model.create";
|
package/dist/messages.d.ts
CHANGED
|
@@ -25,21 +25,7 @@ export interface UserMessageParam {
|
|
|
25
25
|
*/
|
|
26
26
|
role: "user";
|
|
27
27
|
id?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Predefined snippets that the user can select from.
|
|
30
|
-
* We still need the content to be set so the message they read
|
|
31
|
-
* is added to the conversation, however, the assistant will
|
|
32
|
-
* ignore the content and use the snippet to know what to do instead.
|
|
33
|
-
*/
|
|
34
|
-
snippetId?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Extra parameters to pass to the assistant when the snippet is used.
|
|
37
|
-
* For example, a predefined snippet to translate content needs to know
|
|
38
|
-
* what language to translate to.
|
|
39
|
-
*/
|
|
40
|
-
snippetParams?: SnippetParams;
|
|
41
28
|
}
|
|
42
|
-
export type SnippetParams = Record<string, any>;
|
|
43
29
|
export interface AssistantMessageParam {
|
|
44
30
|
/**
|
|
45
31
|
* The contents of the assistant message.
|
|
@@ -89,6 +75,4 @@ export interface AssistantActionMessage {
|
|
|
89
75
|
* and is the output message.
|
|
90
76
|
*/
|
|
91
77
|
export type Message = SystemMessage | UserMessage | AssistantMessage;
|
|
92
|
-
export type GeneratingMessage = null |
|
|
93
|
-
generating?: boolean;
|
|
94
|
-
});
|
|
78
|
+
export type GeneratingMessage = null | Partial<AssistantActionMessage | AssistantMessage>;
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SnippetParams } from "./messages";
|
|
2
1
|
export interface AssistantSettings {
|
|
3
2
|
assistantType?: string;
|
|
4
3
|
viewId?: string;
|
|
@@ -39,14 +38,6 @@ export interface Snippet {
|
|
|
39
38
|
* This prompt is also what's added to the chat conversation from the user.
|
|
40
39
|
*/
|
|
41
40
|
prompt?: string;
|
|
42
|
-
/**
|
|
43
|
-
* The ID of the snippet that will be sent to the assistant when the user clicks the chat snippet button.
|
|
44
|
-
*/
|
|
45
|
-
snippetId?: string;
|
|
46
|
-
/**
|
|
47
|
-
* The parameters that will be sent to the assistant when the user clicks the chat snippet button.
|
|
48
|
-
*/
|
|
49
|
-
snippetParams?: SnippetParams;
|
|
50
41
|
}
|
|
51
42
|
interface IframeSettings extends Partial<AssistantSettings> {
|
|
52
43
|
local?: boolean;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/ai-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"description": "Builder.io AI utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.
|
|
7
|
+
"types": "dist/index.d.tss",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.js",
|