Skip to content

Commit dc7c321

Browse files
committed
feat(models): updated model configs, updated anthropic provider to propagate errors back to user if any
1 parent 1edaf19 commit dc7c321

File tree

10 files changed

+502
-258
lines changed

10 files changed

+502
-258
lines changed

apps/sim/blocks/blocks/agent.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Return ONLY the JSON array.`,
164164
type: 'dropdown',
165165
placeholder: 'Select reasoning effort...',
166166
options: [
167+
{ label: 'auto', id: 'auto' },
167168
{ label: 'low', id: 'low' },
168169
{ label: 'medium', id: 'medium' },
169170
{ label: 'high', id: 'high' },
@@ -173,9 +174,12 @@ Return ONLY the JSON array.`,
173174
const { useSubBlockStore } = await import('@/stores/workflows/subblock/store')
174175
const { useWorkflowRegistry } = await import('@/stores/workflows/registry/store')
175176

177+
const autoOption = { label: 'auto', id: 'auto' }
178+
176179
const activeWorkflowId = useWorkflowRegistry.getState().activeWorkflowId
177180
if (!activeWorkflowId) {
178181
return [
182+
autoOption,
179183
{ label: 'low', id: 'low' },
180184
{ label: 'medium', id: 'medium' },
181185
{ label: 'high', id: 'high' },
@@ -188,6 +192,7 @@ Return ONLY the JSON array.`,
188192

189193
if (!modelValue) {
190194
return [
195+
autoOption,
191196
{ label: 'low', id: 'low' },
192197
{ label: 'medium', id: 'medium' },
193198
{ label: 'high', id: 'high' },
@@ -197,15 +202,15 @@ Return ONLY the JSON array.`,
197202
const validOptions = getReasoningEffortValuesForModel(modelValue)
198203
if (!validOptions) {
199204
return [
205+
autoOption,
200206
{ label: 'low', id: 'low' },
201207
{ label: 'medium', id: 'medium' },
202208
{ label: 'high', id: 'high' },
203209
]
204210
}
205211

206-
return validOptions.map((opt) => ({ label: opt, id: opt }))
212+
return [autoOption, ...validOptions.map((opt) => ({ label: opt, id: opt }))]
207213
},
208-
value: () => 'medium',
209214
condition: {
210215
field: 'model',
211216
value: MODELS_WITH_REASONING_EFFORT,
@@ -217,6 +222,7 @@ Return ONLY the JSON array.`,
217222
type: 'dropdown',
218223
placeholder: 'Select verbosity...',
219224
options: [
225+
{ label: 'auto', id: 'auto' },
220226
{ label: 'low', id: 'low' },
221227
{ label: 'medium', id: 'medium' },
222228
{ label: 'high', id: 'high' },
@@ -226,9 +232,12 @@ Return ONLY the JSON array.`,
226232
const { useSubBlockStore } = await import('@/stores/workflows/subblock/store')
227233
const { useWorkflowRegistry } = await import('@/stores/workflows/registry/store')
228234

235+
const autoOption = { label: 'auto', id: 'auto' }
236+
229237
const activeWorkflowId = useWorkflowRegistry.getState().activeWorkflowId
230238
if (!activeWorkflowId) {
231239
return [
240+
autoOption,
232241
{ label: 'low', id: 'low' },
233242
{ label: 'medium', id: 'medium' },
234243
{ label: 'high', id: 'high' },
@@ -241,6 +250,7 @@ Return ONLY the JSON array.`,
241250

242251
if (!modelValue) {
243252
return [
253+
autoOption,
244254
{ label: 'low', id: 'low' },
245255
{ label: 'medium', id: 'medium' },
246256
{ label: 'high', id: 'high' },
@@ -250,15 +260,15 @@ Return ONLY the JSON array.`,
250260
const validOptions = getVerbosityValuesForModel(modelValue)
251261
if (!validOptions) {
252262
return [
263+
autoOption,
253264
{ label: 'low', id: 'low' },
254265
{ label: 'medium', id: 'medium' },
255266
{ label: 'high', id: 'high' },
256267
]
257268
}
258269

259-
return validOptions.map((opt) => ({ label: opt, id: opt }))
270+
return [autoOption, ...validOptions.map((opt) => ({ label: opt, id: opt }))]
260271
},
261-
value: () => 'medium',
262272
condition: {
263273
field: 'model',
264274
value: MODELS_WITH_VERBOSITY,
@@ -270,6 +280,7 @@ Return ONLY the JSON array.`,
270280
type: 'dropdown',
271281
placeholder: 'Select thinking level...',
272282
options: [
283+
{ label: 'none', id: 'none' },
273284
{ label: 'minimal', id: 'minimal' },
274285
{ label: 'low', id: 'low' },
275286
{ label: 'medium', id: 'medium' },
@@ -281,36 +292,28 @@ Return ONLY the JSON array.`,
281292
const { useSubBlockStore } = await import('@/stores/workflows/subblock/store')
282293
const { useWorkflowRegistry } = await import('@/stores/workflows/registry/store')
283294

295+
const noneOption = { label: 'none', id: 'none' }
296+
284297
const activeWorkflowId = useWorkflowRegistry.getState().activeWorkflowId
285298
if (!activeWorkflowId) {
286-
return [
287-
{ label: 'low', id: 'low' },
288-
{ label: 'high', id: 'high' },
289-
]
299+
return [noneOption, { label: 'low', id: 'low' }, { label: 'high', id: 'high' }]
290300
}
291301

292302
const workflowValues = useSubBlockStore.getState().workflowValues[activeWorkflowId]
293303
const blockValues = workflowValues?.[blockId]
294304
const modelValue = blockValues?.model as string
295305

296306
if (!modelValue) {
297-
return [
298-
{ label: 'low', id: 'low' },
299-
{ label: 'high', id: 'high' },
300-
]
307+
return [noneOption, { label: 'low', id: 'low' }, { label: 'high', id: 'high' }]
301308
}
302309

303310
const validOptions = getThinkingLevelsForModel(modelValue)
304311
if (!validOptions) {
305-
return [
306-
{ label: 'low', id: 'low' },
307-
{ label: 'high', id: 'high' },
308-
]
312+
return [noneOption, { label: 'low', id: 'low' }, { label: 'high', id: 'high' }]
309313
}
310314

311-
return validOptions.map((opt) => ({ label: opt, id: opt }))
315+
return [noneOption, ...validOptions.map((opt) => ({ label: opt, id: opt }))]
312316
},
313-
value: () => 'high',
314317
condition: {
315318
field: 'model',
316319
value: MODELS_WITH_THINKING,

apps/sim/executor/handlers/agent/agent-handler.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -906,24 +906,17 @@ export class AgentBlockHandler implements BlockHandler {
906906
}
907907
}
908908

909-
// Find first system message
910909
const firstSystemIndex = messages.findIndex((msg) => msg.role === 'system')
911910

912911
if (firstSystemIndex === -1) {
913-
// No system message exists - add at position 0
914912
messages.unshift({ role: 'system', content })
915913
} else if (firstSystemIndex === 0) {
916-
// System message already at position 0 - replace it
917-
// Explicit systemPrompt parameter takes precedence over memory/messages
918914
messages[0] = { role: 'system', content }
919915
} else {
920-
// System message exists but not at position 0 - move it to position 0
921-
// and update with new content
922916
messages.splice(firstSystemIndex, 1)
923917
messages.unshift({ role: 'system', content })
924918
}
925919

926-
// Remove any additional system messages (keep only the first one)
927920
for (let i = messages.length - 1; i >= 1; i--) {
928921
if (messages[i].role === 'system') {
929922
messages.splice(i, 1)
@@ -996,6 +989,7 @@ export class AgentBlockHandler implements BlockHandler {
996989
blockNameMapping,
997990
reasoningEffort: inputs.reasoningEffort,
998991
verbosity: inputs.verbosity,
992+
thinkingLevel: inputs.thinkingLevel,
999993
}
1000994
}
1001995

@@ -1064,6 +1058,7 @@ export class AgentBlockHandler implements BlockHandler {
10641058
isDeployedContext: ctx.isDeployedContext,
10651059
reasoningEffort: providerRequest.reasoningEffort,
10661060
verbosity: providerRequest.verbosity,
1061+
thinkingLevel: providerRequest.thinkingLevel,
10671062
})
10681063

10691064
return this.processProviderResponse(response, block, responseFormat)
@@ -1081,8 +1076,6 @@ export class AgentBlockHandler implements BlockHandler {
10811076

10821077
logger.info(`[${requestId}] Resolving Vertex AI credential: ${credentialId}`)
10831078

1084-
// Get the credential - we need to find the owner
1085-
// Since we're in a workflow context, we can query the credential directly
10861079
const credential = await db.query.account.findFirst({
10871080
where: eq(account.id, credentialId),
10881081
})
@@ -1091,7 +1084,6 @@ export class AgentBlockHandler implements BlockHandler {
10911084
throw new Error(`Vertex AI credential not found: ${credentialId}`)
10921085
}
10931086

1094-
// Refresh the token if needed
10951087
const { accessToken } = await refreshTokenIfNeeded(requestId, credential, credentialId)
10961088

10971089
if (!accessToken) {

apps/sim/executor/handlers/agent/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface AgentInputs {
3434
bedrockRegion?: string
3535
reasoningEffort?: string
3636
verbosity?: string
37+
thinkingLevel?: string
3738
}
3839

3940
export interface ToolInput {

0 commit comments

Comments
 (0)