@budibase/pro 3.10.5 → 3.10.6
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 +4 -5
- package/dist/ai/llm.d.ts +18 -1
- package/dist/ai/models/anthropic.d.ts +3 -3
- package/dist/ai/models/base.d.ts +5 -4
- package/dist/ai/models/budibaseai.d.ts +7 -6
- package/dist/ai/models/openai.d.ts +3 -3
- package/dist/ai/prompts/index.d.ts +17 -28
- package/dist/ai/utils.d.ts +1 -0
- package/dist/api/index.d.ts +0 -1
- package/dist/index.js +53 -34
- package/dist/middleware/index.d.ts +1 -0
- package/dist/sdk/licensing/cache/redis.d.ts +2 -1
- package/dist/types/ai.d.ts +7 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +4 -3
- package/dist/api/controllers/ai/index.d.ts +0 -4
- package/dist/api/routes/ai/index.d.ts +0 -3
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export * from "./utils";
|
|
2
|
+
export * from "./prompts";
|
|
3
|
+
export { parseResponseFormat } from "./models/openai";
|
|
4
|
+
export { getLLM, getLLMConfig, getLLMOrThrow, LLMRequest } from "./llm";
|
|
3
5
|
export * from "./prompts";
|
|
4
6
|
export * from "./generators";
|
|
5
7
|
export * from "./structuredOutputs";
|
|
6
|
-
export declare const openai: {
|
|
7
|
-
parseResponseFormat: typeof parseResponseFormat;
|
|
8
|
-
};
|
package/dist/ai/llm.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import { LLMProviderConfig } from "@budibase/types";
|
|
1
|
+
import { ChatCompletionRequest, LLMProviderConfig, Message, ResponseFormat, Tool } from "@budibase/types";
|
|
2
2
|
import { LLM } from "./models/base";
|
|
3
|
+
import openai from "openai";
|
|
4
|
+
import { z } from "zod";
|
|
3
5
|
export declare function getLLMConfig(): Promise<LLMProviderConfig | undefined>;
|
|
4
6
|
export declare function getLLM(model?: string): Promise<LLM | undefined>;
|
|
7
|
+
export declare function getLLMOrThrow(): Promise<LLM>;
|
|
5
8
|
export declare function getOpenAIUsingLocalAPIKey(): Promise<LLM | undefined>;
|
|
9
|
+
export declare class LLMRequest {
|
|
10
|
+
messages: Message[];
|
|
11
|
+
tools: Tool[];
|
|
12
|
+
format?: ResponseFormat;
|
|
13
|
+
addTool(tool: Tool): this;
|
|
14
|
+
addTools(tools: Tool[]): this;
|
|
15
|
+
findTool(name: string): Tool | undefined;
|
|
16
|
+
withFormat(format: "text" | "json" | openai.ResponseFormatJSONSchema | z.ZodType): this;
|
|
17
|
+
addMessage(message: Message): this;
|
|
18
|
+
addMessages(messages: Message[]): this;
|
|
19
|
+
addUserMessage(content: string): this;
|
|
20
|
+
addSystemMessage(content: string): this;
|
|
21
|
+
static fromRequest(req: ChatCompletionRequest): LLMRequest;
|
|
22
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import AnthropicClient from "@anthropic-ai/sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { LLMFullResponse } from "../../types/ai";
|
|
3
3
|
import { LLM } from "./base";
|
|
4
|
-
import {
|
|
4
|
+
import { LLMRequest } from "../llm";
|
|
5
5
|
import { LLMConfigOptions } from "@budibase/types";
|
|
6
6
|
export type AnthropicModel = "claude-3-5-sonnet-20240620" | "claude-3-sonnet-20240229" | "claude-3-opus-20240229" | "claude-3-haiku-20240307";
|
|
7
7
|
export declare class Anthropic extends LLM {
|
|
8
8
|
private client;
|
|
9
9
|
constructor(opts: LLMConfigOptions);
|
|
10
10
|
firstTextBlock(message: AnthropicClient.Messages.Message): string | undefined;
|
|
11
|
-
protected chatCompletion(
|
|
11
|
+
protected chatCompletion(request: LLMRequest): Promise<LLMFullResponse>;
|
|
12
12
|
}
|
package/dist/ai/models/base.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { AIFieldMetadata, EnrichedBinding, LLMConfigOptions, Row, Snippet } from "@budibase/types";
|
|
2
|
-
import { LLMPromptResponse } from "../../types/ai";
|
|
3
|
-
import {
|
|
2
|
+
import { LLMFullResponse, LLMPromptResponse } from "../../types/ai";
|
|
3
|
+
import { LLMRequest } from "../llm";
|
|
4
4
|
export declare abstract class LLM {
|
|
5
5
|
model: string;
|
|
6
6
|
apiKey?: string;
|
|
7
7
|
maxTokens: number;
|
|
8
8
|
constructor({ model, apiKey }: LLMConfigOptions);
|
|
9
|
-
protected abstract chatCompletion(
|
|
10
|
-
prompt(
|
|
9
|
+
protected abstract chatCompletion(request: LLMRequest): Promise<LLMFullResponse>;
|
|
10
|
+
prompt(request: string | LLMRequest): Promise<LLMPromptResponse>;
|
|
11
|
+
chat(request: LLMRequest): Promise<LLMFullResponse>;
|
|
11
12
|
summarizeText(prompt: string): Promise<LLMPromptResponse>;
|
|
12
13
|
generateCronExpression(prompt: string): Promise<LLMPromptResponse>;
|
|
13
14
|
operation(schema: AIFieldMetadata, row: Row): Promise<LLMPromptResponse>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { LLMPromptResponse } from "../../types/ai";
|
|
1
|
+
import { LLMFullResponse, LLMPromptResponse } from "../../types/ai";
|
|
2
2
|
import { LLM } from "./base";
|
|
3
|
-
import {
|
|
3
|
+
import { LLMRequest } from "../llm";
|
|
4
4
|
export declare class BudibaseAI extends LLM {
|
|
5
|
-
prompt(prompt: string |
|
|
6
|
-
|
|
7
|
-
protected
|
|
8
|
-
protected
|
|
5
|
+
prompt(prompt: string | LLMRequest): Promise<LLMPromptResponse>;
|
|
6
|
+
chat(prompt: LLMRequest): Promise<LLMFullResponse>;
|
|
7
|
+
protected chatCompletion(prompt: LLMRequest): Promise<LLMFullResponse>;
|
|
8
|
+
protected chatCompletionCloud(prompt: LLMRequest): Promise<LLMFullResponse>;
|
|
9
|
+
protected chatCompletionSelfHost(prompt: LLMRequest): Promise<LLMFullResponse>;
|
|
9
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LLMFullResponse } from "../../types/ai";
|
|
2
2
|
import { LLM } from "./base";
|
|
3
|
-
import {
|
|
3
|
+
import { LLMRequest } from "../llm";
|
|
4
4
|
import { LLMConfigOptions, ResponseFormat } from "@budibase/types";
|
|
5
5
|
import openai from "openai";
|
|
6
6
|
export type OpenAIModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "gpt-4-turbo" | "gpt-3.5-turbo";
|
|
@@ -8,5 +8,5 @@ export declare function parseResponseFormat(responseFormat?: ResponseFormat): op
|
|
|
8
8
|
export declare class OpenAI extends LLM {
|
|
9
9
|
private client;
|
|
10
10
|
constructor(opts: LLMConfigOptions);
|
|
11
|
-
protected chatCompletion(
|
|
11
|
+
protected chatCompletion(request: LLMRequest): Promise<LLMFullResponse>;
|
|
12
12
|
}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function cleanData(text: string): Prompt;
|
|
19
|
-
export declare function generateSQL(prompt: string, tableSchema: string): Prompt;
|
|
20
|
-
export declare function generateCode(prompt: string): Prompt;
|
|
21
|
-
export declare function generateCronExpression(text: string): Prompt;
|
|
22
|
-
export declare function translate(text: string, language: string): Prompt;
|
|
23
|
-
export declare function sentimentAnalysis(text: string): Prompt;
|
|
24
|
-
export declare function searchWeb(text: string): Prompt;
|
|
25
|
-
export declare function generateJs(bindings: EnrichedBinding[], snippets: Snippet[]): Prompt;
|
|
26
|
-
export declare function generateTables(): Prompt;
|
|
27
|
-
export declare function generateAIColumns(): Prompt;
|
|
28
|
-
export declare function generateData(): Prompt;
|
|
1
|
+
import { EnrichedBinding, Snippet, ContextUser } from "@budibase/types";
|
|
2
|
+
import { LLMRequest } from "../llm";
|
|
3
|
+
export declare function summarizeText(text: string): LLMRequest;
|
|
4
|
+
export declare function classifyText(text: string, categories: string[]): LLMRequest;
|
|
5
|
+
export declare function cleanData(text: string): LLMRequest;
|
|
6
|
+
export declare function generateSQL(prompt: string, tableSchema: string): LLMRequest;
|
|
7
|
+
export declare function generateCode(prompt: string): LLMRequest;
|
|
8
|
+
export declare function generateCronExpression(text: string): LLMRequest;
|
|
9
|
+
export declare function translate(text: string, language: string): LLMRequest;
|
|
10
|
+
export declare function sentimentAnalysis(text: string): LLMRequest;
|
|
11
|
+
export declare function searchWeb(text: string): LLMRequest;
|
|
12
|
+
export declare function generateJs(bindings: EnrichedBinding[], snippets: Snippet[]): LLMRequest;
|
|
13
|
+
export declare function generateTables(): LLMRequest;
|
|
14
|
+
export declare function generateAIColumns(): LLMRequest;
|
|
15
|
+
export declare function generateData(): LLMRequest;
|
|
16
|
+
export declare function agentSystemPrompt(user: ContextUser): string;
|
|
17
|
+
export declare function agentHistoryTitleSystemPrompt(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sanitiseToolName(name: string): string;
|
package/dist/api/index.d.ts
CHANGED