How sharonmordechai/ai-assistant-with-vector-store works
Project type and purpose
• This is a full-stack Python web application (a single, monolithic Streamlit app) that provides an AI-powered conversational interface.
• It uses LangChain to orchestrate agents and memory, FAISS for vector-based document search, and OpenAI for model inference.
File structure to extract components
• Top-level script:
• main.py – the entry point, defines the Streamlit UI and glues together all services.
• Utility modules:
• utils/langchain_loaders.py – functions to load documents into LangChain, build FAISS vector stores.
• Configuration & dependencies:
• requirements.txt, dev-requirements.txt, .github/workflows/ci.yaml – CI/CD and linting.
• Supporting material (not in the runtime path):
• examples/, documentation/, tests/
README for technical stack and workflow
• Frontend: Streamlit (interactive UI in the browser)
• Backend logic: Python, LangChain agents & memory, document loaders
• Vector store: FAISS
• External API: OpenAI (GPT-4 / GPT-3.5-turbo)
Main components
a. Streamlit UI
• Renders input widgets (API key, model selector, temperature slider, file uploader)
• Displays chat history and responses
b. Application Core (main.py)
• Orchestrates user requests and responses
• Calls utils/langchain_loaders to ingest/upload documents
• Manages a LangChain agent or chain instance that:
• Checks memory and vector store for context
• Retrieves relevant docs from FAISS
• Formats prompts and calls OpenAI API
• Updates memory and chat history
c. FAISS Vector Store
• Stores document embeddings for efficient similarity search
• Populated by LangChain loaders when files are uploaded
d. OpenAI API (external service)
• Receives prompts from the application
• Returns model outputs (chat completions)
e. (Optionally) CI/CD pipeline and Dev tools
• GitHub Actions workflow for tests and linting
• pre-commit hooks
Relationships and interactions (data flow)
• User → Streamlit UI → Application Core
• File upload → LangChain loader → FAISS store
• User query → Application Core → FAISS (retrieve contexts)
• Application Core → OpenAI API → Application Core → Streamlit UI → User
• (CI/CD) Repo commit → GitHub Actions → Tests/Linters
Architectural patterns and design principles
• Monolithic, single-process service but logically layered:
• Presentation layer (Streamlit)
• Orchestration layer (main.py + LangChain)
• Data layer (vector store + in-memory memory)
• Separation of concerns: UI vs. business logic vs. data storage
• External integration points abstracted behind function calls