44 lines
757 B
Markdown
44 lines
757 B
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
# systemPrompt: Configurando el Comportamiento
|
|
|
|
<div class="mt-4 text-xs">
|
|
|
|
<v-click>
|
|
|
|
**String simple:**
|
|
|
|
```typescript
|
|
const agent = createAgent({
|
|
model: "mistral:mistral-large-latest",
|
|
tools: [weatherTool],
|
|
systemPrompt: "Eres un asistente meteorológico. Sé conciso y preciso.",
|
|
});
|
|
```
|
|
|
|
</v-click>
|
|
|
|
<v-click>
|
|
|
|
**SystemMessage (para features avanzados como cache de Anthropic):**
|
|
|
|
```typescript
|
|
import { SystemMessage } from "langchain";
|
|
|
|
const agent = createAgent({
|
|
model: "anthropic:claude-sonnet-4-6",
|
|
tools: [weatherTool],
|
|
systemPrompt: new SystemMessage({
|
|
content: [
|
|
{ type: "text", text: "Eres un experto en clima...", cache_control: { type: "ephemeral" } }
|
|
],
|
|
}),
|
|
});
|
|
```
|
|
|
|
</v-click>
|
|
|
|
</div>
|