@budibase/pro 3.9.4 → 3.10.0
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/ai/generators/tableGeneration.d.ts +3 -8
- package/dist/ai/models/base.d.ts +2 -3
- package/dist/ai/models/budibaseai.d.ts +3 -1
- package/dist/ai/models/openai.d.ts +1 -3
- package/dist/ai/structuredOutputs/mappers/tables.d.ts +2 -1
- package/dist/ai/structuredOutputs/tableData.d.ts +2 -2
- package/dist/ai/structuredOutputs/tables.d.ts +2 -1
- package/dist/ai/types/table.d.ts +3 -1
- package/dist/index.js +43 -53
- package/dist/sdk/features/features.d.ts +0 -2
- package/dist/sdk/quotas/helpers/ai.d.ts +0 -3
- package/package.json +2 -2
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { Table } from "@budibase/types";
|
|
2
1
|
import { TableSchemaFromAI } from "../types";
|
|
3
2
|
interface Delegates {
|
|
4
3
|
generateTablesDelegate: (tables: TableSchemaFromAI[]) => Promise<{
|
|
5
4
|
id: string;
|
|
6
5
|
name: string;
|
|
7
6
|
}[]>;
|
|
8
|
-
|
|
9
|
-
generateDataDelegate: (data: Record<string, Record<string, any>[]>, userId: string, tables: Record<string, Table>) => Promise<void>;
|
|
7
|
+
generateDataDelegate: (data: Record<string, Record<string, any>[]>, userId: string, tables: Record<string, TableSchemaFromAI>) => Promise<void>;
|
|
10
8
|
}
|
|
11
9
|
export declare class TableGeneration {
|
|
12
10
|
private llm;
|
|
13
|
-
private addData;
|
|
14
|
-
private userId;
|
|
15
11
|
private delegates;
|
|
16
12
|
private constructor();
|
|
17
13
|
static init(delegates: Delegates): Promise<TableGeneration>;
|
|
18
|
-
|
|
19
|
-
generate(userPrompt: string): Promise<{
|
|
14
|
+
generate(userPrompt: string, userId: string): Promise<{
|
|
20
15
|
id: string;
|
|
21
16
|
name: string;
|
|
22
17
|
}[]>;
|
|
18
|
+
private llmFunctions;
|
|
23
19
|
private generateTables;
|
|
24
20
|
private generateAIColumns;
|
|
25
|
-
private generateData;
|
|
26
21
|
}
|
|
27
22
|
export {};
|
package/dist/ai/models/base.d.ts
CHANGED
|
@@ -3,10 +3,9 @@ import { LLMPromptResponse } from "../../types/ai";
|
|
|
3
3
|
import { Prompt } from "../prompts";
|
|
4
4
|
export declare abstract class LLM {
|
|
5
5
|
model: string;
|
|
6
|
-
apiKey
|
|
7
|
-
measureUsage: boolean;
|
|
6
|
+
apiKey?: string;
|
|
8
7
|
maxTokens: number;
|
|
9
|
-
constructor({ model, apiKey
|
|
8
|
+
constructor({ model, apiKey }: LLMConfigOptions);
|
|
10
9
|
protected abstract chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
11
10
|
prompt(prompt: string | Prompt): Promise<LLMPromptResponse>;
|
|
12
11
|
summarizeText(prompt: string): Promise<LLMPromptResponse>;
|
|
@@ -2,6 +2,8 @@ import { LLMPromptResponse } from "../../types/ai";
|
|
|
2
2
|
import { LLM } from "./base";
|
|
3
3
|
import { Prompt } from "../prompts";
|
|
4
4
|
export declare class BudibaseAI extends LLM {
|
|
5
|
-
|
|
5
|
+
prompt(prompt: string | Prompt): Promise<LLMPromptResponse>;
|
|
6
6
|
protected chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
7
|
+
protected chatCompletionCloud(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
8
|
+
protected chatCompletionSelfHost(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
7
9
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import OpenAIClient from "openai";
|
|
2
1
|
import { LLMPromptResponse } from "../../types/ai";
|
|
3
2
|
import { LLM } from "./base";
|
|
4
3
|
import { Prompt } from "../prompts";
|
|
@@ -8,7 +7,6 @@ export type OpenAIModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "gpt-4-turbo" | "
|
|
|
8
7
|
export declare function parseResponseFormat(responseFormat?: ResponseFormat): openai.ResponseFormatText | openai.ResponseFormatJSONObject | openai.ResponseFormatJSONSchema | undefined;
|
|
9
8
|
export declare class OpenAI extends LLM {
|
|
10
9
|
private client;
|
|
11
|
-
constructor(
|
|
12
|
-
measureTokenUsage(usage?: OpenAIClient.CompletionUsage): number;
|
|
10
|
+
constructor(opts: LLMConfigOptions);
|
|
13
11
|
protected chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
14
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { AIColumnSchemas, GenerationStructure } from "../tables";
|
|
2
2
|
import { TableSchemaFromAI } from "../../types";
|
|
3
|
-
export declare function aiTableResponseToTableSchema(structure: GenerationStructure
|
|
3
|
+
export declare function aiTableResponseToTableSchema(structure: GenerationStructure): TableSchemaFromAI[];
|
|
4
|
+
export declare function appendAIColumns(tables: TableSchemaFromAI[], aiColumns: AIColumnSchemas): TableSchemaFromAI[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
export declare function tableDataStructuredOutput(tables:
|
|
2
|
+
import { TableSchemaFromAI } from "../types";
|
|
3
|
+
export declare function tableDataStructuredOutput(tables: TableSchemaFromAI[]): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AIFieldMetadata, AttachmentSubType, FieldType, JsonFieldSubType, RelationshipType } from "@budibase/types";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { TableSchemaFromAI } from "../types";
|
|
3
4
|
export declare const generationStructure: z.ZodObject<{
|
|
4
5
|
tables: z.ZodArray<z.ZodObject<{
|
|
5
6
|
name: z.ZodString;
|
|
@@ -588,5 +589,5 @@ export declare const generationStructure: z.ZodObject<{
|
|
|
588
589
|
}[];
|
|
589
590
|
}>;
|
|
590
591
|
export type GenerationStructure = z.infer<typeof generationStructure>;
|
|
591
|
-
export declare function aiColumnSchemas(
|
|
592
|
+
export declare function aiColumnSchemas(tables: TableSchemaFromAI[]): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
592
593
|
export type AIColumnSchemas = Record<string, AIFieldMetadata[]>;
|
package/dist/ai/types/table.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { Table, WithRequired } from "@budibase/types";
|
|
2
|
-
export
|
|
2
|
+
export interface TableSchemaFromAI extends WithRequired<Pick<Table, "name" | "primaryDisplay" | "schema">, "primaryDisplay"> {
|
|
3
|
+
_id: string;
|
|
4
|
+
}
|