crewai 入门
·
来自官方,使用自己的llm.
import os
from crewai import Agent, Task, Crew
import ChatGLM
from langchain.agents import Tool
from langchain_community.tools import DuckDuckGoSearchRun
llm = ChatGLM.ChatGLM_LLM()
research_agent = Agent(
llm =llm,
role='Researcher',
goal='Find and summarize the latest AI news',
backstory="""You're a researcher at a large company.
You're responsible for analyzing data and providing insights
to the business.""",
verbose=True
)
# Install duckduckgo-search for this example:
# !pip install -U duckduckgo-search
search_tool = DuckDuckGoSearchRun()
task = Task(
description='Find and summarize the latest AI news',
expected_output='A bullet list summary of the top 5 most important AI news',
agent=research_agent,
tools=[search_tool]
)
crew = Crew(
agents=[research_agent],
tasks=[task],
verbose=2
)
result = crew.kickoff()
print(result)
更多推荐



所有评论(0)