-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 2.7.0 #1540
Merged
Merged
Release 2.7.0 #1540
Changes from 62 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
987f285
feat: hunyuan_video
anuragts 9092897
fix: lint
anuragts d9951ab
fix: create a fal tool
anuragts 37b577e
fix: remove print
anuragts c9895bb
Update cookbook/agents/42_generate_fal_video.py
anuragts 87c1afb
Update cookbook/agents/42_generate_fal_video.py
anuragts 3243c5b
fix: move to fal tools
anuragts a59d392
fix: enum type
anuragts 31f86fc
fix: name
anuragts 7cf736d
fix: improve instructions
anuragts d04acf6
fix: return video/image url to agent
anuragts 1b9513c
fix: add fal video agent to playground
anuragts a50da31
fix: send as schema
anuragts cf895cc
fix: return as mp4
anuragts c939f7e
fix: add enum
anuragts d0cb754
fix: data
anuragts 45e9e86
fix: instruction for video model
anuragts dd75ea2
fix: more instruction
anuragts 710aa30
Add replicate toolkit
dirkvolter 22a07bb
Add replicate toolkit
dirkvolter b3bf340
Ignore missing imports
dirkvolter 0a739bc
luma lab video generation
Ayush0054 11adf3e
Fix cookbook for replicate
dirkvolter 2522dd7
Update image/video serialization
dirkvolter d438e3a
added image to video funcationality ,fixed formatting and mypy errors
Ayush0054 74bde7f
Fix style
dirkvolter 9a10b50
Merge branch 'feature/replicate-toolkit' of github.com:phidatahq/phi…
Ayush0054 d3a5543
Merge remote-tracking branch 'origin/feature/replicate-toolkit' into …
anuragts 4f16362
fix: improvements
anuragts a8b3c61
fix: rename file
anuragts 935b680
fix: instruction update
anuragts e85e388
updated according to comments/review
Ayush0054 47f59f1
formatting
Ayush0054 c0b018c
Fix typo
dirkvolter 5740cf8
fix: modal labs type mismatch
anuragts dff1e02
Bump version
dirkvolter d03c89f
Merge branch 'release/2.7.0' of https://github.com/phidatahq/phidata …
dirkvolter eccea9a
Add image cookbook
dirkvolter 2443c27
fix: send gif in image
anuragts a643f21
Update
dirkvolter 72605b4
Merge branch 'release/2.7.0' of https://github.com/phidatahq/phidata …
dirkvolter 499693e
Merge branch 'feature/replicate-toolkit' of https://github.com/phidat…
dirkvolter 312895b
Fix FAL interface
dirkvolter 7b1f696
Merge
dirkvolter 398e227
Fix FAL_KEY
dirkvolter 5e3d3e2
Add modellabs gif to playground app
dirkvolter 7ddc56c
Update name of replicate tools
dirkvolter a5c4681
Fix style
dirkvolter 0d8c2b4
fix: remove duplicate
anuragts 0e98701
Fix gemini reference
dirkvolter ad2023b
Merge branch 'hunyuan_video' of https://github.com/phidatahq/phidata …
dirkvolter 8620e57
fix: remove correct
anuragts 2ce1fe6
Fix mypy
dirkvolter b608861
Merge branch 'hunyuan_video' of https://github.com/phidatahq/phidata …
dirkvolter 6ca39dd
Merge branch 'feature/replicate-toolkit' of https://github.com/phidat…
dirkvolter 795ee52
Update lumalabs to work with new interface
dirkvolter d280dfa
Improve instructions
dirkvolter 9cefcb7
Merge pull request #1526 from phidatahq/hunyuan_video
dirkbrnd 6a60da1
Fix typo
dirkvolter 2fd27e1
Merge branch 'release/2.7.0' of https://github.com/phidatahq/phidata …
dirkvolter d10bc9c
Fix style
dirkvolter 51e8ac0
Merge pull request #1532 from phidatahq/lumalabs-video-generation
dirkbrnd 1c3d341
Merge branch 'main' into release/2.7.0
anuragts 09dd849
Update
dirkvolter 629b5de
Merge branch 'release/2.7.0' of https://github.com/phidatahq/phidata …
dirkvolter 2ef0ab5
Merge branch 'main' into release/2.7.0
anuragts f2d0d71
use-case-example-recipe-creator (#1511)
unnati914 6d72f5e
Update PR template (#1538)
saajann 5980aee
Merge branch 'main' of https://github.com/phidatahq/phidata into rele…
dirkvolter 08fc407
Pull in main
dirkvolter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,24 @@ | ||
from phi.agent import Agent | ||
from phi.model.openai import OpenAIChat | ||
from phi.tools.replicate import ReplicateTools | ||
|
||
"""Create an agent specialized for Replicate AI content generation""" | ||
|
||
video_agent = Agent( | ||
name="Video Generator Agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[ | ||
ReplicateTools(model="tencent/hunyuan-video:847dfa8b01e739637fc76f480ede0c1d76408e1d694b830b5dfb8e547bf98405") | ||
], | ||
description="You are an AI agent that can generate videos using the Replicate API.", | ||
instructions=[ | ||
"When the user asks you to create a video, use the `generate_media` tool to create the video.", | ||
"Return the URL as raw to the user.", | ||
"Don't convert video URL to markdown or anything else.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
show_tool_calls=True, | ||
) | ||
|
||
video_agent.print_response("Generate a video of a horse in the dessert.") |
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,22 @@ | ||
from phi.agent import Agent | ||
from phi.model.openai import OpenAIChat | ||
from phi.tools.replicate import ReplicateTools | ||
|
||
"""Create an agent specialized for Replicate AI content generation""" | ||
|
||
image_agent = Agent( | ||
name="Image Generator Agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[ReplicateTools(model="luma/photon-flash")], | ||
description="You are an AI agent that can generate images using the Replicate API.", | ||
instructions=[ | ||
"When the user asks you to create an image, use the `generate_media` tool to create the image.", | ||
"Return the URL as raw to the user.", | ||
"Don't convert image URL to markdown or anything else.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
show_tool_calls=True, | ||
) | ||
|
||
image_agent.print_response("Generate an image of a horse in the dessert.") |
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,20 @@ | ||
from phi.agent import Agent | ||
from phi.model.openai import OpenAIChat | ||
from phi.tools.fal_tools import FalTools | ||
|
||
fal_agent = Agent( | ||
name="Fal Video Generator Agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[FalTools("fal-ai/hunyuan-video")], | ||
description="You are an AI agent that can generate videos using the Fal API.", | ||
instructions=[ | ||
"When the user asks you to create a video, use the `generate_media` tool to create the video.", | ||
"Return the URL as raw to the user.", | ||
"Don't convert video URL to markdown or anything else.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
show_tool_calls=True, | ||
) | ||
|
||
fal_agent.print_response("Generate video of balloon in the ocean") |
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
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 |
---|---|---|
|
@@ -10,48 +10,83 @@ | |
from phi.model.openai import OpenAIChat | ||
from phi.tools.dalle import Dalle | ||
from phi.tools.models_labs import ModelsLabs | ||
from phi.model.response import FileType | ||
from phi.playground import Playground, serve_playground_app | ||
from phi.storage.agent.sqlite import SqlAgentStorage | ||
from phi.tools.fal_tools import FalTools | ||
|
||
image_agent_storage_file: str = "tmp/image_agent.db" | ||
|
||
image_agent = Agent( | ||
name="Image Agent", | ||
name="DALL-E Image Agent", | ||
agent_id="image_agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[Dalle()], | ||
description="You are an AI agent that can generate images using DALL-E.", | ||
instructions=[ | ||
"When the user asks you to create an image, use the `create_image` tool to create the image.", | ||
"The image will be displayed in the UI automatically below your response, so you don't need to show the image URL in your response.", | ||
"Politely and courteously let the user know that the image has been generated and will be displayed below as soon as its ready.", | ||
"Don't provide the URL of the image in the response. Only describe what image was generated.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
add_history_to_messages=True, | ||
add_datetime_to_instructions=True, | ||
storage=SqlAgentStorage(table_name="image_agent", db_file="tmp/image_agent.db"), | ||
storage=SqlAgentStorage(table_name="image_agent", db_file=image_agent_storage_file), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep it in |
||
) | ||
|
||
video_agent = Agent( | ||
name="Video Agent", | ||
agent_id="video_agent", | ||
ml_gif_agent = Agent( | ||
name="ModelsLab GIF Agent", | ||
agent_id="ml_gif_agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[ModelsLabs(wait_for_completion=True)], | ||
tools=[ModelsLabs(wait_for_completion=True, file_type=FileType.GIF)], | ||
description="You are an AI agent that can generate gifs using the ModelsLabs API.", | ||
instructions=[ | ||
"When the user asks you to create an image, use the `generate_media` tool to create the image.", | ||
"Don't provide the URL of the image in the response. Only describe what image was generated.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
add_history_to_messages=True, | ||
add_datetime_to_instructions=True, | ||
storage=SqlAgentStorage(table_name="ml_gif_agent", db_file=image_agent_storage_file), | ||
) | ||
|
||
ml_video_agent = Agent( | ||
name="ModelsLab Video Agent", | ||
agent_id="ml_video_agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[ModelsLabs(wait_for_completion=True, file_type=FileType.MP4)], | ||
description="You are an AI agent that can generate videos using the ModelsLabs API.", | ||
instructions=[ | ||
"When the user asks you to create a video, use the `create_video` tool to create the video.", | ||
"The video will be displayed in the UI automatically below your response, so you don't need to show the video URL in your response.", | ||
"Politely and courteously let the user know that the video has been generated and will be displayed below as soon as its ready.", | ||
"When the user asks you to create a video, use the `generate_media` tool to create the video.", | ||
"Don't provide the URL of the video in the response. Only describe what video was generated.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
add_history_to_messages=True, | ||
add_datetime_to_instructions=True, | ||
storage=SqlAgentStorage(table_name="video_agent", db_file="tmp/video_agent.db"), | ||
storage=SqlAgentStorage(table_name="ml_video_agent", db_file=image_agent_storage_file), | ||
) | ||
|
||
app = Playground(agents=[image_agent, video_agent]).get_app() | ||
fal_agent = Agent( | ||
name="Fal Video Agent", | ||
agent_id="fal_agent", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[FalTools("fal-ai/hunyuan-video")], | ||
description="You are an AI agent that can generate videos using the Fal API.", | ||
instructions=[ | ||
"When the user asks you to create a video, use the `generate_media` tool to create the video.", | ||
"Don't provide the URL of the video in the response. Only describe what video was generated.", | ||
], | ||
markdown=True, | ||
debug_mode=True, | ||
add_history_to_messages=True, | ||
add_datetime_to_instructions=True, | ||
storage=SqlAgentStorage(table_name="fal_agent", db_file=image_agent_storage_file), | ||
) | ||
|
||
|
||
app = Playground(agents=[image_agent, ml_gif_agent, ml_video_agent, fal_agent]).get_app(use_async=False) | ||
|
||
if __name__ == "__main__": | ||
serve_playground_app("multimodal_agent: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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from phi.agent import Agent | ||
from phi.llm.openai import OpenAIChat | ||
from phi.tools.lumalab import LumaLabTools | ||
|
||
"""Create an agent specialized for Luma AI video generation""" | ||
|
||
luma_agent = Agent( | ||
name="Luma Video Agent", | ||
agent_id="luma-video-agent", | ||
llm=OpenAIChat(model="gpt-4o"), | ||
tools=[LumaLabTools()], # Using the LumaLab tool we created | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary comment here |
||
markdown=True, | ||
debug_mode=True, | ||
show_tool_calls=True, | ||
instructions=[ | ||
"You are an agent designed to generate videos using the Luma AI API.", | ||
"You can generate videos in two ways:", | ||
"1. Text-to-Video Generation:", | ||
" - Use the generate_video function for creating videos from text prompts", | ||
" - Default parameters: loop=False, aspect_ratio='16:9', keyframes=None", | ||
"2. Image-to-Video Generation:", | ||
" - Use the image_to_video function when starting from one or two images", | ||
" - Required parameters: prompt, start_image_url", | ||
" - Optional parameters: end_image_url, loop=False, aspect_ratio='16:9'", | ||
" - The image URLs must be publicly accessible", | ||
"Choose the appropriate function based on whether the user provides image URLs or just a text prompt.", | ||
"The video will be displayed in the UI automatically below your response, so you don't need to show the video URL in your response.", | ||
"Politely and courteously let the user know that the video has been generated and will be displayed below as soon as its ready.", | ||
"After generating any video, if generation is async (wait_for_completion=False), inform about the generation ID", | ||
], | ||
system_message=( | ||
"Use generate_video for text-to-video requests and image_to_video for image-based " | ||
"generation. Don't modify default parameters unless specifically requested. " | ||
"Always provide clear feedback about the video generation status." | ||
), | ||
) | ||
|
||
luma_agent.run("Generate a video of a car in a sky") | ||
# luma_agent.run("Transform this image into a video of a tiger walking: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Walking_tiger_female.jpg/1920px-Walking_tiger_female.jpg") | ||
# luma_agent.run(""" | ||
# Create a transition video between these two images: | ||
# Start: https://img.freepik.com/premium-photo/car-driving-dark-forest-generative-ai_634053-6661.jpg?w=1380 | ||
# End: https://img.freepik.com/free-photo/front-view-black-luxury-sedan-road_114579-5030.jpg?t=st=1733821884~exp=1733825484~hmac=735ca584a9b985c53875fc1ad343c3fd394e1de4db49e5ab1a9ab37ac5f91a36&w=1380 | ||
# Make it a smooth, natural movement | ||
# """) |
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
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 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class Video(BaseModel): | ||
id: str | ||
url: str | ||
original_prompt: Optional[str] = None | ||
revised_prompt: Optional[str] = None | ||
eta: Optional[str] = None | ||
|
||
|
||
class Image(BaseModel): | ||
id: str | ||
url: str | ||
original_prompt: Optional[str] = None | ||
revised_prompt: Optional[str] = None |
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about making changes to assistants folder as we are trying to phase it out