Skip to content

Commit 7b5405e

Browse files
authored
feat(vertex): added vertex to list of supported providers (#2430)
* feat(vertex): added vertex to list of supported providers * added utils files for each provider, consolidated gemini utils, added dynamic verbosity and reasoning fetcher
1 parent 1ae3b47 commit 7b5405e

File tree

48 files changed

+2767
-935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2767
-935
lines changed

apps/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"license": "Apache-2.0",
66
"scripts": {
7-
"dev": "next dev --port 3001",
7+
"dev": "next dev --port 7322",
88
"build": "fumadocs-mdx && NODE_OPTIONS='--max-old-space-size=8192' next build",
99
"start": "next start",
1010
"postinstall": "fumadocs-mdx",

apps/sim/app/api/copilot/chat/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ export async function POST(req: NextRequest) {
303303
apiVersion: 'preview',
304304
endpoint: env.AZURE_OPENAI_ENDPOINT,
305305
}
306+
} else if (providerEnv === 'vertex') {
307+
providerConfig = {
308+
provider: 'vertex',
309+
model: modelToUse,
310+
apiKey: env.COPILOT_API_KEY,
311+
vertexProject: env.VERTEX_PROJECT,
312+
vertexLocation: env.VERTEX_LOCATION,
313+
}
306314
} else {
307315
providerConfig = {
308316
provider: providerEnv,

apps/sim/app/api/copilot/context-usage/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ export async function POST(req: NextRequest) {
6666
apiVersion: env.AZURE_OPENAI_API_VERSION,
6767
endpoint: env.AZURE_OPENAI_ENDPOINT,
6868
}
69+
} else if (providerEnv === 'vertex') {
70+
providerConfig = {
71+
provider: 'vertex',
72+
model: modelToUse,
73+
apiKey: env.COPILOT_API_KEY,
74+
vertexProject: env.VERTEX_PROJECT,
75+
vertexLocation: env.VERTEX_LOCATION,
76+
}
6977
} else {
7078
providerConfig = {
7179
provider: providerEnv,

apps/sim/app/api/providers/route.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export async function POST(request: NextRequest) {
3535
apiKey,
3636
azureEndpoint,
3737
azureApiVersion,
38+
vertexProject,
39+
vertexLocation,
3840
responseFormat,
3941
workflowId,
4042
workspaceId,
@@ -58,6 +60,8 @@ export async function POST(request: NextRequest) {
5860
hasApiKey: !!apiKey,
5961
hasAzureEndpoint: !!azureEndpoint,
6062
hasAzureApiVersion: !!azureApiVersion,
63+
hasVertexProject: !!vertexProject,
64+
hasVertexLocation: !!vertexLocation,
6165
hasResponseFormat: !!responseFormat,
6266
workflowId,
6367
stream: !!stream,
@@ -104,6 +108,8 @@ export async function POST(request: NextRequest) {
104108
apiKey: finalApiKey,
105109
azureEndpoint,
106110
azureApiVersion,
111+
vertexProject,
112+
vertexLocation,
107113
responseFormat,
108114
workflowId,
109115
workspaceId,

apps/sim/blocks/blocks/agent.ts

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
getHostedModels,
99
getMaxTemperature,
1010
getProviderIcon,
11+
getReasoningEffortValuesForModel,
12+
getVerbosityValuesForModel,
1113
MODELS_WITH_REASONING_EFFORT,
1214
MODELS_WITH_VERBOSITY,
1315
providers,
@@ -114,12 +116,47 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
114116
type: 'dropdown',
115117
placeholder: 'Select reasoning effort...',
116118
options: [
117-
{ label: 'none', id: 'none' },
118-
{ label: 'minimal', id: 'minimal' },
119119
{ label: 'low', id: 'low' },
120120
{ label: 'medium', id: 'medium' },
121121
{ label: 'high', id: 'high' },
122122
],
123+
dependsOn: ['model'],
124+
fetchOptions: async (blockId: string) => {
125+
const { useSubBlockStore } = await import('@/stores/workflows/subblock/store')
126+
const { useWorkflowRegistry } = await import('@/stores/workflows/registry/store')
127+
128+
const activeWorkflowId = useWorkflowRegistry.getState().activeWorkflowId
129+
if (!activeWorkflowId) {
130+
return [
131+
{ label: 'low', id: 'low' },
132+
{ label: 'medium', id: 'medium' },
133+
{ label: 'high', id: 'high' },
134+
]
135+
}
136+
137+
const workflowValues = useSubBlockStore.getState().workflowValues[activeWorkflowId]
138+
const blockValues = workflowValues?.[blockId]
139+
const modelValue = blockValues?.model as string
140+
141+
if (!modelValue) {
142+
return [
143+
{ label: 'low', id: 'low' },
144+
{ label: 'medium', id: 'medium' },
145+
{ label: 'high', id: 'high' },
146+
]
147+
}
148+
149+
const validOptions = getReasoningEffortValuesForModel(modelValue)
150+
if (!validOptions) {
151+
return [
152+
{ label: 'low', id: 'low' },
153+
{ label: 'medium', id: 'medium' },
154+
{ label: 'high', id: 'high' },
155+
]
156+
}
157+
158+
return validOptions.map((opt) => ({ label: opt, id: opt }))
159+
},
123160
value: () => 'medium',
124161
condition: {
125162
field: 'model',
@@ -136,6 +173,43 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
136173
{ label: 'medium', id: 'medium' },
137174
{ label: 'high', id: 'high' },
138175
],
176+
dependsOn: ['model'],
177+
fetchOptions: async (blockId: string) => {
178+
const { useSubBlockStore } = await import('@/stores/workflows/subblock/store')
179+
const { useWorkflowRegistry } = await import('@/stores/workflows/registry/store')
180+
181+
const activeWorkflowId = useWorkflowRegistry.getState().activeWorkflowId
182+
if (!activeWorkflowId) {
183+
return [
184+
{ label: 'low', id: 'low' },
185+
{ label: 'medium', id: 'medium' },
186+
{ label: 'high', id: 'high' },
187+
]
188+
}
189+
190+
const workflowValues = useSubBlockStore.getState().workflowValues[activeWorkflowId]
191+
const blockValues = workflowValues?.[blockId]
192+
const modelValue = blockValues?.model as string
193+
194+
if (!modelValue) {
195+
return [
196+
{ label: 'low', id: 'low' },
197+
{ label: 'medium', id: 'medium' },
198+
{ label: 'high', id: 'high' },
199+
]
200+
}
201+
202+
const validOptions = getVerbosityValuesForModel(modelValue)
203+
if (!validOptions) {
204+
return [
205+
{ label: 'low', id: 'low' },
206+
{ label: 'medium', id: 'medium' },
207+
{ label: 'high', id: 'high' },
208+
]
209+
}
210+
211+
return validOptions.map((opt) => ({ label: opt, id: opt }))
212+
},
139213
value: () => 'medium',
140214
condition: {
141215
field: 'model',
@@ -166,6 +240,28 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
166240
value: providers['azure-openai'].models,
167241
},
168242
},
243+
{
244+
id: 'vertexProject',
245+
title: 'Vertex AI Project',
246+
type: 'short-input',
247+
placeholder: 'your-gcp-project-id',
248+
connectionDroppable: false,
249+
condition: {
250+
field: 'model',
251+
value: providers.vertex.models,
252+
},
253+
},
254+
{
255+
id: 'vertexLocation',
256+
title: 'Vertex AI Location',
257+
type: 'short-input',
258+
placeholder: 'us-central1',
259+
connectionDroppable: false,
260+
condition: {
261+
field: 'model',
262+
value: providers.vertex.models,
263+
},
264+
},
169265
{
170266
id: 'tools',
171267
title: 'Tools',
@@ -465,6 +561,8 @@ Example 3 (Array Input):
465561
apiKey: { type: 'string', description: 'Provider API key' },
466562
azureEndpoint: { type: 'string', description: 'Azure OpenAI endpoint URL' },
467563
azureApiVersion: { type: 'string', description: 'Azure API version' },
564+
vertexProject: { type: 'string', description: 'Google Cloud project ID for Vertex AI' },
565+
vertexLocation: { type: 'string', description: 'Google Cloud location for Vertex AI' },
468566
responseFormat: {
469567
type: 'json',
470568
description: 'JSON response format schema',

apps/sim/blocks/blocks/evaluator.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,28 @@ export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
239239
value: providers['azure-openai'].models,
240240
},
241241
},
242+
{
243+
id: 'vertexProject',
244+
title: 'Vertex AI Project',
245+
type: 'short-input',
246+
placeholder: 'your-gcp-project-id',
247+
connectionDroppable: false,
248+
condition: {
249+
field: 'model',
250+
value: providers.vertex.models,
251+
},
252+
},
253+
{
254+
id: 'vertexLocation',
255+
title: 'Vertex AI Location',
256+
type: 'short-input',
257+
placeholder: 'us-central1',
258+
connectionDroppable: false,
259+
condition: {
260+
field: 'model',
261+
value: providers.vertex.models,
262+
},
263+
},
242264
{
243265
id: 'temperature',
244266
title: 'Temperature',
@@ -356,6 +378,14 @@ export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
356378
apiKey: { type: 'string' as ParamType, description: 'Provider API key' },
357379
azureEndpoint: { type: 'string' as ParamType, description: 'Azure OpenAI endpoint URL' },
358380
azureApiVersion: { type: 'string' as ParamType, description: 'Azure API version' },
381+
vertexProject: {
382+
type: 'string' as ParamType,
383+
description: 'Google Cloud project ID for Vertex AI',
384+
},
385+
vertexLocation: {
386+
type: 'string' as ParamType,
387+
description: 'Google Cloud location for Vertex AI',
388+
},
359389
temperature: {
360390
type: 'number' as ParamType,
361391
description: 'Response randomness level (low for consistent evaluation)',

apps/sim/blocks/blocks/router.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,28 @@ export const RouterBlock: BlockConfig<RouterResponse> = {
188188
value: providers['azure-openai'].models,
189189
},
190190
},
191+
{
192+
id: 'vertexProject',
193+
title: 'Vertex AI Project',
194+
type: 'short-input',
195+
placeholder: 'your-gcp-project-id',
196+
connectionDroppable: false,
197+
condition: {
198+
field: 'model',
199+
value: providers.vertex.models,
200+
},
201+
},
202+
{
203+
id: 'vertexLocation',
204+
title: 'Vertex AI Location',
205+
type: 'short-input',
206+
placeholder: 'us-central1',
207+
connectionDroppable: false,
208+
condition: {
209+
field: 'model',
210+
value: providers.vertex.models,
211+
},
212+
},
191213
{
192214
id: 'temperature',
193215
title: 'Temperature',
@@ -235,6 +257,8 @@ export const RouterBlock: BlockConfig<RouterResponse> = {
235257
apiKey: { type: 'string', description: 'Provider API key' },
236258
azureEndpoint: { type: 'string', description: 'Azure OpenAI endpoint URL' },
237259
azureApiVersion: { type: 'string', description: 'Azure API version' },
260+
vertexProject: { type: 'string', description: 'Google Cloud project ID for Vertex AI' },
261+
vertexLocation: { type: 'string', description: 'Google Cloud location for Vertex AI' },
238262
temperature: {
239263
type: 'number',
240264
description: 'Response randomness level (low for consistent routing)',

apps/sim/blocks/blocks/translate.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,28 @@ export const TranslateBlock: BlockConfig = {
9999
value: providers['azure-openai'].models,
100100
},
101101
},
102+
{
103+
id: 'vertexProject',
104+
title: 'Vertex AI Project',
105+
type: 'short-input',
106+
placeholder: 'your-gcp-project-id',
107+
connectionDroppable: false,
108+
condition: {
109+
field: 'model',
110+
value: providers.vertex.models,
111+
},
112+
},
113+
{
114+
id: 'vertexLocation',
115+
title: 'Vertex AI Location',
116+
type: 'short-input',
117+
placeholder: 'us-central1',
118+
connectionDroppable: false,
119+
condition: {
120+
field: 'model',
121+
value: providers.vertex.models,
122+
},
123+
},
102124
{
103125
id: 'systemPrompt',
104126
title: 'System Prompt',
@@ -120,6 +142,8 @@ export const TranslateBlock: BlockConfig = {
120142
apiKey: params.apiKey,
121143
azureEndpoint: params.azureEndpoint,
122144
azureApiVersion: params.azureApiVersion,
145+
vertexProject: params.vertexProject,
146+
vertexLocation: params.vertexLocation,
123147
}),
124148
},
125149
},
@@ -129,6 +153,8 @@ export const TranslateBlock: BlockConfig = {
129153
apiKey: { type: 'string', description: 'Provider API key' },
130154
azureEndpoint: { type: 'string', description: 'Azure OpenAI endpoint URL' },
131155
azureApiVersion: { type: 'string', description: 'Azure API version' },
156+
vertexProject: { type: 'string', description: 'Google Cloud project ID for Vertex AI' },
157+
vertexLocation: { type: 'string', description: 'Google Cloud location for Vertex AI' },
132158
systemPrompt: { type: 'string', description: 'Translation instructions' },
133159
},
134160
outputs: {

apps/sim/components/icons.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,56 @@ export const GeminiIcon = (props: SVGProps<SVGSVGElement>) => (
24522452
</svg>
24532453
)
24542454

2455+
export const VertexIcon = (props: SVGProps<SVGSVGElement>) => (
2456+
<svg
2457+
{...props}
2458+
id='standard_product_icon'
2459+
xmlns='http://www.w3.org/2000/svg'
2460+
version='1.1'
2461+
viewBox='0 0 512 512'
2462+
>
2463+
<g id='bounding_box'>
2464+
<rect width='512' height='512' fill='none' />
2465+
</g>
2466+
<g id='art'>
2467+
<path
2468+
d='M128,244.99c-8.84,0-16-7.16-16-16v-95.97c0-8.84,7.16-16,16-16s16,7.16,16,16v95.97c0,8.84-7.16,16-16,16Z'
2469+
fill='#ea4335'
2470+
/>
2471+
<path
2472+
d='M256,458c-2.98,0-5.97-.83-8.59-2.5l-186-122c-7.46-4.74-9.65-14.63-4.91-22.09,4.75-7.46,14.64-9.65,22.09-4.91l177.41,116.53,177.41-116.53c7.45-4.74,17.34-2.55,22.09,4.91,4.74,7.46,2.55,17.34-4.91,22.09l-186,122c-2.62,1.67-5.61,2.5-8.59,2.5Z'
2473+
fill='#fbbc04'
2474+
/>
2475+
<path
2476+
d='M256,388.03c-8.84,0-16-7.16-16-16v-73.06c0-8.84,7.16-16,16-16s16,7.16,16,16v73.06c0,8.84-7.16,16-16,16Z'
2477+
fill='#34a853'
2478+
/>
2479+
<circle cx='128' cy='70' r='16' fill='#ea4335' />
2480+
<circle cx='128' cy='292' r='16' fill='#ea4335' />
2481+
<path
2482+
d='M384.23,308.01c-8.82,0-15.98-7.14-16-15.97l-.23-94.01c-.02-8.84,7.13-16.02,15.97-16.03h.04c8.82,0,15.98,7.14,16,15.97l.23,94.01c.02,8.84-7.13,16.02-15.97,16.03h-.04Z'
2483+
fill='#4285f4'
2484+
/>
2485+
<circle cx='384' cy='70' r='16' fill='#4285f4' />
2486+
<circle cx='384' cy='134' r='16' fill='#4285f4' />
2487+
<path
2488+
d='M320,220.36c-8.84,0-16-7.16-16-16v-103.02c0-8.84,7.16-16,16-16s16,7.16,16,16v103.02c0,8.84-7.16,16-16,16Z'
2489+
fill='#fbbc04'
2490+
/>
2491+
<circle cx='256' cy='171' r='16' fill='#34a853' />
2492+
<circle cx='256' cy='235' r='16' fill='#34a853' />
2493+
<circle cx='320' cy='265' r='16' fill='#fbbc04' />
2494+
<circle cx='320' cy='329' r='16' fill='#fbbc04' />
2495+
<path
2496+
d='M192,217.36c-8.84,0-16-7.16-16-16v-100.02c0-8.84,7.16-16,16-16s16,7.16,16,16v100.02c0,8.84-7.16,16-16,16Z'
2497+
fill='#fbbc04'
2498+
/>
2499+
<circle cx='192' cy='265' r='16' fill='#fbbc04' />
2500+
<circle cx='192' cy='329' r='16' fill='#fbbc04' />
2501+
</g>
2502+
</svg>
2503+
)
2504+
24552505
export const CerebrasIcon = (props: SVGProps<SVGSVGElement>) => (
24562506
<svg
24572507
{...props}

0 commit comments

Comments
 (0)