from crewai import Agent, LLM
from tools import yt_tool
import os
from dotenv import load_dotenv
load_dotenv()
os.environ["GROQ_API_KEY"] = os.environ.get("GROQ_API_KEY")
print(os.environ["GROQ_API_KEY"])
# Create a senior blog content researcher agent
# llm = LLM(model="ollama/llama3.2:latest", base_url="http://localhost:11434")
# llm = LLM(model="gemma2-9b-it")
model = "groq/gemma2-9b-it"
llm = LLM(model=model, api_key=os.environ["GROQ_API_KEY"])
blog_researcher = Agent(
role="Blog Researcher from youtube videos",
goal=" get the relevant video content for the topic {topic} from youtube channel",
verbose=True,
memory=True,
backstory="Expert in understand videos in AI Data Sciene and Machine Learning",
tools=[yt_tool],
allow_delegation=True,
# embedder={
# "provider": "huggingface",
# "config": {
# "model": 'sentence-transformers/all-MiniLM-L6-v2'
# }
# },
llm=llm,
)
# Create a senior blog writter agent with YT tool
blog_writer = Agent(
role="Blog Writer",
goal="Narrate compelling tech stories about the video {topic} from youtube channel",
verbose=True,
memory=True,
backstory="With a flair for simplifying complex topics, you crag engagin narractives that captivate and educate, bringing new discoverties to light in an accessible mananer.",
tools=[yt_tool],
allow_delegation=False,
# embedder={
# "provider": "huggingface",
# "config": {
# "model": 'sentence-transformers/all-MiniLM-L6-v2'
# }
# },
llm=llm,
)
I keep getting this issue
api_key = self.config.api_key or os.environ["OPENAI_API_KEY"]
~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "<frozen os>", line 714, in __getitem__
KeyError: 'OPENAI_API_KEY
By default CREWAI asks for OPEN_AI key. I want to use Ollama or chatgroq. I have tried both but it didnt work.Am I missing something here. I did exactly the same as mentioned in the documentation