New project with gemini thinking
This commit is contained in:
parent
5d4bd68156
commit
64d4052e10
4 changed files with 42 additions and 0 deletions
0
ai_agent_tutorials/ai_gemini_thinking_agent/README.md
Normal file
0
ai_agent_tutorials/ai_gemini_thinking_agent/README.md
Normal file
20
ai_agent_tutorials/ai_gemini_thinking_agent/main.py
Normal file
20
ai_agent_tutorials/ai_gemini_thinking_agent/main.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from agno.agent import Agent
|
||||
from agno.models.openai import OpenAIChat
|
||||
from agno.models.google import Gemini
|
||||
from agno.tools.duckduckgo import DuckDuckGoTools
|
||||
from agno.tools.yfinance import YFinanceTools
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
thinking_agent = Agent(
|
||||
name="Thinking Agent",
|
||||
role="Think about the problem",
|
||||
model=Gemini(id="gemini-2.0-flash-thinking-exp-1219", api_key=os.getenv("GOOGLE_API_KEY")),
|
||||
instructions="Given the problem, think about it and provide a detailed explanation",
|
||||
show_tool_calls=True,
|
||||
markdown=True,
|
||||
)
|
||||
|
||||
|
||||
thinking_agent.print_response("Explain Deep Q Networks from first principles", stream=True)
|
||||
22
ai_agent_tutorials/ai_gemini_thinking_agent/test.py
Normal file
22
ai_agent_tutorials/ai_gemini_thinking_agent/test.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from google import genai
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
client = genai.Client(api_key=os.getenv("GOOGLE_API_KEY"), http_options={'api_version':'v1alpha'})
|
||||
|
||||
import asyncio
|
||||
|
||||
config = {'thinking_config': {'include_thoughts': True}}
|
||||
|
||||
async def main():
|
||||
chat = client.aio.chats.create(
|
||||
model='gemini-2.0-flash-thinking-exp',
|
||||
config=config
|
||||
)
|
||||
response = await chat.send_message('What is your name?')
|
||||
print(response.text)
|
||||
response = await chat.send_message('What did you just say before this?')
|
||||
print(response.text)
|
||||
|
||||
asyncio.run(main())
|
||||
Loading…
Reference in a new issue