-
Notifications
You must be signed in to change notification settings - Fork 18
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
Improve performance and precision on movies AI #177
Conversation
@@ -180,6 +180,7 @@ | |||
# Example specific settings: | |||
|
|||
WEATHER_API_KEY = os.getenv("WEATHER_API_KEY") # get for free at https://www.weatherapi.com/ | |||
JINA_API_KEY = os.getenv("JINA_API_KEY") # get for free at https://jina.ai/ |
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.
With API key we get larger limits. It's free.
) | ||
name = "IMDb Scraper" | ||
model = "gpt-4o-mini" | ||
structured_output = IMDbMovie |
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.
structured_output is slower, and not necessary here.
) | ||
name = "IMDb Scraper" | ||
model = "gpt-4o-mini" | ||
structured_output = IMDbMovie | ||
tool_max_concurrency = 4 |
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.
With RateLimitedBraveSearch, we can run tools concurrently and get faster responses. Thanks to this, we can have responses overall from 5 to 30 seconds.
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.
Nice!
"Authorization": "Bearer " + settings.JINA_API_KEY, | ||
}, | ||
timeout=20, | ||
).text[:30000] |
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.
A bit more text doesn't affect performance.
"Help the user find movies to watch and manage their movie backlogs. " | ||
"Use the provided functions to answer questions and run operations.\n" | ||
"Use the provided functions to answer queries and run operations.\n" | ||
"Use the search function to find movie recommendations based on user's query.\n" |
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.
Had to add this line to force search. In some cases it was hallucinating URLs. For more popular movies, it gets them right, though.
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.
it was hallucinating URLs.
I noticed that too when I asked a similar thing for the tour guide example.
IMDbScraper().as_tool( | ||
description="IMDb Scraper to get the IMDb data a given movie. " | ||
"Given a movie name (in English), " | ||
"finds the movie URL, rating, and scrapes the IMDb page (as Markdown)." |
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.
A better description to the IMDbScraper tool helps the AI to call it more.
"""Add a movie to user's backlog. Must pass the movie_name, imdb_url, and imdb_rating.""" | ||
""" | ||
Add a movie to user's backlog. Must pass the movie_name, imdb_url, and imdb_rating. | ||
Set imdb_rating to 0.0 if not available. |
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.
Facilitates adding not launched movies.
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.
🚀
https://youtu.be/HSA0eleAlbA