-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from phidatahq/youtube-agent-phi-1652
youtube-agent-phi-1652
- Loading branch information
Showing
4 changed files
with
51 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import Optional | ||
|
||
from phi.agent import Agent | ||
from phi.model.openai import OpenAIChat | ||
from phi.tools.youtube_tools import YouTubeTools | ||
|
||
from agents.settings import agent_settings | ||
from phi.storage.agent.postgres import PgAgentStorage | ||
|
||
from db.session import db_url | ||
|
||
youtube_agent_storage = PgAgentStorage(table_name="finance_agent", db_url=db_url) | ||
|
||
|
||
def get_youtube_agent( | ||
user_id: Optional[str] = None, | ||
session_id: Optional[str] = None, | ||
debug_mode: bool = False, | ||
) -> Agent: | ||
return Agent( | ||
name="YouTube Agent", | ||
agent_id="youtube-agent", | ||
session_id=session_id, | ||
user_id=user_id, | ||
model=OpenAIChat( | ||
model=agent_settings.gpt_4, | ||
max_tokens=agent_settings.default_max_completion_tokens, | ||
temperature=agent_settings.default_temperature, | ||
), | ||
tools=[YouTubeTools()], | ||
description="You are a YouTube agent. Obtain the captions of a YouTube video and answer questions.", | ||
markdown=True, | ||
add_history_to_messages=True, | ||
num_history_responses=5, | ||
show_tool_calls=True, | ||
add_datetime_to_instructions=True, | ||
storage=youtube_agent_storage, | ||
# Enable monitoring on phidata.app | ||
monitoring=True, | ||
debug_mode=debug_mode, | ||
) |
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