-
-
Notifications
You must be signed in to change notification settings - Fork 772
Expand file tree
/
Copy pathlangchain_example.py
More file actions
29 lines (25 loc) · 888 Bytes
/
langchain_example.py
File metadata and controls
29 lines (25 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from praisonaiagents import Agent, Task, AgentTeam
from langchain_community.tools import YouTubeSearchTool
from langchain_community.utilities import WikipediaAPIWrapper
# Create an agent with both tools
agent = Agent(
name="SearchAgent",
role="Research Assistant",
goal="Search for information from multiple sources",
backstory="I am an AI assistant that can search YouTube and Wikipedia.",
tools=[YouTubeSearchTool, WikipediaAPIWrapper],
reflection=False
)
# Create tasks to demonstrate both tools
task = Task(
name="search_task",
description="Search for information about 'AI advancements' on both YouTube and Wikipedia",
expected_output="Combined information from YouTube videos and Wikipedia articles",
agent=agent
)
# Create and start the workflow
agents = AgentTeam(
agents=[agent],
tasks=[task], output="verbose"
)
agents.start()