You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Designate different LLMs for different responsibilities"
4
+
icon: venetian-mask
5
+
---
6
+
7
+
You can customize the Magnitude agent to use different LLMs for each of the three primary operations: `act`, `extract`, `query`.
8
+
9
+
By default when a single LLM is provided, all responsibilites will be handled by that LLM. However, by specifying different LLMs for certain roles you may be able to save on cost and speed.
); // ^ this will use gemini-2.5-flash-lite-preview-06-17
49
+
50
+
awaitagent.act('Move each to in progress', { data: tasks });
51
+
// ^ this will use Claude
52
+
53
+
const numTodosMoved =awaitagent.query(
54
+
'How many todos were moved?',
55
+
z.number()
56
+
); // ^ this will use gemini-2.5-flash
57
+
58
+
console.log(numTodosMoved);
59
+
60
+
awaitagent.stop();
61
+
}
62
+
63
+
main();
64
+
```
65
+
66
+
One great use case for this is to reduce the cost of extracting data. While `act` requires an intelligent and [visually grounded model](/core-concepts/compatible-llms), `extract` and `query` do not require grounded models, and can often work fine with less intelligent models.
67
+
68
+
General recommendations:
69
+
-`act`: MUST use an [intelligent, visually grounded model](/core-concepts/compatible-llms)
70
+
-`extract`: Can use a fast and cheap model, like `gemini-2.5-flash` or even `gemini-2.5-flash-lite`
71
+
-`query`: Can use any model that's reasonably intelligent but fast, depending on the complexity of the queries you plan to ask. `gemini-2.5-flash` might be a good option.
thrownewError("No LLM configured or available from environment. Set environment variable ANTHROPIC_API_KEY and try again. See https://docs.magnitude.run/customizing/llm-configuration for details");
246
247
}
247
248
// else if (!isGroundedLlm(llm) && !grounding) {
248
249
// throw new Error("Ungrounded LLM is configured without Moondream. Either use Anthropic (set ANTHROPIC_API_KEY) or provide a MOONDREAM_API_KEY");
0 commit comments