@smythos/sre 1.5.26 → 1.5.31
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/CHANGELOG +28 -0
- package/dist/index.js +61 -46
- package/dist/index.js.map +1 -1
- package/dist/types/Components/GenAILLM.class.d.ts +126 -0
- package/dist/types/helpers/AWSLambdaCode.helper.d.ts +9 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/xAI.d.ts +121 -0
- package/dist/types/subsystems/LLMManager/models.d.ts +1 -0
- package/dist/types/types/LLM.types.d.ts +16 -0
- package/package.json +1 -1
- package/src/Components/GenAILLM.class.ts +166 -7
- package/src/Components/ServerlessCode.class.ts +7 -3
- package/src/helpers/AWSLambdaCode.helper.ts +184 -44
- package/src/helpers/Conversation.helper.ts +2 -2
- package/src/index.ts +185 -184
- package/src/index.ts.bak +185 -184
- package/src/subsystems/ComputeManager/Code.service/connectors/AWSLambdaCode.class.ts +15 -11
- package/src/subsystems/LLMManager/LLM.service/LLMConnector.ts +21 -5
- package/src/subsystems/LLMManager/LLM.service/connectors/xAI.ts +476 -0
- package/src/subsystems/LLMManager/LLM.service/index.ts +2 -1
- package/src/subsystems/LLMManager/ModelsProvider.service/ModelsProviderConnector.ts +17 -11
- package/src/subsystems/LLMManager/models.ts +1 -0
- package/src/types/LLM.types.ts +18 -0
|
@@ -88,6 +88,132 @@ export declare class GenAILLM extends Component {
|
|
|
88
88
|
description: string;
|
|
89
89
|
label: string;
|
|
90
90
|
};
|
|
91
|
+
useWebSearch: {
|
|
92
|
+
type: string;
|
|
93
|
+
description: string;
|
|
94
|
+
label: string;
|
|
95
|
+
};
|
|
96
|
+
webSearchContextSize: {
|
|
97
|
+
type: string;
|
|
98
|
+
valid: string[];
|
|
99
|
+
label: string;
|
|
100
|
+
};
|
|
101
|
+
webSearchCity: {
|
|
102
|
+
type: string;
|
|
103
|
+
max: number;
|
|
104
|
+
label: string;
|
|
105
|
+
allowEmpty: boolean;
|
|
106
|
+
};
|
|
107
|
+
webSearchCountry: {
|
|
108
|
+
type: string;
|
|
109
|
+
max: number;
|
|
110
|
+
label: string;
|
|
111
|
+
allowEmpty: boolean;
|
|
112
|
+
};
|
|
113
|
+
webSearchRegion: {
|
|
114
|
+
type: string;
|
|
115
|
+
max: number;
|
|
116
|
+
label: string;
|
|
117
|
+
allowEmpty: boolean;
|
|
118
|
+
};
|
|
119
|
+
webSearchTimezone: {
|
|
120
|
+
type: string;
|
|
121
|
+
max: number;
|
|
122
|
+
label: string;
|
|
123
|
+
allowEmpty: boolean;
|
|
124
|
+
};
|
|
125
|
+
useSearch: {
|
|
126
|
+
type: string;
|
|
127
|
+
description: string;
|
|
128
|
+
label: string;
|
|
129
|
+
};
|
|
130
|
+
searchMode: {
|
|
131
|
+
type: string;
|
|
132
|
+
valid: string[];
|
|
133
|
+
label: string;
|
|
134
|
+
};
|
|
135
|
+
returnCitations: {
|
|
136
|
+
type: string;
|
|
137
|
+
description: string;
|
|
138
|
+
label: string;
|
|
139
|
+
};
|
|
140
|
+
maxSearchResults: {
|
|
141
|
+
type: string;
|
|
142
|
+
min: number;
|
|
143
|
+
max: number;
|
|
144
|
+
label: string;
|
|
145
|
+
};
|
|
146
|
+
searchDataSources: {
|
|
147
|
+
type: string;
|
|
148
|
+
max: number;
|
|
149
|
+
label: string;
|
|
150
|
+
allowEmpty: boolean;
|
|
151
|
+
};
|
|
152
|
+
searchCountry: {
|
|
153
|
+
type: string;
|
|
154
|
+
max: number;
|
|
155
|
+
label: string;
|
|
156
|
+
allowEmpty: boolean;
|
|
157
|
+
};
|
|
158
|
+
excludedWebsites: {
|
|
159
|
+
type: string;
|
|
160
|
+
max: number;
|
|
161
|
+
label: string;
|
|
162
|
+
allowEmpty: boolean;
|
|
163
|
+
};
|
|
164
|
+
allowedWebsites: {
|
|
165
|
+
type: string;
|
|
166
|
+
max: number;
|
|
167
|
+
label: string;
|
|
168
|
+
allowEmpty: boolean;
|
|
169
|
+
};
|
|
170
|
+
includedXHandles: {
|
|
171
|
+
type: string;
|
|
172
|
+
max: number;
|
|
173
|
+
label: string;
|
|
174
|
+
allowEmpty: boolean;
|
|
175
|
+
};
|
|
176
|
+
excludedXHandles: {
|
|
177
|
+
type: string;
|
|
178
|
+
max: number;
|
|
179
|
+
label: string;
|
|
180
|
+
allowEmpty: boolean;
|
|
181
|
+
};
|
|
182
|
+
postFavoriteCount: {
|
|
183
|
+
type: string;
|
|
184
|
+
min: number;
|
|
185
|
+
max: number;
|
|
186
|
+
label: string;
|
|
187
|
+
};
|
|
188
|
+
postViewCount: {
|
|
189
|
+
type: string;
|
|
190
|
+
min: number;
|
|
191
|
+
max: number;
|
|
192
|
+
label: string;
|
|
193
|
+
};
|
|
194
|
+
link: {
|
|
195
|
+
type: string;
|
|
196
|
+
max: number;
|
|
197
|
+
label: string;
|
|
198
|
+
allowEmpty: boolean;
|
|
199
|
+
};
|
|
200
|
+
safeSearch: {
|
|
201
|
+
type: string;
|
|
202
|
+
description: string;
|
|
203
|
+
label: string;
|
|
204
|
+
};
|
|
205
|
+
fromDate: {
|
|
206
|
+
type: string;
|
|
207
|
+
max: number;
|
|
208
|
+
label: string;
|
|
209
|
+
allowEmpty: boolean;
|
|
210
|
+
};
|
|
211
|
+
toDate: {
|
|
212
|
+
type: string;
|
|
213
|
+
max: number;
|
|
214
|
+
label: string;
|
|
215
|
+
allowEmpty: boolean;
|
|
216
|
+
};
|
|
91
217
|
};
|
|
92
218
|
inputs: {
|
|
93
219
|
Input: {
|
|
@@ -4,12 +4,11 @@ import { IAgent } from '@sre/types/Agent.types';
|
|
|
4
4
|
export declare const cachePrefix = "serverless_code";
|
|
5
5
|
export declare const cacheTTL: number;
|
|
6
6
|
export declare function getLambdaFunctionName(agentId: string, componentId: string): string;
|
|
7
|
-
export declare function generateCodeHash(code_body: string,
|
|
7
|
+
export declare function generateCodeHash(code_body: string, codeInputs: string[]): string;
|
|
8
8
|
export declare function getSanitizeCodeHash(code: string): string;
|
|
9
9
|
export declare function getDeployedCodeHash(agentId: string, componentId: string): Promise<any>;
|
|
10
10
|
export declare function setDeployedCodeHash(agentId: string, componentId: string, codeHash: string): Promise<void>;
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function generateLambdaCode(code_imports: string, code_body: string, input_variables: string[]): string;
|
|
11
|
+
export declare function generateLambdaCode(code: string, parameters: string[]): string;
|
|
13
12
|
export declare function zipCode(directory: string): Promise<unknown>;
|
|
14
13
|
export declare function createOrUpdateLambdaFunction(functionName: any, zipFilePath: any, awsConfigs: any): Promise<void>;
|
|
15
14
|
export declare function waitForRoleDeploymentStatus(roleName: any, client: any): Promise<boolean>;
|
|
@@ -38,3 +37,10 @@ export declare function reportUsage({ cost, agentId, teamId }: {
|
|
|
38
37
|
agentId: string;
|
|
39
38
|
teamId: string;
|
|
40
39
|
}): void;
|
|
40
|
+
export declare function validateAsyncMainFunction(code: string): {
|
|
41
|
+
isValid: boolean;
|
|
42
|
+
error?: string;
|
|
43
|
+
parameters?: string[];
|
|
44
|
+
dependencies?: string[];
|
|
45
|
+
};
|
|
46
|
+
export declare function generateCodeFromLegacyComponent(code_body: string, code_imports: string, codeInputs: string[]): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -165,6 +165,7 @@ export * from './subsystems/LLMManager/LLM.service/connectors/Groq.class';
|
|
|
165
165
|
export * from './subsystems/LLMManager/LLM.service/connectors/OpenAI.class';
|
|
166
166
|
export * from './subsystems/LLMManager/LLM.service/connectors/Perplexity.class';
|
|
167
167
|
export * from './subsystems/LLMManager/LLM.service/connectors/VertexAI.class';
|
|
168
|
+
export * from './subsystems/LLMManager/LLM.service/connectors/xAI';
|
|
168
169
|
export * from './subsystems/LLMManager/ModelsProvider.service/connectors/JSONModelsProvider.class';
|
|
169
170
|
export * from './subsystems/MemoryManager/Cache.service/connectors/LocalStorageCache.class';
|
|
170
171
|
export * from './subsystems/MemoryManager/Cache.service/connectors/RAMCache.class';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import { TLLMParams, ToolData, TLLMMessageBlock, TLLMToolResultMessageBlock, TLLMMessageRole, APIKeySource, ILLMRequestFuncParams, TLLMChatResponse } from '@sre/types/LLM.types';
|
|
3
|
+
import { LLMConnector } from '../LLMConnector';
|
|
4
|
+
type ChatCompletionParams = {
|
|
5
|
+
model: string;
|
|
6
|
+
messages: any[];
|
|
7
|
+
max_tokens?: number;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
top_p?: number;
|
|
10
|
+
frequency_penalty?: number;
|
|
11
|
+
presence_penalty?: number;
|
|
12
|
+
stop?: string | string[];
|
|
13
|
+
response_format?: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
stream?: boolean;
|
|
17
|
+
stream_options?: {
|
|
18
|
+
include_usage: boolean;
|
|
19
|
+
};
|
|
20
|
+
tools?: any[];
|
|
21
|
+
tool_choice?: any;
|
|
22
|
+
search_parameters?: {
|
|
23
|
+
mode?: 'auto' | 'on' | 'off';
|
|
24
|
+
return_citations?: boolean;
|
|
25
|
+
max_search_results?: number;
|
|
26
|
+
sources?: Array<{
|
|
27
|
+
type: 'web' | 'x' | 'news' | 'rss';
|
|
28
|
+
country?: string;
|
|
29
|
+
excluded_websites?: string[];
|
|
30
|
+
allowed_websites?: string[];
|
|
31
|
+
safe_search?: boolean;
|
|
32
|
+
included_x_handles?: string[];
|
|
33
|
+
excluded_x_handles?: string[];
|
|
34
|
+
post_favorite_count?: number;
|
|
35
|
+
post_view_count?: number;
|
|
36
|
+
links?: string[];
|
|
37
|
+
}>;
|
|
38
|
+
from_date?: string;
|
|
39
|
+
to_date?: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type TUsage = {
|
|
43
|
+
prompt_tokens: number;
|
|
44
|
+
completion_tokens: number;
|
|
45
|
+
total_tokens: number;
|
|
46
|
+
prompt_tokens_details?: {
|
|
47
|
+
text_tokens?: number;
|
|
48
|
+
audio_tokens?: number;
|
|
49
|
+
image_tokens?: number;
|
|
50
|
+
cached_tokens?: number;
|
|
51
|
+
};
|
|
52
|
+
completion_tokens_details?: {
|
|
53
|
+
reasoning_tokens?: number;
|
|
54
|
+
audio_tokens?: number;
|
|
55
|
+
accepted_prediction_tokens?: number;
|
|
56
|
+
rejected_prediction_tokens?: number;
|
|
57
|
+
};
|
|
58
|
+
reasoning_tokens?: number;
|
|
59
|
+
num_sources_used?: number;
|
|
60
|
+
};
|
|
61
|
+
export declare class xAIConnector extends LLMConnector {
|
|
62
|
+
name: string;
|
|
63
|
+
private getClient;
|
|
64
|
+
protected request({ acRequest, body, context }: ILLMRequestFuncParams): Promise<TLLMChatResponse>;
|
|
65
|
+
protected streamRequest({ acRequest, body, context }: ILLMRequestFuncParams): Promise<EventEmitter>;
|
|
66
|
+
protected webSearchRequest({ acRequest, body, context }: ILLMRequestFuncParams): Promise<EventEmitter>;
|
|
67
|
+
protected reqBodyAdapter(params: TLLMParams): Promise<ChatCompletionParams>;
|
|
68
|
+
protected reportUsage(usage: TUsage, metadata: {
|
|
69
|
+
modelEntryName: string;
|
|
70
|
+
keySource: APIKeySource;
|
|
71
|
+
agentId: string;
|
|
72
|
+
teamId: string;
|
|
73
|
+
}): {
|
|
74
|
+
sourceId: string;
|
|
75
|
+
input_tokens: number;
|
|
76
|
+
output_tokens: number;
|
|
77
|
+
input_tokens_cache_write: number;
|
|
78
|
+
input_tokens_cache_read: number;
|
|
79
|
+
reasoning_tokens: number;
|
|
80
|
+
keySource: APIKeySource;
|
|
81
|
+
agentId: string;
|
|
82
|
+
teamId: string;
|
|
83
|
+
};
|
|
84
|
+
formatToolsConfig({ type, toolDefinitions, toolChoice }: {
|
|
85
|
+
type?: string;
|
|
86
|
+
toolDefinitions: any;
|
|
87
|
+
toolChoice?: string;
|
|
88
|
+
}): {
|
|
89
|
+
tools: any[];
|
|
90
|
+
tool_choice: string;
|
|
91
|
+
} | {
|
|
92
|
+
tools?: undefined;
|
|
93
|
+
tool_choice?: undefined;
|
|
94
|
+
};
|
|
95
|
+
transformToolMessageBlocks({ messageBlock, toolsData, }: {
|
|
96
|
+
messageBlock: TLLMMessageBlock;
|
|
97
|
+
toolsData: ToolData[];
|
|
98
|
+
}): TLLMToolResultMessageBlock[];
|
|
99
|
+
getConsistentMessages(messages: any): {
|
|
100
|
+
role: TLLMMessageRole;
|
|
101
|
+
content?: string | {
|
|
102
|
+
text: string;
|
|
103
|
+
}[] | Array<import("@anthropic-ai/sdk/resources").TextBlockParam | import("@anthropic-ai/sdk/resources").ImageBlockParam | import("@anthropic-ai/sdk/resources").ToolUseBlockParam | import("@anthropic-ai/sdk/resources").ToolResultBlockParam>;
|
|
104
|
+
parts?: {
|
|
105
|
+
text?: string;
|
|
106
|
+
functionCall?: {
|
|
107
|
+
name: string;
|
|
108
|
+
args: string;
|
|
109
|
+
};
|
|
110
|
+
functionResponse?: {
|
|
111
|
+
name: string;
|
|
112
|
+
response: {
|
|
113
|
+
name: string;
|
|
114
|
+
content: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}[];
|
|
118
|
+
tool_calls?: ToolData[];
|
|
119
|
+
}[];
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -74,6 +74,22 @@ export type TLLMParams = {
|
|
|
74
74
|
webSearchCountry?: string;
|
|
75
75
|
webSearchRegion?: string;
|
|
76
76
|
webSearchTimezone?: string;
|
|
77
|
+
useSearch?: boolean;
|
|
78
|
+
searchMode?: 'auto' | 'on' | 'off';
|
|
79
|
+
returnCitations?: boolean;
|
|
80
|
+
maxSearchResults?: number;
|
|
81
|
+
searchDataSources?: string[];
|
|
82
|
+
searchCountry?: string;
|
|
83
|
+
excludedWebsites?: string[];
|
|
84
|
+
allowedWebsites?: string[];
|
|
85
|
+
includedXHandles?: string[];
|
|
86
|
+
excludedXHandles?: string[];
|
|
87
|
+
postFavoriteCount?: number;
|
|
88
|
+
postViewCount?: number;
|
|
89
|
+
rssLinks?: string;
|
|
90
|
+
safeSearch?: boolean;
|
|
91
|
+
fromDate?: string;
|
|
92
|
+
toDate?: string;
|
|
77
93
|
useReasoning?: boolean;
|
|
78
94
|
isUserKey?: boolean;
|
|
79
95
|
capabilities?: {
|
package/package.json
CHANGED
|
@@ -97,6 +97,138 @@ export class GenAILLM extends Component {
|
|
|
97
97
|
description: 'The maximum number of messages to use from this component context window (if useContextWindow is true)',
|
|
98
98
|
label: 'Maximum Context Window Length',
|
|
99
99
|
},
|
|
100
|
+
|
|
101
|
+
// #region Web Search
|
|
102
|
+
useWebSearch: {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
description: 'If true, the component will use web search for additional context',
|
|
105
|
+
label: 'Use Web Search',
|
|
106
|
+
},
|
|
107
|
+
webSearchContextSize: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
valid: ['high', 'medium', 'low'],
|
|
110
|
+
label: 'Web Search Context Size',
|
|
111
|
+
},
|
|
112
|
+
webSearchCity: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
max: 100,
|
|
115
|
+
label: 'Web Search City',
|
|
116
|
+
allowEmpty: true,
|
|
117
|
+
},
|
|
118
|
+
webSearchCountry: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
max: 2,
|
|
121
|
+
label: 'Web Search Country',
|
|
122
|
+
allowEmpty: true,
|
|
123
|
+
},
|
|
124
|
+
webSearchRegion: {
|
|
125
|
+
type: 'string',
|
|
126
|
+
max: 100,
|
|
127
|
+
label: 'Web Search Region',
|
|
128
|
+
allowEmpty: true,
|
|
129
|
+
},
|
|
130
|
+
webSearchTimezone: {
|
|
131
|
+
type: 'string',
|
|
132
|
+
max: 100,
|
|
133
|
+
label: 'Web Search Timezone',
|
|
134
|
+
allowEmpty: true,
|
|
135
|
+
},
|
|
136
|
+
// #endregion
|
|
137
|
+
|
|
138
|
+
// #region xAI Search
|
|
139
|
+
useSearch: {
|
|
140
|
+
type: 'boolean',
|
|
141
|
+
description: 'If true, the component will use xAI live search capabilities',
|
|
142
|
+
label: 'Use Search',
|
|
143
|
+
},
|
|
144
|
+
searchMode: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
valid: ['auto', 'on', 'off'],
|
|
147
|
+
label: 'Search Mode',
|
|
148
|
+
},
|
|
149
|
+
returnCitations: {
|
|
150
|
+
type: 'boolean',
|
|
151
|
+
description: 'If true, include citations and sources in the response',
|
|
152
|
+
label: 'Return Citations',
|
|
153
|
+
},
|
|
154
|
+
maxSearchResults: {
|
|
155
|
+
type: 'number',
|
|
156
|
+
min: 1,
|
|
157
|
+
max: 50,
|
|
158
|
+
label: 'Max Search Results',
|
|
159
|
+
},
|
|
160
|
+
searchDataSources: {
|
|
161
|
+
type: 'array',
|
|
162
|
+
max: 4,
|
|
163
|
+
label: 'Search Data Sources',
|
|
164
|
+
allowEmpty: true,
|
|
165
|
+
},
|
|
166
|
+
searchCountry: {
|
|
167
|
+
type: 'string',
|
|
168
|
+
max: 2,
|
|
169
|
+
label: 'Search Country',
|
|
170
|
+
allowEmpty: true,
|
|
171
|
+
},
|
|
172
|
+
excludedWebsites: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
max: 10000,
|
|
175
|
+
label: 'Excluded Websites',
|
|
176
|
+
allowEmpty: true,
|
|
177
|
+
},
|
|
178
|
+
allowedWebsites: {
|
|
179
|
+
type: 'string',
|
|
180
|
+
max: 10000,
|
|
181
|
+
label: 'Allowed Websites',
|
|
182
|
+
allowEmpty: true,
|
|
183
|
+
},
|
|
184
|
+
includedXHandles: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
max: 1000,
|
|
187
|
+
label: 'Included X Handles',
|
|
188
|
+
allowEmpty: true,
|
|
189
|
+
},
|
|
190
|
+
excludedXHandles: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
max: 1000,
|
|
193
|
+
label: 'Excluded X Handles',
|
|
194
|
+
allowEmpty: true,
|
|
195
|
+
},
|
|
196
|
+
postFavoriteCount: {
|
|
197
|
+
type: 'number',
|
|
198
|
+
min: 0,
|
|
199
|
+
max: 1000000000,
|
|
200
|
+
label: 'Post Favorite Count',
|
|
201
|
+
},
|
|
202
|
+
postViewCount: {
|
|
203
|
+
type: 'number',
|
|
204
|
+
min: 0,
|
|
205
|
+
max: 1000000000,
|
|
206
|
+
label: 'Post View Count',
|
|
207
|
+
},
|
|
208
|
+
link: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
max: 5000,
|
|
211
|
+
label: 'RSS Link',
|
|
212
|
+
allowEmpty: true,
|
|
213
|
+
},
|
|
214
|
+
safeSearch: {
|
|
215
|
+
type: 'boolean',
|
|
216
|
+
description: 'If true, enable safe search filtering',
|
|
217
|
+
label: 'Safe Search',
|
|
218
|
+
},
|
|
219
|
+
fromDate: {
|
|
220
|
+
type: 'string',
|
|
221
|
+
max: 10,
|
|
222
|
+
label: 'From Date',
|
|
223
|
+
allowEmpty: true,
|
|
224
|
+
},
|
|
225
|
+
toDate: {
|
|
226
|
+
type: 'string',
|
|
227
|
+
max: 10,
|
|
228
|
+
label: 'To Date',
|
|
229
|
+
allowEmpty: true,
|
|
230
|
+
},
|
|
231
|
+
// #endregion
|
|
100
232
|
},
|
|
101
233
|
inputs: {
|
|
102
234
|
Input: {
|
|
@@ -131,13 +263,40 @@ export class GenAILLM extends Component {
|
|
|
131
263
|
useContextWindow: Joi.boolean().optional().label('Use Context Window'),
|
|
132
264
|
maxContextWindowLength: Joi.number().optional().min(0).label('Maximum Context Window Length'),
|
|
133
265
|
|
|
134
|
-
// #region Search
|
|
135
|
-
useWebSearch: Joi.boolean().optional().label('Use Search'),
|
|
136
|
-
webSearchContextSize: Joi.string().valid('high', 'medium', 'low').optional().label('Search
|
|
137
|
-
webSearchCity: Joi.string().max(100).optional().allow('').label('Search City'),
|
|
138
|
-
webSearchCountry: Joi.string().max(
|
|
139
|
-
webSearchRegion: Joi.string().max(100).optional().allow('').label('Search Region'),
|
|
140
|
-
webSearchTimezone: Joi.string().max(100).optional().allow('').label('Search Timezone'),
|
|
266
|
+
// #region Web Search
|
|
267
|
+
useWebSearch: Joi.boolean().optional().label('Use Web Search'),
|
|
268
|
+
webSearchContextSize: Joi.string().valid('high', 'medium', 'low').optional().label('Web Search Context Size'),
|
|
269
|
+
webSearchCity: Joi.string().max(100).optional().allow('').label('Web Search City'),
|
|
270
|
+
webSearchCountry: Joi.string().max(2).optional().allow('').label('Web Search Country'),
|
|
271
|
+
webSearchRegion: Joi.string().max(100).optional().allow('').label('Web Search Region'),
|
|
272
|
+
webSearchTimezone: Joi.string().max(100).optional().allow('').label('Web Search Timezone'),
|
|
273
|
+
// #endregion
|
|
274
|
+
|
|
275
|
+
// #region xAI Search
|
|
276
|
+
useSearch: Joi.boolean().optional().label('Use Search'),
|
|
277
|
+
searchMode: Joi.string().valid('auto', 'on', 'off').optional().label('Search Mode'),
|
|
278
|
+
returnCitations: Joi.boolean().optional().label('Return Citations'),
|
|
279
|
+
maxSearchResults: Joi.number().min(1).max(100).optional().label('Max Search Results'),
|
|
280
|
+
searchDataSources: Joi.array().items(Joi.string().valid('web', 'x', 'news', 'rss')).max(4).optional().label('Search Data Sources'),
|
|
281
|
+
searchCountry: Joi.string().length(2).optional().allow('').label('Search Country'),
|
|
282
|
+
excludedWebsites: Joi.string().max(10000).optional().allow('').label('Excluded Websites'),
|
|
283
|
+
allowedWebsites: Joi.string().max(10000).optional().allow('').label('Allowed Websites'),
|
|
284
|
+
includedXHandles: Joi.string().max(1000).optional().allow('').label('Included X Handles'),
|
|
285
|
+
excludedXHandles: Joi.string().max(1000).optional().allow('').label('Excluded X Handles'),
|
|
286
|
+
postFavoriteCount: Joi.number().min(0).max(1000000000).optional().label('Post Favorite Count'),
|
|
287
|
+
postViewCount: Joi.number().min(0).max(1000000000).optional().label('Post View Count'),
|
|
288
|
+
rssLinks: Joi.string().max(10000).optional().allow('').label('RSS Link'),
|
|
289
|
+
safeSearch: Joi.boolean().optional().label('Safe Search'),
|
|
290
|
+
fromDate: Joi.string()
|
|
291
|
+
.pattern(/^\d{4}-\d{2}-\d{2}$/)
|
|
292
|
+
.optional()
|
|
293
|
+
.allow('')
|
|
294
|
+
.label('From Date'),
|
|
295
|
+
toDate: Joi.string()
|
|
296
|
+
.pattern(/^\d{4}-\d{2}-\d{2}$/)
|
|
297
|
+
.optional()
|
|
298
|
+
.allow('')
|
|
299
|
+
.label('To Date'),
|
|
141
300
|
// #endregion
|
|
142
301
|
|
|
143
302
|
useReasoning: Joi.boolean().optional().label('Use Reasoning'),
|
|
@@ -3,13 +3,14 @@ import { Component } from './Component.class';
|
|
|
3
3
|
import Joi from 'joi';
|
|
4
4
|
import { ConnectorService } from '@sre/Core/ConnectorsService';
|
|
5
5
|
import { AWSCredentials, AWSRegionConfig } from '@sre/types/AWS.types';
|
|
6
|
-
import { calculateExecutionCost, getLambdaCredentials, reportUsage } from '@sre/helpers/AWSLambdaCode.helper';
|
|
6
|
+
import { calculateExecutionCost, generateCodeFromLegacyComponent, getLambdaCredentials, reportUsage } from '@sre/helpers/AWSLambdaCode.helper';
|
|
7
7
|
|
|
8
8
|
export class ServerlessCode extends Component {
|
|
9
9
|
|
|
10
10
|
protected configSchema = Joi.object({
|
|
11
11
|
code_imports: Joi.string().max(1000).allow('').label('Imports'),
|
|
12
12
|
code_body: Joi.string().max(500000).allow('').label('Code'),
|
|
13
|
+
code: Joi.string().max(500000).allow('').label('Code').optional(),
|
|
13
14
|
deploy_btn: Joi.string().max(500000).allow('').label('Deploy').optional(),
|
|
14
15
|
accessKeyId: Joi.string().max(100).allow('').label('AWS Access Key ID').optional(),
|
|
15
16
|
secretAccessKey: Joi.string().max(200).allow('').label('AWS Secret Access Key').optional(),
|
|
@@ -70,11 +71,14 @@ export class ServerlessCode extends Component {
|
|
|
70
71
|
secretAccessKey: codeCredentials.secretAccessKey,
|
|
71
72
|
})
|
|
72
73
|
}
|
|
74
|
+
let code = config?.data?.code;
|
|
75
|
+
if (!code) {
|
|
76
|
+
code = generateCodeFromLegacyComponent(config.data.code_body, config.data.code_imports, Object.keys(codeInputs))
|
|
77
|
+
}
|
|
73
78
|
// Deploy lambda function if it doesn't exist or the code hash is different
|
|
74
79
|
await codeConnector.agent(agent.id)
|
|
75
80
|
.deploy(config.id, {
|
|
76
|
-
code
|
|
77
|
-
dependencies: config?.data?.code_imports,
|
|
81
|
+
code,
|
|
78
82
|
inputs: codeInputs,
|
|
79
83
|
}, {
|
|
80
84
|
runtime: 'nodejs',
|