Created
May 7, 2024 01:00
-
-
Save dylanzuber-scale3/de459095db86ef55ef9ca19cd8462f41 to your computer and use it in GitHub Desktop.
CrewAI incorporating Langtrace SDK
This file contains hidden or 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
| from langtrace_python_sdk import langtrace | |
| langtrace.init(api_key = '') | |
| import os | |
| from crewai import Agent, Crew, Task | |
| from crewai_tools import SerperDevTool | |
| search_tool = SerperDevTool() | |
| restaurant_finder = Agent( | |
| role='Expert Restaurant Recommender', | |
| goal='Find the best restaurants in a city given your clients preferences', | |
| backstory='You work at the best restaurant recommendation service in the world. You have access to the best tools and data to find the best restaurants for your clients.', | |
| verbose=True, | |
| allow_delegation=False, | |
| tools=[search_tool] | |
| ) | |
| def find_restaurants_task(city, date, cuisines): | |
| return Task( | |
| description=f'Find the best restaurants in {city} on {date} that offer {cuisines} cuisine, based on your client’s preferences.', | |
| expected_output='A list of restaurant recommendations', | |
| agent=restaurant_finder | |
| ) | |
| def main(): | |
| city = 'tampa' | |
| date = '2024-05-10' | |
| cuisines = ['Italian', 'Japanese'] | |
| crew = Crew( | |
| agents=[restaurant_finder], | |
| tasks=[find_restaurants_task(city=city, date=date, cuisines=cuisines)], | |
| verbose=1 | |
| ) | |
| result = crew.kickoff() | |
| print("######################") | |
| print(result) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment