mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
Updated the main example in README.md (#61)
Update Example to mention local LLMs
This commit is contained in:
12
README.md
12
README.md
@@ -44,12 +44,20 @@ pip install duckduckgo-search
|
|||||||
import os
|
import os
|
||||||
from crewai import Agent, Task, Crew, Process
|
from crewai import Agent, Task, Crew, Process
|
||||||
|
|
||||||
|
# You can choose to use a local model through Ollama for example.
|
||||||
|
# In this case we will use OpenHermes 2.5 as an example.
|
||||||
|
#
|
||||||
|
# from langchain.llms import Ollama
|
||||||
|
# ollama_llm = Ollama(model="openhermes")
|
||||||
|
|
||||||
|
# If you are using an ollama like above you don't need to set OPENAI_API_KEY.
|
||||||
os.environ["OPENAI_API_KEY"] = "Your Key"
|
os.environ["OPENAI_API_KEY"] = "Your Key"
|
||||||
|
|
||||||
# Define your tools, custom or not.
|
# Define your tools, custom or not.
|
||||||
# Install duckduckgo-search for this example:
|
# Install duckduckgo-search for this example:
|
||||||
#
|
#
|
||||||
# !pip install -U duckduckgo-search
|
# !pip install -U duckduckgo-search
|
||||||
|
|
||||||
from langchain.tools import DuckDuckGoSearchRun
|
from langchain.tools import DuckDuckGoSearchRun
|
||||||
search_tool = DuckDuckGoSearchRun()
|
search_tool = DuckDuckGoSearchRun()
|
||||||
|
|
||||||
@@ -64,7 +72,8 @@ researcher = Agent(
|
|||||||
verbose=True,
|
verbose=True,
|
||||||
allow_delegation=False,
|
allow_delegation=False,
|
||||||
tools=[search_tool]
|
tools=[search_tool]
|
||||||
# llm=OpenAI(temperature=0.7, model_name="gpt-4"). It uses langchain.chat_models, default is GPT4
|
# (optional) llm=ollama_llm, If you wanna use a local modal through Ollama, default is GPT4 with temperature=0.7
|
||||||
|
|
||||||
)
|
)
|
||||||
writer = Agent(
|
writer = Agent(
|
||||||
role='Tech Content Strategist',
|
role='Tech Content Strategist',
|
||||||
@@ -73,6 +82,7 @@ writer = Agent(
|
|||||||
and engaging articles on technology and innovation. With a deep understanding of
|
and engaging articles on technology and innovation. With a deep understanding of
|
||||||
the tech industry, you transform complex concepts into compelling narratives.""",
|
the tech industry, you transform complex concepts into compelling narratives.""",
|
||||||
verbose=True,
|
verbose=True,
|
||||||
|
# (optional) llm=ollama_llm, If you wanna use a local modal through Ollama, default is GPT4 with temperature=0.7
|
||||||
allow_delegation=True
|
allow_delegation=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user