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
Copy file name to clipboardExpand all lines: website/docs/agents/providers.md
+87Lines changed: 87 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,3 +57,90 @@ Always refer to the documentation for the specific provider you are using to kno
57
57
VoltAgent offers built-in providers for various popular services and SDKs, including Vercel AI, Google AI (Gemini/Vertex), Groq, and any OpenAI-compatible API endpoint (via xsAI).
58
58
59
59
**For detailed information on each available provider, including specific installation, configuration, and usage instructions, please see the [Providers Overview](../providers/overview.md).**
60
+
61
+
### `@voltagent/ollama` (Ollama AI Provider)
62
+
63
+
Connects to Ollama and allowing you to use your locally hosted Ollama models with Voltagent.
64
+
65
+
## Prerequisites
66
+
67
+
1.[Install Ollama](https://ollama.ai/download) on your machine
// Optional: provide a custom URL if Ollama is not running on the default localhost:11434
87
+
baseUrl: "http://localhost:11434",
88
+
});
89
+
90
+
// Create an agent using the Ollama provider
91
+
const agent =newAgent({
92
+
name: "LocalLLMAgent",
93
+
description: "An agent that uses a local Ollama model",
94
+
llm: ollama,
95
+
// Specify the model name - this should match a model you've pulled in Ollama
96
+
model: "llama3",
97
+
});
98
+
99
+
// Use the agent
100
+
const response =awaitagent.generateText("Hello, what can you do for me?");
101
+
console.log(response.text);
102
+
```
103
+
104
+
## Provider-Specific Options
105
+
106
+
When calling agent methods, you can pass provider-specific options:
107
+
108
+
```typescript
109
+
const response =awaitagent.generateText("What is the capital of France?", {
110
+
provider: {
111
+
temperature: 0.7,
112
+
maxTokens: 500,
113
+
topP: 0.9,
114
+
seed: 123,
115
+
},
116
+
});
117
+
```
118
+
119
+
## Available Models
120
+
121
+
The available models depend on what you've pulled to your Ollama instance. Common models include:
122
+
123
+
-`llama3`
124
+
-`mistral`
125
+
-`gemma`
126
+
-`phi`
127
+
-`llama2`
128
+
-`llama2-uncensored`
129
+
-`orca-mini`
130
+
-`codellama`
131
+
-`stable-code`
132
+
133
+
Check the [Ollama model library](https://ollama.ai/library) for the full list of available models.
134
+
135
+
## Example with Streaming
136
+
137
+
```typescript
138
+
const stream =awaitagent.streamText("Tell me a story about a robot");
139
+
140
+
// Process the stream
141
+
forawait (const chunk ofstream.textStream) {
142
+
process.stdout.write(chunk);
143
+
}
144
+
```
145
+
146
+
**Choose @voltagent/ollama when:** You want to use models available through Ollama, which provides a convenient local-first framework for running open-source language models. Ollama is well-suited for tasks that benefit from customizable, offline-friendly models, including text generation, lightweight coding tasks, and privacy-sensitive applications.
0 commit comments