Skip to content

Commit

Permalink
Merge branch 'release/2.7.5' into fix/composio-tools-not-working
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkbrnd authored Dec 20, 2024
2 parents 7d4240a + 30c962e commit 603083b
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 7 deletions.
8 changes: 2 additions & 6 deletions cookbook/agents/14_generate_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@
images = image_agent.get_images()
if images and isinstance(images, list):
for image_response in images:
image_data = image_response.get("data") # type: ignore
if image_data:
for image in image_data:
image_url = image.get("url") # type: ignore
if image_url:
print(image_url)
image_url = image_response.url
print(image_url)
Empty file added cookbook/chunking/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions cookbook/mysql-init/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Create 'users' table
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create 'products' table
CREATE TABLE IF NOT EXISTS products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
description TEXT,
price DECIMAL(10,2) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
18 changes: 18 additions & 0 deletions cookbook/providers/ollama/agent_set_client.py
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)
Empty file added cookbook/readers/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions cookbook/run_mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docker run -d \
-e MYSQL_ROOT_PASSWORD=phi \
-e MYSQL_DATABASE=phi \
-e MYSQL_USER=phi \
-e MYSQL_PASSWORD=phi \
-p 3306:3306 \
-v mysql_data:/var/lib/mysql \
-v $(pwd)/cookbook/mysql-init:/docker-entrypoint-initdb.d \
--name mysql \
mysql:8.0
4 changes: 4 additions & 0 deletions phi/model/ollama/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,7 @@ async def aresponse_stream(self, messages: List[Message]) -> Any:
async for post_tool_call_response in self.ahandle_post_tool_call_messages_stream(messages=messages):
yield post_tool_call_response
logger.debug("---------- Ollama Async Response End ----------")

def model_copy(self, *, update: Optional[dict[str, Any]] = None, deep: bool = False) -> "Ollama":
new_model = Ollama(**self.model_dump(exclude={"client"}), client=self.client)
return new_model
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "phidata"
version = "2.7.4"
version = "2.7.5"
description = "Build multi-modal Agents with memory, knowledge and tools."
requires-python = ">=3.7"
readme = "README.md"
Expand Down

0 comments on commit 603083b

Please sign in to comment.