-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/phidatahq/phidata into rele…
…ase/2.7.0
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 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,29 @@ | ||
from phi.agent import Agent | ||
from phi.model.openai import OpenAIChat | ||
from phi.tools.exa import ExaTools | ||
|
||
movie_recommendation_agent = Agent( | ||
name="PopcornPal", | ||
tools=[ | ||
ExaTools(), | ||
], | ||
model=OpenAIChat(id="gpt-4o"), | ||
description=( | ||
"You are PopcornPal, a movie recommendation agent that searches and scrapes movie websites to provide detailed recommendations, " | ||
"including ratings, genres, descriptions, trailers, and upcoming releases." | ||
), | ||
instructions=[ | ||
"Use Exa to search for the movies.", | ||
"Provide results with the following details: movie title, genre, movies with good ratings, description, recommended viewing age, primary language,runtime, imdb rating and release date.", | ||
"Include trailers for movies similar to the recommendations and upcoming movies of the same genre or from related directors/actors.", | ||
"Give atleast 5 movie recommendations for each query", | ||
"Present the output in a well-structured markdown table for readability.", | ||
"Ensure all movie data is correct, especially for recent or upcoming releases.", | ||
], | ||
markdown=True, | ||
) | ||
|
||
movie_recommendation_agent.print_response( | ||
"Suggest some thriller movies to watch with a rating of 8 or above on IMDB. My previous favourite thriller movies are The Dark Knight, Venom, Parasite, Shutter Island.", | ||
stream=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,24 @@ | ||
from phi.model.openai import OpenAIChat | ||
from phi.agent import Agent | ||
from phi.tools.exa import ExaTools | ||
|
||
itinerary_agent = Agent( | ||
name="GlobeHopper", | ||
model=OpenAIChat(id="gpt-4o"), | ||
tools=[ExaTools()], | ||
markdown=True, | ||
description="You are an expert itinerary planning agent. Your role is to assist users in creating detailed, customized travel plans tailored to their preferences and needs.", | ||
instructions=[ | ||
"Use Exa to search and extract relevant data from reputable travel platforms.", | ||
"Collect information on flights, accommodations, local attractions, and estimated costs from these sources.", | ||
"Ensure that the gathered data is accurate and tailored to the user's preferences, such as destination, group size, and budget constraints.", | ||
"Create a clear and concise itinerary that includes: detailed day-by-day travel plan, suggested transportation and accommodation options, activity recommendations (e.g., sightseeing, dining, events), an estimated cost breakdown (covering transportation, accommodation, food, and activities).", | ||
"If a particular website or travel option is unavailable, provide alternatives from other trusted sources.", | ||
"Do not include direct links to external websites or booking platforms in the response." | ||
], | ||
) | ||
|
||
itinerary_agent.print_response( | ||
"I want to plan an offsite for 14 people for 3 days (28th-30th March) in London within 10k dollars. Please suggest options for places to stay, activities, and co working spaces and a detailed itinerary for the 3 days with transportation and activities", | ||
stream=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,30 @@ | ||
# pip install qdrant-client | ||
from phi.vectordb.qdrant import Qdrant | ||
from phi.agent import Agent | ||
from phi.knowledge.pdf import PDFUrlKnowledgeBase | ||
|
||
# run qdrant client locally | ||
""" | ||
- Run the docker image: docker pull qdrant/qdrant | ||
- Then, run the service: | ||
docker run -p 6333:6333 -p 6334:6334 \ | ||
-v $(pwd)/qdrant_storage:/qdrant/storage:z \ | ||
qdrant/qdrant | ||
""" | ||
COLLECTION_NAME = "thai-recipes" | ||
|
||
vector_db = Qdrant( | ||
collection=COLLECTION_NAME, | ||
url="http://localhost:6333" | ||
) | ||
|
||
knowledge_base = PDFUrlKnowledgeBase( | ||
urls=["https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"], | ||
vector_db=vector_db, | ||
) | ||
|
||
knowledge_base.load(recreate=False) # Comment out after first run | ||
|
||
# Create and use the agent | ||
agent = Agent(knowledge_base=knowledge_base, use_tools=True, show_tool_calls=True) | ||
agent.print_response("List down the ingredients to make Massaman Gai", markdown=True) |