crewAI
crewAI copied to clipboard
Adding human input example to README and docs
One can easily use human input as tool by using the langchain tool but would be nice to add proper docs around it as it seem a usual use case
from langchain.agents import load_tool
tools = load_tools(["human"])
Hey, I am looking to solve this issue. Can you assign it to me. and also help me contribute to it.
Sure thing, just did! Maybe we start just adding a section on the readme with a small example and a link on top. Also something we could add to the wiki. @greysonlalonde is working on a new docs so he might be able to help as well :)
Hey quick question
from langchain.agents import load_tool
tools = load_tools(["human"])
after doing this we just have add this as tool in our agent right?
Example
```python
researcher = Agent(
role='Senior Research Analyst',
goal='Uncover cutting-edge developments in AI and data science in',
backstory="""You are a Senior Research Analyst at a leading tech think tank.
Your expertise lies in identifying emerging trends and technologies in AI and
data science. You have a knack for dissecting complex data and presenting
actionable insights.""",
verbose=True,
allow_delegation=False,
tools=tools,
llm=ChatOpenAI(temperature=0.7, model_name="gpt-4") #It uses langchain.chat_models, default is GPT4
)
Hi @siddartha-10 , tools are located in langchain.agents.load_tools in langchain v0.0.354:
from langchain.agents.load_tools import load_tools
As @joaomdmoura mentioned, happy to help with anything else!
Hey @greysonlalonde This an example of using human as an agent.
from langchain.agents import load_tools
from langchain_community.chat_models import ChatOpenAI
from langchain_community.llms import OpenAI
import os
from crewai import Agent, Task, Crew, Process
os.environ["OPENAI_API_KEY"] = ""
llm = ChatOpenAI(temperature=0.0,model="gpt-3.5-turbo")
tools = load_tools(
["human"]
)
agent = Agent(
role='Human',
goal='Provide context when the Agents need me',
backstory="I am a human, I am here to help the Agents",
tools=tools
)
task1 = Task(
description="""Give me a hook to write a story? and ask the human to give you a hook to write a story""",
agent=agent
)
task2 = Task(
description="""what is the name of the characters? you should ask the human to give you the name of the char""",
agent=agent
)
task3 = Task(
description="""Include the character names and involve them in your story.""",
agent=agent,
)
crew = Crew(
agents=[agent],
tasks=[task1,task2,task3],
verbose=3, # Crew verbose more will let you know what tasks are being worked on, you can set it to 1 or 2 to different logging levels
process=Process.sequential # Sequential process will have tasks executed one after the other and the outcome of the previous one is passed as extra content into this next.
)
print(crew.kickoff())
I have cloned the wiki pages locally and do you want me to add this to the document?
https://python.langchain.com/docs/integrations/tools/human_tools
and also add this link on top of the document
Added, thanks @siddartha-10 for prompting us to do it and coming up with an initial version!
Hey @joaomdmoura I am learning a lot these days and interested in using agents for different applications and use cases, I am a master's student, It would be great if you can mentor and help me be on the right path.