Skip to content

Arif-Rachmat/Chatbot-Tool-Calling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Chatbot + Tool Calling Notebook

A universal chat client implemented as a Jupyter notebook, using the OpenAI SDK to work with any OpenAI-compatible API provider. Currently supports web search and web extraction tools, with a roadmap for expanded tool capabilities.

Features

Current Capabilities

  • Universal API Support — Works with any OpenAI-compatible API (OpenAI, NVIDIA, DeepSeek, etc.)
  • Web Search — Integrated DuckDuckGo search for real-time information retrieval
  • Web Extract — URL content extraction for reading and analyzing web pages
  • Time-Aware — Automatically aware of current date/time for contextual responses
  • Sliding Context — Manages conversation history without unbounded memory growth
  • Interactive Display — Rich Markdown output in Jupyter environment

Technical Stack

  • Language: Python 3.x
  • Environment: Jupyter Notebook
  • SDK: OpenAI Python Client
  • Search: DuckDuckGo (ddgs)
  • Configuration: python-dotenv for environment management

Installation

  1. Clone or download this repository

  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure environment:

    cp ".env example" .env
  4. Edit .env with your API credentials:

    # Choose your provider
    OPENAI_API_KEY=your-api-key-here
    # or
    NVIDIA_API_KEY=your-nvidia-api-key-here
    # or
    DEEPSEEK_API_KEY=your-deepseek-api-key-here
    
    # Set API base URL (uncomment your provider)
    API_BASE_URL=https://api.openai.com/v1
    # API_BASE_URL=https://integrate.api.nvidia.com/v1
    # API_BASE_URL=https://api.deepseek.com
    
    # Optional: Specify model
    MODEL=gpt-4o

Usage

  1. Open the notebook:

    jupyter notebook chatNotebook.ipynb
  2. Run all cells from top to bottom

  3. Start chatting using the interactive interface

  4. Tool usage is automatic—the model will invoke web search or extraction when needed

Configuration Options

Environment Variables

Variable Description Example
OPENAI_API_KEY Your API key sk-...
API_BASE_URL API endpoint URL https://api.openai.com/v1
MODEL Model identifier gpt-4o, google/diffusiongemma-26b-a4b-it
EXTRA_BODY Model-specific parameters {"chat_template_kwargs":{"thinking":true}}

Supported Providers

  • OpenAI — Full feature support
  • NVIDIA NIM — Optimized inference endpoints
  • DeepSeek — Cost-effective alternative
  • 🔄 Other OpenAI-compatible APIs — May require configuration

Roadmap & Future Tools

Short-term Goals (Next Release)

  • Advanced Web Extraction — Integration of tools like crawl4ai for deep web scraping, sitemap parsing, and structured data extraction
  • Code Execution Sandbox — Safe Python code execution environment
  • File Operations — Read/write files, parse CSVs, JSON, PDFs
  • Calculator Tool — Precise mathematical computations
  • Calendar Integration — Schedule management and reminders
  • Weather API — Real-time weather information

Medium-term Goals

  • Database Connector — SQL query execution and data analysis
  • Email Integration — Send/receive emails via SMTP/IMAP
  • Social Media Tools — Twitter/X, LinkedIn posting capabilities
  • Image Generation — DALL-E, Stable Diffusion integration
  • Voice/Speech — Text-to-speech and speech-to-text capabilities

Long-term Vision

  • Multi-agent Collaboration — Coordinate between specialized AI agents
  • Custom Tool Builder — GUI for creating custom tool integrations
  • Plugin Ecosystem — Community-contributed tool marketplace
  • Enterprise Features — SSO, audit logs, team collaboration
  • Mobile App — iOS/Android native applications
  • VS Code Extension — IDE-integrated chat interface

Planned Improvements

  • Conversation Export — Save chats to various formats (PDF, Markdown, JSON)
  • Theme Support — Dark/light mode customization
  • Rate Limiting — Built-in request throttling and retry logic
  • Caching Layer — Reduce API calls with intelligent response caching
  • Multi-language Support — i18n for global accessibility
  • Performance Metrics — Track latency, token usage, costs

Project Structure

/workspace
├── chatNotebook.ipynb      # Main interactive notebook
├── requirements.txt        # Python dependencies
├── .env example           # Environment configuration template
├── .gitignore            # Git ignore rules
├── LICENSE               # MIT License
└── README.md             # This file

Requirements

  • Python 3.8+
  • Jupyter Notebook / JupyterLab
  • API key from supported provider

Dependencies

See requirements.txt:

  • ipykernel — Jupyter kernel
  • python-dotenv — Environment variable management
  • ddgs — DuckDuckGo search client
  • openai — OpenAI SDK

Contributing

Contributions are welcome! Areas of focus:

  1. New Tool Integrations — Add new capabilities following the existing pattern
  2. Provider Support — Test and document compatibility with additional API providers
  3. Bug Fixes — Report and fix issues via GitHub Issues
  4. Documentation — Improve guides, examples, and troubleshooting
  5. UI/UX Enhancements — Better notebook interface and user experience

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Test thoroughly with multiple providers
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License—see the LICENSE file for details.

Disclaimer

⚠️ Important Notes:

  • This is a research/educational project in active development
  • Not production-ready without additional security hardening
  • API costs apply—monitor your usage with respective providers
  • Web scraping must comply with target sites' robots.txt and terms of service
  • Handle API keys securely—never commit .env files to version control

Support

For issues, questions, or suggestions:

  • 📝 Open an issue on GitHub
  • 📧 Contact the maintainers
  • 💬 Check existing discussions for common problems

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages