How margaretmz/ai-fashion-house works
Project Type and Purpose
• Full-stack, modular multi-agent AI application for fashion design.
• Backend in Python using Google’s Agent Development Kit (ADK) to orchestrate specialized “agents.”
• Frontend in React (Vite) exposing a real-time UI over HTTP/WebSockets.
• Heavy use of Google Cloud services (Vertex AI, BigQuery, Cloud Storage) plus Generative AI models (Gemini, Imagen, Veo).
File Structure
• Top-level:
– CLI & Entrypoints: main.py, run.sh, Makefile
– Configuration: .env (via README), pyproject.toml
– Scripts: scripts/setup_rag.sql, setup_rag_connection.sh
• src/ai_fashion_house/: Core backend package
– agents/: Four domain agents (met_rag_agent, search_agent, fashion_design_agent, marketing_agent), each with its own agent.py, prompts.py, and tools.py or external-API modules.
– create_rag.py: RAG environment bootstrapper.
– cli.py: CLI command definitions (start, setup-rag).
– web/: FastAPI (or similar) web server modules (api.py, app.py, web.py) plus static/ assets for serving the built React app.
– utils/: Helpers for ADK, GCP, image processing.
• ui/: React front end
– src/contexts/WebSocketContext: WebSocket connection for real-time agent logs/status.
– components/: Log viewer, artifact gallery, stepper, state viewer.
– pages/: Home, project overview.
– package.json, vite.config.js: Frontend build.
README for Architectural Insights
• Asynchronous multi-agent orchestration: each agent steps in sequence but runs independently.
• RAG pipeline uses BigQuery + GenAI embeddings + Gemini multimodal analysis.
• Marketing agent calls Imagen 4 (fashion images), Veo 3 (runway videos), Gemini for social copy.
• Web UI communicates via HTTP/WebSocket to the backend.
Main Components & Relationships
a. User Interface Layer (React)
– Components subscribe to WebSocket for agent progress/status.
– Sends user input (design concept) via HTTP POST to backend API.
b. Web/API Layer (FastAPI in web/api.py)
– Exposes REST & WebSocket endpoints.
– Receives user requests, forwards to the orchestration engine.
– Streams logs/events back to UI.
c. Orchestration Core (ADK + cli.py/main.py)
– Instantiates and coordinates agents in sequence.
– Manages shared state and data passing between agents.
d. Agents (modules under src/ai_fashion_house/agents/)
1. Input Analysis Agent – parses free-form user text into structured prompts.
2. met_rag_agent –
• BigQuery RAG retrieval
• Embedding generation (text-embedding-005)
• Gemini multimodal analysis
3. search_agent – Google Search Grounding for contemporary references
4. fashion_design_agent – Aggregates references into a final GenAI prompt
5. marketing_agent – Calls Imagen, Veo, and Gemini for final artifacts
e. External Services
– Google Cloud BigQuery (datasets, vector index)
– Vertex AI (embedding & caption models, Imagen, Veo)
– Cloud Storage (bucket for images/videos)
– Google Search API (for search_agent)
f. Persistence & Messaging
– BigQuery for RAG
– GCS for media storage
– (Optional) In-memory state or ephemeral local cache during orchestration
Architectural Patterns & Principles
• Modular, plug-and-play agents – each agent self-contained; easy to add or replace.
• Event-driven / asynchronous workflow – allows parallelism and non-blocking calls.
• Clear separation of concerns – UI, API, orchestration, agent logic, external services.
• RAG pattern for retrieval‐augmented generation.