-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add model_copy to make ollama chat deep copy work with a set client (#…
…1603) ## Description If you set the client manually for Ollama, then there is an issue when the agent model is copied where certain properties can't be pickled. This resolves it.
- Loading branch information
Showing
3 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Run `pip install yfinance` to install dependencies.""" | ||
|
||
from ollama import Client as OllamaClient | ||
from phi.agent import Agent, RunResponse # noqa | ||
from phi.model.ollama import Ollama | ||
from phi.playground import Playground, serve_playground_app | ||
from phi.tools.yfinance import YFinanceTools | ||
|
||
agent = Agent( | ||
model=Ollama(id="llama3.1:8b", client=OllamaClient()), | ||
tools=[YFinanceTools(stock_price=True)], | ||
markdown=True, | ||
) | ||
|
||
app = Playground(agents=[agent]).get_app() | ||
|
||
if __name__ == "__main__": | ||
serve_playground_app("agent_set_client:app", reload=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters