mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-12 15:34:58 -05:00
feat(models): updated model configs, updated anthropic provider to propagate errors back to user if any (#3159)
* feat(models): updated model configs, updated anthropic provider to propagate errors back to user if any * moved max tokens to advanced * updated model configs and testesd * removed default in max config for output tokens * moved more stuff to advanced mode in the agent block * stronger typing * move api key under model, update mistral and groq * update openrouter, fixed serializer to allow ollama/vllm models without api key * removed ollama handling
This commit is contained in:
@@ -915,24 +915,17 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// Find first system message
|
||||
const firstSystemIndex = messages.findIndex((msg) => msg.role === 'system')
|
||||
|
||||
if (firstSystemIndex === -1) {
|
||||
// No system message exists - add at position 0
|
||||
messages.unshift({ role: 'system', content })
|
||||
} else if (firstSystemIndex === 0) {
|
||||
// System message already at position 0 - replace it
|
||||
// Explicit systemPrompt parameter takes precedence over memory/messages
|
||||
messages[0] = { role: 'system', content }
|
||||
} else {
|
||||
// System message exists but not at position 0 - move it to position 0
|
||||
// and update with new content
|
||||
messages.splice(firstSystemIndex, 1)
|
||||
messages.unshift({ role: 'system', content })
|
||||
}
|
||||
|
||||
// Remove any additional system messages (keep only the first one)
|
||||
for (let i = messages.length - 1; i >= 1; i--) {
|
||||
if (messages[i].role === 'system') {
|
||||
messages.splice(i, 1)
|
||||
@@ -998,13 +991,14 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
workflowId: ctx.workflowId,
|
||||
workspaceId: ctx.workspaceId,
|
||||
stream: streaming,
|
||||
messages,
|
||||
messages: messages?.map(({ executionId, ...msg }) => msg),
|
||||
environmentVariables: ctx.environmentVariables || {},
|
||||
workflowVariables: ctx.workflowVariables || {},
|
||||
blockData,
|
||||
blockNameMapping,
|
||||
reasoningEffort: inputs.reasoningEffort,
|
||||
verbosity: inputs.verbosity,
|
||||
thinkingLevel: inputs.thinkingLevel,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1074,6 +1068,7 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
isDeployedContext: ctx.isDeployedContext,
|
||||
reasoningEffort: providerRequest.reasoningEffort,
|
||||
verbosity: providerRequest.verbosity,
|
||||
thinkingLevel: providerRequest.thinkingLevel,
|
||||
})
|
||||
|
||||
return this.processProviderResponse(response, block, responseFormat)
|
||||
@@ -1091,8 +1086,6 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
|
||||
logger.info(`[${requestId}] Resolving Vertex AI credential: ${credentialId}`)
|
||||
|
||||
// Get the credential - we need to find the owner
|
||||
// Since we're in a workflow context, we can query the credential directly
|
||||
const credential = await db.query.account.findFirst({
|
||||
where: eq(account.id, credentialId),
|
||||
})
|
||||
@@ -1101,7 +1094,6 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
throw new Error(`Vertex AI credential not found: ${credentialId}`)
|
||||
}
|
||||
|
||||
// Refresh the token if needed
|
||||
const { accessToken } = await refreshTokenIfNeeded(requestId, credential, credentialId)
|
||||
|
||||
if (!accessToken) {
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface AgentInputs {
|
||||
bedrockRegion?: string
|
||||
reasoningEffort?: string
|
||||
verbosity?: string
|
||||
thinkingLevel?: string
|
||||
}
|
||||
|
||||
export interface ToolInput {
|
||||
|
||||
Reference in New Issue
Block a user