Skip to content

levipoiani95/project-03-web-chat-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍🤖 OpenAI Chatbot — Python Developer Oriented Project

📌 Overview

This project is a Python-based AI chatbot application integrated with the OpenAI API, designed to demonstrate core competencies expected from a Python Developer, including API integration, clean architecture, environment configuration, and web application development using Streamlit.

The application emphasizes readable code, modular design, and scalability, making it suitable as a portfolio project for backend- and Python-focused roles.


🧱 Architecture and Design Principles

The project follows common Python development best practices, including:

  • Separation of concerns (UI, business logic, API layer)
  • Clear function responsibilities
  • Configuration via environment variables
  • Stateless execution with optional session management
  • Readability and maintainability over complexity

High-level architecture:

  • Presentation Layer: Streamlit UI components
  • Application Layer: Python functions handling validation, prompt formatting, and flow control
  • Service Layer: OpenAI API client integration

🚀 Core Features

  • Python-driven chatbot logic
  • Integration with external AI services (OpenAI API)
  • Interactive web interface using Streamlit
  • Environment-based configuration management
  • Easily testable and extensible codebase

🧰 Technology Stack

🐍 Python

Used for:

  • Application orchestration
  • API request and response handling
  • Data validation and flow control

The project follows idiomatic Python conventions and PEP 8 guidelines.

🧠 OpenAI

The OpenAI Python SDK is used to:

  • Authenticate requests using an API key
  • Submit structured prompts to language models
  • Process AI-generated responses

This demonstrates experience with third-party API integration, request lifecycles, and error handling.

🌐 Streamlit

Streamlit is used for:

  • Rapid UI development
  • Session state management
  • Input and output handling

It allows the focus to remain on Python logic rather than frontend complexity.


🔄 Application Workflow

  1. User input is captured via Streamlit
  2. Input is validated and normalized in Python
  3. The prompt is sent to the OpenAI API
  4. The response is parsed and returned
  5. Output is rendered in the UI

🔐 Configuration and Security

  • Sensitive credentials (OpenAI API key) are stored as environment variables
  • No secrets are hardcoded in the source code
  • Configuration follows industry-standard security practices
export OPENAI_API_KEY="your_api_key_here"

On Windows:

set OPENAI_API_KEY="your_api_key_here"

▶️ Installation and Execution

git clone https://github.com/your-username/openai-chatbot-python.git
pip install -r requirements.txt
streamlit run app.py

🧪 Developer-Focused Use Cases

  • Proof of concept for API-driven Python services
  • Reference implementation for external API consumption
  • Rapid prototyping of AI-enabled Python applications
  • Portfolio project demonstrating production-oriented thinking

🔮 Potential Improvements (Python-Oriented)

  • Refactor into modules and packages (services, ui, config)
  • Add logging and exception handling
  • Implement unit tests using pytest
  • Introduce dependency injection
  • Add configuration management using .env and pydantic

👨‍💻 Target Role Alignment

This project demonstrates competencies expected for:

  • Python Developer
  • Backend Developer (Python)
  • Software Engineer (Python-focused)

Including:

  • API integration
  • Clean and maintainable code
  • Environment-based configuration
  • Scalable project structure

📄 License

This project is intended for educational and portfolio purposes and may be freely adapted or extended.

About

OpenAI Chatbot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages