Skip to content

Commit 893a728

Browse files
RFingAdamclaude
andcommitted
refactor!: remove in-app AI/LLM stack — RFlect is now zero-dependency (Workstream A)
RFlect predated MCP and made its own outbound LLM API calls for an in-app chat assistant, GUI AI-report generation, and AI prose inside the MCP generate_report tool. With an MCP agent driving the tools, the agent is the LLM — so RFlect no longer needs to call one. This removes the entire AI/LLM/API-key surface; the report path is deterministic and the optional agent-authored-narrative interface lands in a follow-up (Workstream B). BREAKING: - Removed plot_antenna/llm_provider.py and plot_antenna/api_keys.py. - generate_report no longer takes ai_* options or calls any LLM; it produces deterministic, data-driven summaries/conclusions/captions. - No API key or paid subscription is required for any RFlect feature. Removed - plot_antenna/gui/ai_chat_mixin.py (in-app chat) + its mixin wiring. - GUI Tools-menu AI items (Manage API Keys, AI Settings, Generate Report with AI, AI Chat Assistant) + their dialog methods in dialogs_mixin. - The AI-vision RFAnalyzer internals in save.py; RFAnalyzer is now a deterministic caption/summary generator. - _create_llm_provider / _generate_ai_text + ai_* ReportOptions fields in report_tools; provider plumbing in orchestration. - AI_* keys from config_template; ai_analysis/ai_prompt/ai_generated flags from report templates. - tests/test_llm_provider.py, tests/test_api_keys.py, and the LLM-specific test classes in test_mcp_report. Renamed - plot_antenna/ai_analysis.py -> analysis_engine.py (it was always pure numpy compute — gain stats, HPBW, sidelobe, polarization, horizon — and backs every MCP analysis tool; the old name was a misnomer). Importers and tests/test_ai_analysis.py -> test_analysis_engine.py updated. Verification: full suite 313 passed / 148 skipped; MCP server + GUI import with no openai/anthropic packages installed; zero residual AI/LLM/key refs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b51a79d commit 893a728

20 files changed

Lines changed: 69 additions & 5490 deletions

plot_antenna/api_keys.py

Lines changed: 0 additions & 607 deletions
This file was deleted.

plot_antenna/config_template.py

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -151,108 +151,6 @@
151151
HEADING1_FONT_SIZE = 18 # Section heading font size
152152
HEADING2_FONT_SIZE = 14 # Subsection heading font size
153153

154-
# ============================================================================
155-
# AI PROVIDER CONFIGURATION
156-
# ============================================================================
157-
158-
# AI Provider: "openai", "anthropic", or "ollama"
159-
AI_PROVIDER = "openai"
160-
161-
# Provider-specific model defaults
162-
AI_OPENAI_MODEL = "gpt-4o-mini"
163-
AI_ANTHROPIC_MODEL = "claude-sonnet-4-20250514"
164-
AI_OLLAMA_MODEL = "llama3.1"
165-
AI_OLLAMA_URL = "http://localhost:11434"
166-
167-
# Vision model override (for plot analysis)
168-
# Set to a vision-capable model if your default model doesn't support vision
169-
AI_VISION_MODEL = None # None = use same as AI_MODEL. e.g. "llava" for Ollama
170-
171-
# ============================================================================
172-
# AI ANALYSIS CONFIGURATION (OpenAI)
173-
# ============================================================================
174-
175-
# AI Model Settings
176-
AI_MODEL = "gpt-4o-mini" # OpenAI model to use (default: gpt-4o-mini for compatibility)
177-
#
178-
# RECOMMENDED MODELS FOR AI CHAT (with function calling):
179-
#
180-
# GPT-5.2 FAMILY (LATEST - Uses Responses API):
181-
# - "gpt-5.2" - Flagship model, best quality, supports tools + vision
182-
# - "gpt-5-mini" ⭐ RECOMMENDED - Great balance of speed/cost/quality
183-
# - "gpt-5-nano" - Fastest, lowest cost, good for simple analysis
184-
#
185-
# GPT-4 FAMILY (LEGACY - Uses Chat Completions API):
186-
# - "gpt-4o-mini" - Best legacy value, fast, supports functions + vision
187-
# - "gpt-4o" - Premium quality, supports functions + vision
188-
# - "chatgpt-4o-latest" - Latest 4o version
189-
#
190-
# ❌ NOT COMPATIBLE WITH AI CHAT:
191-
# - "o1-preview", "o1-mini", "o3-mini" - NO function calling support
192-
# These models cannot call Python functions interactively
193-
#
194-
# GPT-5.2 ADVANTAGES:
195-
# ✅ Uses new Responses API with reasoning control
196-
# ✅ Supports tools (function calling) with strict schemas
197-
# ✅ Supports vision (image analysis for plots)
198-
# ✅ Configurable reasoning effort (none/low/medium/high)
199-
# ✅ Configurable text verbosity (low/medium/high)
200-
# ✅ Better structured output support
201-
#
202-
# WHEN TO USE ALTERNATIVES:
203-
# - Use "gpt-5.2" for best quality analysis
204-
# - Use "gpt-5-mini" for balanced speed/quality
205-
# - Use "gpt-4o-mini" if GPT-5 API access not available
206-
# - DON'T use O-series models for AI chat (no function calling)
207-
AI_MAX_TOKENS = 150 # Maximum response length for report captions (150 = ~100 words)
208-
AI_CHAT_MAX_TOKENS = 800 # Maximum response length for AI Chat assistant (800 = ~500 words)
209-
# NOTE: For GPT-5, this maps to verbosity levels:
210-
# ≤100 → "low", ≤250 → "medium", >250 → "high"
211-
AI_TEMPERATURE = 0.2 # Lower = more consistent (0.0-1.0)
212-
# NOTE: GPT-4 uses this directly. GPT-5 maps it to reasoning.effort:
213-
# ≤0.1 → "none", ≤0.3 → "low", ≤0.6 → "medium", >0.6 → "high"
214-
AI_TOP_P = 0.8 # Nucleus sampling parameter (GPT-4 only, not used for GPT-5)
215-
AI_TIMEOUT_SECONDS = 30 # API request timeout
216-
217-
# AI Prompt Settings
218-
AI_RESPONSE_STYLE = "concise" # "concise" or "detailed"
219-
# - "concise": Single-paragraph technical descriptions (~80 words)
220-
# - "detailed": Multi-section analysis with recommendations (~200+ words)
221-
AI_INCLUDE_RECOMMENDATIONS = False # Include design recommendations in each caption
222-
# Set True for educational reports, False for concise documentation
223-
AI_MAX_WORDS = 80 # Target word count for AI responses
224-
# Suggested ranges: 60-80 (concise), 150-250 (detailed), 300+ (research-level)
225-
226-
# Advanced AI Parameters (GPT-5.2 Responses API)
227-
# These parameters are ONLY used when AI_MODEL is a GPT-5 variant (gpt-5*, gpt-5.2)
228-
# For GPT-4 models, these are ignored and Chat Completions API parameters (temperature, top_p) are used instead
229-
230-
AI_REASONING_EFFORT = "low" # GPT-5.2 reasoning intensity: "none", "low", "medium", "high", "xhigh"
231-
# - "none": No reasoning tokens, fastest response (like GPT-4 behavior)
232-
# - "low": Light reasoning for straightforward technical analysis (RECOMMENDED for RF reports)
233-
# - "medium": Balanced reasoning for complex patterns
234-
# - "high": Deep reasoning for research-level analysis (slower, more expensive)
235-
# - "xhigh": Maximum reasoning effort for most complex problems
236-
# NOTE: RF antenna analysis is domain-specific but not highly complex reasoning,
237-
# so "low" provides best speed/quality/cost balance
238-
239-
AI_TEXT_VERBOSITY = "auto" # GPT-5.2 output verbosity: "auto", "low", "medium", "high"
240-
# - "auto": Let model decide based on AI_MAX_TOKENS (RECOMMENDED)
241-
# - "low": Terse, minimal prose (good for captions)
242-
# - "medium": Balanced detail (good for technical reports)
243-
# - "high": Comprehensive explanations (research papers)
244-
# When "auto", maps AI_MAX_TOKENS: ≤100→low, ≤250→medium, >250→high
245-
246-
AI_GENERATE_REASONING_SUMMARY = False # GPT-5.2 only: Include reasoning summary in response
247-
# When True, provides insight into model's thought process
248-
# Useful for debugging or understanding complex analysis decisions
249-
# Adds ~50-100 tokens to response, minimal cost impact
250-
251-
AI_USE_STRUCTURED_OUTPUT = False # Enable JSON structured output for consistent formatting
252-
# When True, enforces schema-based responses (requires schema definition in code)
253-
# Useful for programmatic parsing but reduces natural language quality
254-
# RECOMMENDED: Keep False for readable report captions
255-
256154
# ============================================================================
257155
# LINK BUDGET / RANGE ESTIMATION
258156
# ============================================================================

plot_antenna/gui/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
Structure:
88
- main_window.py: Core AntennaPlotGUI class combining all mixins
99
- base_protocol.py: Protocol/interface definitions for type checking
10-
- dialogs_mixin.py: Dialog methods (About, API Key, AI Settings, Settings)
11-
- ai_chat_mixin.py: AI chat window and all AI-related methods
10+
- dialogs_mixin.py: Dialog methods (About, Settings)
1211
- tools_mixin.py: Bulk processing, polarization analysis, converters
1312
- callbacks_mixin.py: File import, data processing, save operations
1413
- utils.py: Shared utility functions (DualOutput, resource_path, etc.)

0 commit comments

Comments
 (0)