@activepieces/pieces-common 0.2.17 → 0.2.19
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/package.json +2 -2
- package/src/lib/ai/index.d.ts +32 -24
- package/src/lib/ai/index.js +3 -2
- package/src/lib/ai/index.js.map +1 -1
- package/src/lib/ai/providers/anthropic/index.js +23 -24
- package/src/lib/ai/providers/anthropic/index.js.map +1 -1
- package/src/lib/ai/providers/index.d.ts +11 -3
- package/src/lib/ai/providers/index.js +48 -19
- package/src/lib/ai/providers/index.js.map +1 -1
- package/src/lib/ai/providers/openai/index.js +36 -26
- package/src/lib/ai/providers/openai/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/pieces-common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@anthropic-ai/sdk": "0.27.3",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"openai": "4.47.1",
|
|
13
13
|
"semver": "7.6.0",
|
|
14
14
|
"@activepieces/pieces-framework": "0.7.34",
|
|
15
|
-
"@activepieces/shared": "0.10.
|
|
15
|
+
"@activepieces/shared": "0.10.117",
|
|
16
16
|
"tslib": "2.6.2"
|
|
17
17
|
},
|
|
18
18
|
"main": "./src/index.js"
|
package/src/lib/ai/index.d.ts
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { ServerContext } from '@activepieces/pieces-framework';
|
|
2
2
|
import { AiProvider } from './providers';
|
|
3
|
-
export type AI
|
|
3
|
+
export type AI = {
|
|
4
4
|
provider: string;
|
|
5
5
|
chat: AIChat;
|
|
6
|
+
image?: AIImage;
|
|
7
|
+
};
|
|
8
|
+
export type AIImage = {
|
|
9
|
+
generate: (params: AIImageGenerateParams) => Promise<AIImageCompletion | null>;
|
|
10
|
+
};
|
|
11
|
+
export type AIImageGenerateParams = {
|
|
12
|
+
prompt: string;
|
|
13
|
+
model: string;
|
|
14
|
+
numImages: number;
|
|
15
|
+
size: string;
|
|
16
|
+
};
|
|
17
|
+
export type AIImageCompletion = {
|
|
18
|
+
url: string;
|
|
6
19
|
};
|
|
7
20
|
export type AIChat = {
|
|
8
21
|
text: (params: AIChatCompletionsCreateParams) => Promise<AIChatCompletion>;
|
|
9
|
-
|
|
22
|
+
function: (params: AIChatCompletionsCreateParams & {
|
|
23
|
+
functions: AIFunctionDefinition[];
|
|
24
|
+
}) => Promise<AIChatCompletion & {
|
|
25
|
+
call: AIFunctionCall | null;
|
|
26
|
+
}>;
|
|
10
27
|
};
|
|
11
28
|
export type AIChatCompletionsCreateParams = {
|
|
12
29
|
model: string;
|
|
@@ -17,8 +34,6 @@ export type AIChatCompletionsCreateParams = {
|
|
|
17
34
|
};
|
|
18
35
|
export type AIChatCompletion = {
|
|
19
36
|
id: string;
|
|
20
|
-
created: number;
|
|
21
|
-
model: string;
|
|
22
37
|
choices: AIChatMessage[];
|
|
23
38
|
usage?: AIChatCompletionUsage;
|
|
24
39
|
};
|
|
@@ -27,35 +42,28 @@ export type AIChatCompletionUsage = {
|
|
|
27
42
|
completionTokens: number;
|
|
28
43
|
totalTokens: number;
|
|
29
44
|
};
|
|
30
|
-
export type
|
|
45
|
+
export type AIChatMessage = {
|
|
46
|
+
role: AIChatRole;
|
|
47
|
+
content: string;
|
|
48
|
+
};
|
|
49
|
+
export type AIFunctionCall = {
|
|
31
50
|
id: string;
|
|
32
|
-
type: string;
|
|
33
51
|
function: {
|
|
34
52
|
name: string;
|
|
35
53
|
arguments: unknown;
|
|
36
54
|
};
|
|
37
55
|
};
|
|
38
|
-
export type
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
export type AIFunctionDefinition = {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
arguments: AIFunctionArgumentDefinition[];
|
|
41
60
|
};
|
|
42
|
-
export type
|
|
61
|
+
export type AIFunctionArgumentDefinition = {
|
|
43
62
|
name: string;
|
|
44
|
-
type: string;
|
|
63
|
+
type: "string" | "number" | "boolean";
|
|
45
64
|
description?: string;
|
|
46
65
|
isRequired: boolean;
|
|
47
66
|
};
|
|
48
|
-
export type AIExtractStructuredDataParams = AIChatCompletionsCreateParams & {
|
|
49
|
-
functionCallingProps: AIFunctionCallingPropDefinition[];
|
|
50
|
-
};
|
|
51
|
-
export type AIExtractStructuredDataResponse = {
|
|
52
|
-
id: string;
|
|
53
|
-
created: number;
|
|
54
|
-
model: string;
|
|
55
|
-
choices: AIChatMessage[];
|
|
56
|
-
toolCall: AIChatCompletionMessageToolCall;
|
|
57
|
-
usage?: AIChatCompletionUsage;
|
|
58
|
-
};
|
|
59
67
|
export declare enum AIChatRole {
|
|
60
68
|
SYSTEM = "system",
|
|
61
69
|
USER = "user",
|
|
@@ -64,9 +72,9 @@ export declare enum AIChatRole {
|
|
|
64
72
|
export type AIFactory = (params: {
|
|
65
73
|
proxyUrl: string;
|
|
66
74
|
engineToken: string;
|
|
67
|
-
}) => AI
|
|
75
|
+
}) => AI;
|
|
68
76
|
export declare const AI: ({ provider, server, }: {
|
|
69
77
|
provider: AiProvider;
|
|
70
78
|
server: ServerContext;
|
|
71
|
-
}) => AI
|
|
79
|
+
}) => AI;
|
|
72
80
|
export * from './providers';
|
package/src/lib/ai/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const AI = ({ provider, server, }) => {
|
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
21
21
|
provider,
|
|
22
|
+
image: impl.image,
|
|
22
23
|
chat: {
|
|
23
24
|
text: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
25
|
var _b;
|
|
@@ -33,10 +34,10 @@ const AI = ({ provider, server, }) => {
|
|
|
33
34
|
throw e;
|
|
34
35
|
}
|
|
35
36
|
}),
|
|
36
|
-
|
|
37
|
+
function: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
38
|
var _c;
|
|
38
39
|
try {
|
|
39
|
-
const response = yield impl.chat.
|
|
40
|
+
const response = yield impl.chat.function(params);
|
|
40
41
|
return response;
|
|
41
42
|
}
|
|
42
43
|
catch (e) {
|
package/src/lib/ai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/ai/index.ts"],"names":[],"mappings":";;;;AACA,2CAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/ai/index.ts"],"names":[],"mappings":";;;;AACA,2CAAuD;AA4EvD,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,qCAAuB,CAAA;AACzB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAOM,MAAM,EAAE,GAAG,CAAC,EACjB,QAAQ,EACR,MAAM,GAIP,EAAM,EAAE;;IACP,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,MAAM,yBAAyB,QAAQ,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,MAAA,wBAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,0CAAE,OAAO,CAAC;IACxE,MAAM,IAAI,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAEhE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,oBAAoB,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO;QACL,QAAQ;QACR,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE;YACJ,IAAI,EAAE,CAAO,MAAM,EAAE,EAAE;;gBACrB,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC9C,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBAAC,OAAO,CAAM,EAAE,CAAC;oBAChB,IAAI,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,0CAAE,KAAK,EAAE,CAAC;wBACpB,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;oBACtB,CAAC;oBACD,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC,CAAA;YACD,QAAQ,EAAE,CAAO,MAAM,EAAE,EAAE;;gBACzB,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBAClD,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBAAC,OAAO,CAAM,EAAE,CAAC;oBAChB,IAAI,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,0CAAE,KAAK,EAAE,CAAC;wBACpB,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;oBACtB,CAAC;oBACD,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC,CAAA;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA3CW,QAAA,EAAE,MA2Cb;AAEF,sDAA4B"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.anthropic = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const __1 = require("../..");
|
|
6
5
|
const sdk_1 = tslib_1.__importDefault(require("@anthropic-ai/sdk"));
|
|
6
|
+
const __1 = require("../..");
|
|
7
7
|
const anthropic = ({ proxyUrl, engineToken, }) => {
|
|
8
8
|
const sdk = new sdk_1.default({
|
|
9
9
|
apiKey: engineToken,
|
|
@@ -15,6 +15,7 @@ const anthropic = ({ proxyUrl, engineToken, }) => {
|
|
|
15
15
|
});
|
|
16
16
|
return {
|
|
17
17
|
provider: 'ANTHROPIC',
|
|
18
|
+
image: undefined,
|
|
18
19
|
chat: {
|
|
19
20
|
text: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
var _a, _b;
|
|
@@ -51,8 +52,8 @@ const anthropic = ({ proxyUrl, engineToken, }) => {
|
|
|
51
52
|
},
|
|
52
53
|
};
|
|
53
54
|
}),
|
|
54
|
-
|
|
55
|
-
var _c
|
|
55
|
+
function: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
var _c;
|
|
56
57
|
const completion = yield sdk.messages.create({
|
|
57
58
|
model: params.model,
|
|
58
59
|
messages: params.messages.map((message) => ({
|
|
@@ -60,24 +61,23 @@ const anthropic = ({ proxyUrl, engineToken, }) => {
|
|
|
60
61
|
content: message.content,
|
|
61
62
|
})),
|
|
62
63
|
max_tokens: (_c = params.maxTokens) !== null && _c !== void 0 ? _c : 2000,
|
|
63
|
-
tools:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.map((prop) => prop.name),
|
|
76
|
-
},
|
|
64
|
+
tools: params.functions.map((functionDefinition) => ({
|
|
65
|
+
name: functionDefinition.name,
|
|
66
|
+
description: functionDefinition.description,
|
|
67
|
+
input_schema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: functionDefinition.arguments.reduce((acc, { name, type, description }) => {
|
|
70
|
+
acc[name] = { type, description };
|
|
71
|
+
return acc;
|
|
72
|
+
}, {}),
|
|
73
|
+
required: functionDefinition.arguments
|
|
74
|
+
.filter((prop) => prop.isRequired)
|
|
75
|
+
.map((prop) => prop.name),
|
|
77
76
|
},
|
|
78
|
-
|
|
77
|
+
})),
|
|
79
78
|
});
|
|
80
79
|
const toolCallsResponse = completion.content.filter((choice) => choice.type === 'tool_use');
|
|
80
|
+
const toolCall = toolCallsResponse[0];
|
|
81
81
|
return {
|
|
82
82
|
choices: completion.content
|
|
83
83
|
.filter((choice) => choice.type === 'text')
|
|
@@ -85,14 +85,13 @@ const anthropic = ({ proxyUrl, engineToken, }) => {
|
|
|
85
85
|
content: choice.text,
|
|
86
86
|
role: __1.AIChatRole.ASSISTANT,
|
|
87
87
|
})),
|
|
88
|
-
|
|
89
|
-
id:
|
|
90
|
-
type: 'function',
|
|
88
|
+
call: toolCall ? {
|
|
89
|
+
id: toolCall.id,
|
|
91
90
|
function: {
|
|
92
|
-
name:
|
|
93
|
-
arguments:
|
|
91
|
+
name: toolCall.name,
|
|
92
|
+
arguments: toolCall.input,
|
|
94
93
|
},
|
|
95
|
-
},
|
|
94
|
+
} : null,
|
|
96
95
|
id: completion.id,
|
|
97
96
|
model: completion.model,
|
|
98
97
|
created: new Date().getTime(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/anthropic/index.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/anthropic/index.ts"],"names":[],"mappings":";;;;AAAA,oEAA0C;AAE1C,6BAAkD;AAE3C,MAAM,SAAS,GAAc,CAAC,EACnC,QAAQ,EACR,WAAW,GACZ,EAAM,EAAE;IACP,MAAM,GAAG,GAAG,IAAI,aAAS,CAAC;QACxB,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,QAAQ;QACjB,cAAc,EAAE;YACd,4BAA4B,EAAE,wCAAwC;YACtE,aAAa,EAAE,UAAU,WAAW,EAAE;SACvC;KACF,CAAC,CAAC;IACH,OAAO;QACL,QAAQ,EAAE,WAAoB;QAC9B,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE;YACJ,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CAAC,KAAK,CAAC,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY;qBACjE;iBACF,CAAC;YACJ,CAAC,CAAA;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA/GW,QAAA,SAAS,aA+GpB"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { Static } from
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const AI_PROVIDERS_MAKRDOWN: {
|
|
3
|
+
openai: string;
|
|
4
|
+
anthropic: string;
|
|
5
|
+
};
|
|
2
6
|
export declare const AI_PROVIDERS: ({
|
|
3
7
|
logoUrl: string;
|
|
4
8
|
defaultBaseUrl: string;
|
|
@@ -7,9 +11,11 @@ export declare const AI_PROVIDERS: ({
|
|
|
7
11
|
models: {
|
|
8
12
|
label: string;
|
|
9
13
|
value: string;
|
|
14
|
+
types: string[];
|
|
10
15
|
}[];
|
|
11
16
|
auth: import("./utils").AuthHeader;
|
|
12
17
|
factory: import("..").AIFactory;
|
|
18
|
+
instructionsMarkdown: string;
|
|
13
19
|
} | {
|
|
14
20
|
logoUrl: string;
|
|
15
21
|
defaultBaseUrl: string;
|
|
@@ -18,15 +24,17 @@ export declare const AI_PROVIDERS: ({
|
|
|
18
24
|
models: {
|
|
19
25
|
label: string;
|
|
20
26
|
value: string;
|
|
27
|
+
types: string[];
|
|
21
28
|
}[];
|
|
22
29
|
auth: import("./utils").AuthHeader;
|
|
23
30
|
factory: import("..").AIFactory;
|
|
31
|
+
instructionsMarkdown: string;
|
|
24
32
|
})[];
|
|
25
|
-
export declare const aiProps: {
|
|
33
|
+
export declare const aiProps: (type: 'text' | 'image') => {
|
|
26
34
|
provider: import("@activepieces/pieces-framework").DropdownProperty<"openai" | "anthropic", true>;
|
|
27
35
|
model: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
28
36
|
};
|
|
29
|
-
export type AiProviderMetadata = typeof AI_PROVIDERS[number];
|
|
37
|
+
export type AiProviderMetadata = (typeof AI_PROVIDERS)[number];
|
|
30
38
|
export declare const AiProvider: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"openai" | "anthropic">[]>;
|
|
31
39
|
export type AiProvider = Static<typeof AiProvider>;
|
|
32
40
|
export * from './utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiProvider = exports.aiProps = exports.AI_PROVIDERS = void 0;
|
|
3
|
+
exports.AiProvider = exports.aiProps = exports.AI_PROVIDERS = exports.AI_PROVIDERS_MAKRDOWN = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typebox_1 = require("@sinclair/typebox");
|
|
6
6
|
const anthropic_1 = require("./anthropic");
|
|
@@ -9,6 +9,20 @@ const utils_1 = require("./utils");
|
|
|
9
9
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
10
10
|
const shared_1 = require("@activepieces/shared");
|
|
11
11
|
const http_1 = require("../../http");
|
|
12
|
+
exports.AI_PROVIDERS_MAKRDOWN = {
|
|
13
|
+
openai: `Follow these instructions to get your OpenAI API Key:
|
|
14
|
+
|
|
15
|
+
1. Visit the following website: https://platform.openai.com/account/api-keys.
|
|
16
|
+
2. Once on the website, locate and click on the option to obtain your OpenAI API Key.
|
|
17
|
+
|
|
18
|
+
It is strongly recommended that you add your credit card information to your OpenAI account and upgrade to the paid plan **before** generating the API Key. This will help you prevent 429 errors.
|
|
19
|
+
`,
|
|
20
|
+
anthropic: `Follow these instructions to get your Claude API Key:
|
|
21
|
+
|
|
22
|
+
1. Visit the following website: https://console.anthropic.com/settings/keys.
|
|
23
|
+
2. Once on the website, locate and click on the option to obtain your Claude API Key.
|
|
24
|
+
`,
|
|
25
|
+
};
|
|
12
26
|
exports.AI_PROVIDERS = [
|
|
13
27
|
{
|
|
14
28
|
logoUrl: 'https://cdn.activepieces.com/pieces/openai.png',
|
|
@@ -16,13 +30,16 @@ exports.AI_PROVIDERS = [
|
|
|
16
30
|
label: 'OpenAI',
|
|
17
31
|
value: 'openai',
|
|
18
32
|
models: [
|
|
19
|
-
{ label: 'gpt-4o', value: 'gpt-4o' },
|
|
20
|
-
{ label: 'gpt-4o-mini', value: 'gpt-4o-mini' },
|
|
21
|
-
{ label: 'gpt-4-turbo', value: 'gpt-4-turbo' },
|
|
22
|
-
{ label: 'gpt-3.5-turbo', value: 'gpt-3.5-turbo' },
|
|
33
|
+
{ label: 'gpt-4o', value: 'gpt-4o', types: ['text'] },
|
|
34
|
+
{ label: 'gpt-4o-mini', value: 'gpt-4o-mini', types: ['text'] },
|
|
35
|
+
{ label: 'gpt-4-turbo', value: 'gpt-4-turbo', types: ['text'] },
|
|
36
|
+
{ label: 'gpt-3.5-turbo', value: 'gpt-3.5-turbo', types: ['text'] },
|
|
37
|
+
{ label: 'dall-e-3', value: 'dall-e-3', types: ['image'] },
|
|
38
|
+
{ label: 'dall-e-2', value: 'dall-e-2', types: ['image'] },
|
|
23
39
|
],
|
|
24
40
|
auth: (0, utils_1.authHeader)({ bearer: true }),
|
|
25
41
|
factory: openai_1.openai,
|
|
42
|
+
instructionsMarkdown: exports.AI_PROVIDERS_MAKRDOWN.openai,
|
|
26
43
|
},
|
|
27
44
|
{
|
|
28
45
|
logoUrl: 'https://cdn.activepieces.com/pieces/claude.png',
|
|
@@ -32,26 +49,31 @@ exports.AI_PROVIDERS = [
|
|
|
32
49
|
models: [
|
|
33
50
|
{
|
|
34
51
|
label: 'claude-3-5-sonnet',
|
|
35
|
-
value: 'claude-3-5-sonnet-20240620'
|
|
52
|
+
value: 'claude-3-5-sonnet-20240620',
|
|
53
|
+
types: ['text'],
|
|
36
54
|
},
|
|
37
55
|
{
|
|
38
56
|
label: 'claude-3-opus',
|
|
39
57
|
value: 'claude-3-opus-20240229',
|
|
58
|
+
types: ['text'],
|
|
40
59
|
},
|
|
41
60
|
{
|
|
42
61
|
label: 'claude-3-sonnet',
|
|
43
62
|
value: 'claude-3-sonnet-20240229',
|
|
63
|
+
types: ['text'],
|
|
44
64
|
},
|
|
45
65
|
{
|
|
46
66
|
label: 'claude-3-haiku',
|
|
47
67
|
value: 'claude-3-haiku-20240307',
|
|
68
|
+
types: ['text'],
|
|
48
69
|
},
|
|
49
70
|
],
|
|
50
|
-
auth: (0, utils_1.authHeader)({ name:
|
|
71
|
+
auth: (0, utils_1.authHeader)({ name: 'x-api-key', bearer: false }),
|
|
51
72
|
factory: anthropic_1.anthropic,
|
|
73
|
+
instructionsMarkdown: exports.AI_PROVIDERS_MAKRDOWN.anthropic,
|
|
52
74
|
},
|
|
53
75
|
];
|
|
54
|
-
|
|
76
|
+
const aiProps = (type) => ({
|
|
55
77
|
provider: pieces_framework_1.Property.Dropdown({
|
|
56
78
|
displayName: 'Provider',
|
|
57
79
|
required: true,
|
|
@@ -71,18 +93,24 @@ exports.aiProps = {
|
|
|
71
93
|
placeholder: 'No AI providers configured by the admin.',
|
|
72
94
|
};
|
|
73
95
|
}
|
|
96
|
+
const providersWithMetadata = providers.body.data.flatMap((p) => {
|
|
97
|
+
const providerMetadata = exports.AI_PROVIDERS.find((meta) => meta.value === p.provider &&
|
|
98
|
+
meta.models.some((m) => m.types.includes(type)));
|
|
99
|
+
if ((0, shared_1.isNil)(providerMetadata)) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
value: providerMetadata.value,
|
|
104
|
+
label: providerMetadata.label,
|
|
105
|
+
models: providerMetadata.models,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
74
108
|
return {
|
|
75
109
|
placeholder: 'Select AI Provider',
|
|
76
110
|
disabled: false,
|
|
77
|
-
options:
|
|
78
|
-
var _a, _b;
|
|
79
|
-
return ({
|
|
80
|
-
label: (_b = (_a = exports.AI_PROVIDERS.find((f) => f.value === p.provider)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : 'Unknown Label',
|
|
81
|
-
value: p.provider,
|
|
82
|
-
});
|
|
83
|
-
}),
|
|
111
|
+
options: providersWithMetadata,
|
|
84
112
|
};
|
|
85
|
-
})
|
|
113
|
+
}),
|
|
86
114
|
}),
|
|
87
115
|
model: pieces_framework_1.Property.Dropdown({
|
|
88
116
|
displayName: 'Model',
|
|
@@ -97,14 +125,15 @@ exports.aiProps = {
|
|
|
97
125
|
placeholder: 'Select AI Provider',
|
|
98
126
|
};
|
|
99
127
|
}
|
|
100
|
-
const models = (_b = exports.AI_PROVIDERS.find((p) => p.value === provider)) === null || _b === void 0 ? void 0 : _b.models;
|
|
128
|
+
const models = (_b = exports.AI_PROVIDERS.find((p) => p.value === provider)) === null || _b === void 0 ? void 0 : _b.models.filter((m) => m.types.includes(type));
|
|
101
129
|
return {
|
|
102
130
|
disabled: (0, shared_1.isNil)(models),
|
|
103
131
|
options: models !== null && models !== void 0 ? models : [],
|
|
104
132
|
};
|
|
105
133
|
}),
|
|
106
134
|
}),
|
|
107
|
-
};
|
|
108
|
-
exports.
|
|
135
|
+
});
|
|
136
|
+
exports.aiProps = aiProps;
|
|
137
|
+
exports.AiProvider = typebox_1.Type.Union(exports.AI_PROVIDERS.map((p) => typebox_1.Type.Literal(p.value)));
|
|
109
138
|
tslib_1.__exportStar(require("./utils"), exports);
|
|
110
139
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/index.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/index.ts"],"names":[],"mappings":";;;;AAAA,+CAAiD;AACjD,2CAAwC;AACxC,qCAAkC;AAClC,mCAAqC;AACrC,qEAA0D;AAC1D,iDAI8B;AAC9B,qCAAoD;AAEvC,QAAA,qBAAqB,GAAG;IACnC,MAAM,EAAE;;;;;;CAMT;IACC,SAAS,EAAE;;;;C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BACL,QAAQ,EAAE,IAAA,cAAK,EAAC,MAAM,CAAC;gBACvB,OAAO,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE;aACtB,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;CACH,CAAC,CAAC;AAnEU,QAAA,OAAO,WAmEjB;AAIU,QAAA,UAAU,GAAG,cAAI,CAAC,KAAK,CAClC,oBAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAC/C,CAAC;AAIF,kDAAwB"}
|
|
@@ -15,6 +15,17 @@ const openai = ({ proxyUrl, engineToken }) => {
|
|
|
15
15
|
});
|
|
16
16
|
return {
|
|
17
17
|
provider: 'OPENAI',
|
|
18
|
+
image: {
|
|
19
|
+
generate: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const response = yield sdk.images.generate({
|
|
21
|
+
model: params.model,
|
|
22
|
+
prompt: params.prompt,
|
|
23
|
+
n: params.numImages,
|
|
24
|
+
});
|
|
25
|
+
const url = response.data[0].url;
|
|
26
|
+
return url ? { url } : null;
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
18
29
|
chat: {
|
|
19
30
|
text: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
31
|
var _a;
|
|
@@ -46,8 +57,8 @@ const openai = ({ proxyUrl, engineToken }) => {
|
|
|
46
57
|
},
|
|
47
58
|
};
|
|
48
59
|
}),
|
|
49
|
-
|
|
50
|
-
var _b
|
|
60
|
+
function: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
var _b;
|
|
51
62
|
const completion = yield sdk.chat.completions.create({
|
|
52
63
|
model: params.model,
|
|
53
64
|
messages: params.messages.map((message) => ({
|
|
@@ -55,42 +66,41 @@ const openai = ({ proxyUrl, engineToken }) => {
|
|
|
55
66
|
content: message.content,
|
|
56
67
|
})),
|
|
57
68
|
max_tokens: params.maxTokens,
|
|
58
|
-
tools:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.map((prop) => prop.name),
|
|
73
|
-
},
|
|
69
|
+
tools: params.functions.map((functionDefinition) => ({
|
|
70
|
+
type: 'function',
|
|
71
|
+
function: {
|
|
72
|
+
name: functionDefinition.name,
|
|
73
|
+
description: functionDefinition.description,
|
|
74
|
+
parameters: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: functionDefinition.arguments.reduce((acc, { name, type, description }) => {
|
|
77
|
+
acc[name] = { type, description };
|
|
78
|
+
return acc;
|
|
79
|
+
}, {}),
|
|
80
|
+
required: functionDefinition.arguments
|
|
81
|
+
.filter((prop) => prop.isRequired)
|
|
82
|
+
.map((prop) => prop.name),
|
|
74
83
|
},
|
|
75
84
|
},
|
|
76
|
-
|
|
85
|
+
})),
|
|
77
86
|
});
|
|
87
|
+
const toolCall = (_b = completion.choices[0].message.tool_calls) === null || _b === void 0 ? void 0 : _b[0];
|
|
78
88
|
return {
|
|
79
|
-
choices: completion.choices
|
|
89
|
+
choices: completion.choices
|
|
90
|
+
.map((choice) => {
|
|
80
91
|
var _a;
|
|
81
92
|
return ({
|
|
82
93
|
role: __1.AIChatRole.ASSISTANT,
|
|
83
94
|
content: (_a = choice.message.content) !== null && _a !== void 0 ? _a : '',
|
|
84
95
|
});
|
|
85
96
|
}),
|
|
86
|
-
|
|
87
|
-
id:
|
|
88
|
-
type: 'function',
|
|
97
|
+
call: toolCall ? {
|
|
98
|
+
id: toolCall.id,
|
|
89
99
|
function: {
|
|
90
|
-
name:
|
|
91
|
-
arguments: JSON.parse(
|
|
100
|
+
name: toolCall.function.name,
|
|
101
|
+
arguments: JSON.parse(toolCall.function.arguments),
|
|
92
102
|
},
|
|
93
|
-
},
|
|
103
|
+
} : null,
|
|
94
104
|
created: completion.created,
|
|
95
105
|
id: completion.id,
|
|
96
106
|
model: completion.model,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/openai/index.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,6BAAkD;AAE3C,MAAM,MAAM,GAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/common/src/lib/ai/providers/openai/index.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,6BAAkD;AAE3C,MAAM,MAAM,GAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAM,EAAE;IACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,gBAAM,CAAC;QACrB,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,GAAG,QAAQ,IAAI,gBAAgB,EAAE;QAC1C,cAAc,EAAE;YACd,4BAA4B,EAAE,oBAAoB;SACnD;KACF,CAAC,CAAC;IACH,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE;YACL,QAAQ,EAAE,CAAO,MAAM,EAAE,EAAE;gBACzB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;oBACzC,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,CAAC,EAAE,MAAM,CAAC,SAAS;iBACpB,CAAC,CAAC;gBACH,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACjC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9B,C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