How ismail-seleit/revitgeminirag works
Main Components
a. Revit Host Application
• Autodesk Revit 2025 process (loads add-in via .addin manifest)
b. -in Loader & Manifest
• RevitGeminiRAG.addin loads RevitGeminiRAG.dll into Revit’s AppDomain
c. C# Plugin Backend
• RunRAGCommand.cs (command entry point)
• PromptForm.cs/Designer (WinForms UI for user input and response display)
• App.config, NuGet-managed assemblies (Google.Cloud.AIPlatform.V1, gRPC, IronPython, Newtonsoft.Json, etc.)
d. RAG Prompt Generator (Python)
• python/generate_rag_prompt.py invoked in-process via IronPython/DLR
• Local knowledge store (embeddings + API docs) or vector database (abstracted)
e. External LLM Service
• Google Gemini API over gRPC (via Google.Cloud.AIPlatform.V1 client)
• Protos folder for service definitions
f. Dynamic Script Execution
• IronPython engine interprets both RAG script and LLM-generated Python
• GeneratedSuccessfulCode/ folder: archive of one-shot scripts
g. Revit API
• RevitAPI.dll, RevitAPIUI.dll invoked by either C# or Python code to manipulate the model
Relationships & Data Flows
• User clicks button in Revit ribbon → RunRAGCommand is invoked
• RunRAGCommand opens PromptForm and captures user’s natural-language query
• PromptForm passes query to RAG generator (IronPython calls generate_rag_prompt.py)
• RAG generator retrieves relevant API context from local store, combines with query → forms prompt
• C# backend sends prompt to Google Gemini via gRPC → receives LLM response (Python code + plain text)
• C# backend hands generated Python to IronPython engine for execution in Revit context
• Executed script calls Revit API to perform operations (e.g., hide walls, export CSV)
• Results or exceptions are returned to PromptForm and displayed to the user
• Optionally, successful code is saved under GeneratedSuccessfulCode/
Architectural Patterns & Principles
• Plugin Architecture: in-process extension loaded by host application via add-in manifest
• Mediator Pattern: RunRAGCommand orchestrates between UI, Python RAG, LLM client, and Revit API
• RAG Pattern: retrieval of API docs + LLM generation for accurate domain-specific code
• Embedded Interpreter: IronPython (Dynamic Language Runtime) for Python integration inside .NET
• gRPC Microservice: external LLM service interaction via Google AIPlatform client
Technologies & Frameworks
• .NET Framework 4.8 host for Revit plugin
• WinForms (PromptForm.cs) for user interaction
• IronPython/DLR (Microsoft.Scripting packages) for Python execution
• Google.Cloud.AIPlatform.V1 + gRPC/*.Proto for LLM communication
• Vector store or file-based embeddings for RAG context
• NuGet packages (Newtonsoft.Json for serialization, DI abstractions, logging, etc.)
Elements
• User → UI → Controller → RAG Generator → LLM → Controller → Interpreter → Revit API → UI
• Blue for on-host/plugin
• Green for local data stores
• Orange for external cloud service
• Annotations for build/deploy artifacts (e.g., .addin manifest, .dll, Python scripts)