Skip to content

This project demonstrates how to extend the capabilities of GPT models beyond their knowledge cut-off date by integrating real-time web search using function calling. The system uses the OpenAI API with streamlit as the interface and duckduckgo_search for fetching up-to-date information from the web.

Notifications You must be signed in to change notification settings

Majdi21926/ChatGPT_Real_time_Web_Search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cover Logo

πŸ” GPT Function Calling with Real-Time Web Search

This project demonstrates how to extend the capabilities of GPT models beyond their knowledge cut-off date by integrating real-time web search using function calling. The system uses the OpenAI API with streamlit as the interface and duckduckgo_search for fetching up-to-date information from the web.

πŸš€ Features

  • Function Calling with OpenAI's GPT models
  • Real-time Web Search powered by DuckDuckGo
  • Streamlit-based Interface for interactive conversations
  • Modular codebase with support for custom tool integration

πŸ“¦ Requirements

All required packages are listed in requirements.txt. Here's a summary:

  • duckduckgo_search==8.0.1
  • openai==1.75.0
  • Pillow
  • pydantic==2.11.3
  • pyprojroot==0.3.0
  • python-dotenv==1.1.0
  • PyYAML==6.0.2
  • streamlit==1.44.1
  • streamlit-chat==0.1.1

You can install everything with:

pip install -r requirements.txt

▢️ Getting Started

  1. Clone the repository:
https://github.com/Majdi21926/ChatGPT_Real_time_Web_Search.git
cd ChatGPT_Real_time_Web_Search
  1. Add your OpenAI API key in a .env file:
OPENAI_API_KEY=your_api_key_here
  1. Run the app with Streamlit:
streamlit run src/app.py

🧠 How It Works

  • A user's query is parsed by the GPT model.
  • The model chooses whether a function (e.g., web search) should be called.
  • If needed, the DuckDuckGo web search tool is called with the relevant query.
  • GPT gets the real-time search result and integrates it into its response.

πŸ“ Project Structure

.
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.py          # Main Streamlit app
β”‚   β”œβ”€β”€ WebSearch.py    # Web search function class
β”‚   β”œβ”€β”€ Apputils.py     # Utility functions and wrappers
β”‚   └── ...
β”œβ”€β”€ requirements.txt
└── .env                # Environment variables (not committed)

Built with ❀️ using OpenAI, Streamlit & DuckDuckGo.

About

This project demonstrates how to extend the capabilities of GPT models beyond their knowledge cut-off date by integrating real-time web search using function calling. The system uses the OpenAI API with streamlit as the interface and duckduckgo_search for fetching up-to-date information from the web.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages