praisonaiagents[llm] includes all Google Gemini dependencies.
For No-Code implementation, also install: pip install langchain-google-genai
2
Set API Key
Set your Gemini API key:
Copy
export GEMINI_API_KEY=xxxxxxxxxxx
3
Code
Copy
from praisonaiagents import Agentagent = Agent( instructions="You are a helpful assistant", llm="gemini/gemini-1.5-flash-8b", self_reflect=True, verbose=True)agent.start("Why sky is Blue?")
The simplest way to use Gemini with PraisonAI Agents:
Copy
from praisonaiagents import Agentagent = Agent( instructions="You are a helpful assistant", llm="gemini/gemini-1.5-flash-8b", self_reflect=True, verbose=True)agent.start("Why sky is Blue?")
llm_config = { "model": "gemini/gemini-2.0-flash-thinking-exp-01-21", "response_format": {"type": "text"} # type is text, because json_object is not supported}
1
Install Package
Install required packages:
Copy
pip install "praisonaiagents[llm]"
2
Set API Key
Set your Gemini API key:
Copy
export GEMINI_API_KEY=xxxxxxxxxxx
3
Code
Copy
from praisonaiagents import Agentllm_config = {"model": "gemini/gemini-2.0-flash-thinking-exp-01-21","response_format": {"type": "text"}}agent = Agent( instructions="You are a helpful assistant", llm=llm_config)result = agent.start("Why sky is Blue?")print(result)
framework: crewaitopic: create movie script about cat in marsroles: researcher: backstory: Skilled in finding and organizing information, with a focus on research efficiency. goal: Gather information about Mars and cats role: Researcher llm: model: "google/gemini-1.5-flash-001" tasks: gather_research: description: Research and gather information about Mars, its environment, and cats, including their behavior and characteristics. expected_output: Document with research findings, including interesting facts and information. tools: - ''