Skip to content

A Python-based agent showcasing the use of Google's Gemini 2.0 Flash Thinking Experimental model to reason by combining search results with user queries

License

Notifications You must be signed in to change notification settings

arham-kk/gemini-thinking-search-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Thinking Search Agent

License: MIT

Overview

This project implements an agent that uses the Gemini 2.0 Flash Thinking model to answer user requests. It first assesses if the request needs external context using a standard Gemini 2.0 Flash Experimental model. If needed, it then retrieves the relevant information using the Google Search tool. The gathered context is then combined with the user request and passed to the Thinking model, which uses the combined context to formulate its response. This approach shows how you can create an agent that enhances its reasoning and analysis based on real world information.

Key Features

  • Contextual Reasoning: The agent intelligently combines information pulled from search results with the original user request to generate insightful and accurate responses.
  • Thinking Model: Employs the Gemini 2.0 Flash Thinking Model to enhance reasoning and demonstrate the model's thought process.
  • Dynamic Search Integration: Uses Google Search as a tool to retrieve the most current and relevant information from the web.
  • Asynchronous Operations: Leverages asyncio for efficient and non-blocking API calls.
  • Clear Output: Displays the Thinking Model's thought process and its final response.

Getting Started

Prerequisites

  • Python 3.8 or higher
  • A Google AI Gemini API key (get one from Google AI Studio)

Installation

  1. Clone this repository:

    git clone https://github.com/arham-kk/gemini-thinking-search-agent.git
    cd gemini-thinking-search-agent
  2. Install the required Python packages:

    pip install -r requirements.txt
  3. Set up your API key:

    • Add your Gemini API key to the .env file in the following format:

      GEMINI_API_KEY=your_api_key_here
      

Running the Code

Execute the main Python file:

python agent.py

License

This project is licensed under the MIT License

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

About

A Python-based agent showcasing the use of Google's Gemini 2.0 Flash Thinking Experimental model to reason by combining search results with user queries

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages