Skip to content

Chat Fusion is a contextual chatbot project designed to maintain conversation history and provide coherent, context-aware responses using advanced natural language processing techniques. The project leverages OpenAI's GPT model and is implemented using Python and FastAPI for robust backend support.

License

Notifications You must be signed in to change notification settings

BhawnaMehbubani/Contextual_chatbot_project_leveraging_OpenAI-s_GPT_model_and_is-implemented_using_Python_and_FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Chat Fusion

Chat Fusion is a contextual chatbot project designed to maintain conversation history and provide coherent, context-aware responses using advanced natural language processing techniques. The project leverages OpenAI's GPT model and is implemented using Python and FastAPI for robust backend support.


Features

  • Maintains a history of up to 10 recent messages for contextual awareness.
  • Implements OpenAI's GPT-4 model for generating conversational responses.
  • FastAPI integration for efficient REST API handling.
  • Error handling for robust interaction.

Folder Structure

chat_fusion/
├── app/
│   ├── main.py          # FastAPI application and chatbot integration
│   └── index.html       # Frontend for user interaction
├── requirements.txt    # Python dependencies
└── README.md           # Project documentation

Prerequisites

  • Python 3.8+
  • An OpenAI API key with access to GPT models
  • Basic understanding of Python and FastAPI

Installation

  1. Clone the Repository:

    git clone https://github.com/yourusername/chat-fusion.git
    cd chat-fusion
  2. Create a Virtual Environment:

    python -m venv venv
    source venv/bin/activate   # On Windows: venv\Scripts\activate
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Set Up Environment Variables: Create a .env file in the project root and add your OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key
  5. Run the Application:

    uvicorn app.main:app --reload
  6. Access the Application: Open your browser and navigate to http://127.0.0.1:8000.


Usage

  • Frontend: Interact with the chatbot via the provided HTML interface.
  • API: Send a POST request to the /chat endpoint with user input to receive a response.

Example:

curl -X POST http://127.0.0.1:8000/chat \
     -H "Content-Type: application/json" \
     -d '{"user_input": "Hello!"}'

Response:

{
    "response": "Hi! How can I assist you today?"
}

Future Enhancements

  • Integration with a database for persistent conversation storage.
  • Improved error handling and logging.
  • Support for multiple GPT model versions.

License

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

About

Chat Fusion is a contextual chatbot project designed to maintain conversation history and provide coherent, context-aware responses using advanced natural language processing techniques. The project leverages OpenAI's GPT model and is implemented using Python and FastAPI for robust backend support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published