Skip to content

Commit 6836719

Browse files
hwchase17ryaneggz
andauthored
ollama example (#27)
* FROM ryaneggz/13-use-custom-model-with-ollama TO hwchase17/deepagents@main (#24) Co-authored-by: Ryan Eggleston <[email protected]>
1 parent 10aa899 commit 6836719

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,29 @@ agent = create_deep_agent(
126126

127127
### `model` (Optional)
128128

129-
By default, `deepagents` will use `"claude-sonnet-4-20250514"`. If you want to use a different model,
130-
you can pass a [LangChain model object](https://python.langchain.com/docs/integrations/chat/).
129+
By default, `deepagents` uses `"claude-sonnet-4-20250514"`. You can customize this by passing any [LangChain model object](https://python.langchain.com/docs/integrations/chat/).
130+
131+
#### Example: Using a Custom Model
132+
133+
Here's how to use a custom model (like OpenAI's `gpt-oss` model via Ollama):
134+
135+
(Requires `pip install langchain` and then `pip install langchain-ollama` for Ollama models)
136+
137+
```python
138+
from deepagents import create_deep_agent
139+
140+
# ... existing agent definitions ...
141+
142+
model = init_chat_model(
143+
model="ollama:gpt-oss:20b",
144+
)
145+
agent = create_deep_agent(
146+
tools=tools,
147+
instructions=instructions,
148+
model=model,
149+
...
150+
)
151+
```
131152

132153
## Deep Agent Details
133154

0 commit comments

Comments
 (0)