@budibase/pro 3.5.3 → 3.7.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/index.d.ts +1 -1
- package/dist/ai/llm.d.ts +2 -0
- package/dist/ai/models/anthropic.d.ts +8 -12
- package/dist/ai/models/base.d.ts +25 -0
- package/dist/ai/models/openai.d.ts +6 -13
- package/dist/ai/prompts/index.d.ts +23 -9
- package/dist/db/quotas/quotas.d.ts +1 -0
- package/dist/index.js +117 -18
- package/dist/middleware/licenseAuth.d.ts +3 -0
- package/dist/sdk/licensing/licenses/client.d.ts +1 -0
- package/dist/sdk/licensing/licenses/licenses.d.ts +1 -0
- package/dist/types/ai.d.ts +0 -4
- package/package.json +6 -5
- package/dist/ai/LargeLanguageModel.d.ts +0 -18
package/dist/ai/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getLLM } from "./llm";
|
package/dist/ai/llm.d.ts
ADDED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AnthropicClient from "@anthropic-ai/sdk";
|
|
2
|
+
import { LLMPromptResponse } from "../../types/ai";
|
|
3
|
+
import { AIConfigOptions, LLM } from "./base";
|
|
4
|
+
import { Prompt } from "../prompts";
|
|
2
5
|
export type AnthropicModel = "claude-3-5-sonnet-20240620" | "claude-3-sonnet-20240229" | "claude-3-opus-20240229" | "claude-3-haiku-20240307";
|
|
3
|
-
export
|
|
4
|
-
model: AnthropicModel;
|
|
5
|
-
apiKey: string;
|
|
6
|
-
measureUsage?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class Anthropic implements ILargeLanguageModel {
|
|
6
|
+
export declare class Anthropic extends LLM {
|
|
9
7
|
private client;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
chatCompletion(prompt:
|
|
13
|
-
prompt(prompt: string): Promise<LLMPromptResponse>;
|
|
14
|
-
summarizeText(prompt: string): Promise<LLMPromptResponse>;
|
|
8
|
+
constructor(opts: AIConfigOptions);
|
|
9
|
+
firstTextBlock(message: AnthropicClient.Messages.Message): string | undefined;
|
|
10
|
+
protected chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
15
11
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AIFieldMetadata, EnrichedBinding, Row, Snippet } from "@budibase/types";
|
|
2
|
+
import { LLMPromptResponse } from "../../types/ai";
|
|
3
|
+
import { Prompt } from "../prompts";
|
|
4
|
+
export interface AIConfigOptions {
|
|
5
|
+
model: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
measureUsage: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class LLM {
|
|
10
|
+
model: string;
|
|
11
|
+
apiKey: string;
|
|
12
|
+
measureUsage: boolean;
|
|
13
|
+
maxTokens: number;
|
|
14
|
+
constructor({ model, apiKey, measureUsage }: AIConfigOptions);
|
|
15
|
+
protected abstract chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
16
|
+
prompt(prompt: string | Prompt): Promise<LLMPromptResponse>;
|
|
17
|
+
summarizeText(prompt: string): Promise<LLMPromptResponse>;
|
|
18
|
+
generateCronExpression(prompt: string): Promise<LLMPromptResponse>;
|
|
19
|
+
operation(schema: AIFieldMetadata, row: Row): Promise<LLMPromptResponse>;
|
|
20
|
+
private promptForOperation;
|
|
21
|
+
generateJs(prompt: string, opts?: {
|
|
22
|
+
bindings: EnrichedBinding[];
|
|
23
|
+
snippets: Snippet[];
|
|
24
|
+
}): Promise<LLMPromptResponse>;
|
|
25
|
+
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import OpenAIClient from "openai";
|
|
2
|
-
import {
|
|
2
|
+
import { LLMPromptResponse } from "../../types/ai";
|
|
3
|
+
import { AIConfigOptions, LLM } from "./base";
|
|
4
|
+
import { Prompt } from "../prompts";
|
|
3
5
|
export type OpenAIModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "gpt-4-turbo" | "gpt-3.5-turbo";
|
|
4
|
-
export
|
|
5
|
-
model: OpenAIModel;
|
|
6
|
-
apiKey: string;
|
|
7
|
-
measureUsage: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class OpenAI implements ILargeLanguageModel {
|
|
6
|
+
export declare class OpenAI extends LLM {
|
|
10
7
|
private client;
|
|
11
|
-
model:
|
|
12
|
-
measureUsage: boolean;
|
|
13
|
-
constructor({ model, apiKey, measureUsage }: OpenAIConfigOptions);
|
|
8
|
+
constructor({ model, apiKey, measureUsage }: AIConfigOptions);
|
|
14
9
|
measureTokenUsage(usage?: OpenAIClient.CompletionUsage): number;
|
|
15
|
-
chatCompletion(prompt:
|
|
16
|
-
prompt(prompt: string): Promise<LLMPromptResponse>;
|
|
17
|
-
summarizeText(prompt: string): Promise<LLMPromptResponse>;
|
|
10
|
+
protected chatCompletion(prompt: Prompt): Promise<LLMPromptResponse>;
|
|
18
11
|
}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { EnrichedBinding, Snippet } from "@budibase/types";
|
|
2
|
+
export interface Message {
|
|
3
|
+
role: "system" | "user";
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class Prompt {
|
|
7
|
+
messages: Message[];
|
|
8
|
+
constructor(messages: Message[]);
|
|
9
|
+
user(content: string): this;
|
|
10
|
+
system(content: string): this;
|
|
11
|
+
static user(content: string): Prompt;
|
|
12
|
+
static system(content: string): Prompt;
|
|
13
|
+
}
|
|
14
|
+
export declare function summarizeText(text: string): Prompt;
|
|
15
|
+
export declare function classifyText(text: string, categories: string[]): Prompt;
|
|
16
|
+
export declare function cleanData(text: string): Prompt;
|
|
17
|
+
export declare function generateSQL(prompt: string, tableSchema: string): Prompt;
|
|
18
|
+
export declare function generateCode(prompt: string): Prompt;
|
|
19
|
+
export declare function generateCronExpression(text: string): Prompt;
|
|
20
|
+
export declare function translate(text: string, language: string): Prompt;
|
|
21
|
+
export declare function sentimentAnalysis(text: string): Prompt;
|
|
22
|
+
export declare function searchWeb(text: string): Prompt;
|
|
23
|
+
export declare function generateJs(bindings: EnrichedBinding[], snippets: Snippet[]): Prompt;
|