FalTools 使 Agent 能够执行媒体生成任务。
先决条件
以下示例需要 fal_client
库和一个 API 密钥,您可从 Fal 获取。
pip install -U fal_client
以下 agent 将使用 FAL 生成用户请求的任何视频。
cookbook/tools/fal_tools.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.fal 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")
参数 | 类型 | 默认值 | 描述 |
---|
api_key | str | None | 用于身份验证的 API 密钥。 |
model | str | None | 用于媒体生成的模型。 |
函数 | 描述 |
---|
generate_media | 根据用户提示生成图像或视频。 |
image_to_image | 根据文本提示转换输入图像。 |
开发者资源
Responses are generated using AI and may contain mistakes.