Skip to content
RasuriKEERTHANAPublic

About

Multi-tool conversational AI agent using Gemini function-calling and RAG

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

PolyAgent — Multi-Tool Conversational AI Agent

A conversational AI assistant built using Google's Gemini API with function-calling capabilities. Unlike a standard chatbot, PolyAgent autonomously decides which tool to use based on the user's question — performing calculations, fetching live weather, searching the web, converting currencies, and retrieving Wikipedia summaries — all through natural conversation.

Features

  • Autonomous Tool Selection: The AI model analyzes each user query and automatically determines which tool (if any) is needed to answer accurately, rather than relying on hardcoded logic.
  • Real-Time Data Tools:
    • Live weather lookup via OpenWeatherMap API
    • Web search via DuckDuckGo for current events and factual queries
    • Currency conversion using live exchange rates
    • Wikipedia summaries for quick factual lookups
    • Arithmetic calculations handled through a dedicated function
  • Robust Error Handling: Gracefully handles API rate limits, server unavailability, and configuration issues with user-friendly messages instead of crashes, including automatic retry logic for transient failures.
  • Conversational Memory: Maintains context across a full conversation session using Gemini's chat interface, allowing natural follow-up questions.
  • Secure Configuration: API keys managed through environment variables, never hardcoded.

Tech Stack

  • Language: Python
  • AI Model: Google Gemini (via google-genai SDK)
  • APIs: OpenWeatherMap, ExchangeRate-API, Wikipedia REST API, DuckDuckGo Search
  • Libraries: requests, python-dotenv, ddgs

How It Works

  1. The user sends a natural-language message.
  2. Gemini evaluates the message against the available tool descriptions.
  3. If a tool is needed, Gemini selects the appropriate function and generates the correct parameters.
  4. The Python backend executes the real function (API call or computation) and returns the result.
  5. Gemini synthesizes the tool's output into a clear, conversational response.

Setup

  1. Clone this repository
  2. Create a virtual environment: python -m venv venv
  3. Activate it: venv\Scripts\activate (Windows) or source venv/bin/activate (Mac/Linux)
  4. Install dependencies: pip install -r requirements.txt
  5. Create a .env file with your API keys:
  6. Run: python main.py

Example Interaction

You: What's the weather in Hyderabad? Assistant: It's currently 26°C with overcast clouds in Hyderabad.

You: Convert 100 dollars to rupees Assistant: 100 USD = 8,742.50 INR

You: What is 1234 plus 9876? Assistant: 1234 + 9876 = 11,110

Future Improvements

  • Persistent conversation memory across sessions (saved to a local database)
  • Web-based interface built with Streamlit
  • Additional tools (news headlines, translation)
  • Source-attribution labeling to distinguish AI-generated knowledge from live search resultsgit init

About

Multi-tool conversational AI agent using Gemini function-calling and RAG

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages