先决条件
以下示例需要fal_client 库和一个 API 密钥,您可从 Fal 获取。
示例
以下 agent 将使用 FAL 生成用户请求的任何视频。cookbook/tools/fal_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
fal_client 库和一个 API 密钥,您可从 Fal 获取。
pip install -U fal_client
export FAL_KEY=***
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 | 根据文本提示转换输入图像。 |