Implement Phase 2: Core API Integration

- Add Claude API client with Anthropic SDK
  - Retry logic with exponential backoff (3 attempts)
  - Handle auth errors, rate limits, and server errors
  - Architecture classification with JSON parsing
  - Research query generation from architecture
- Add Perplexity API client with native fetch
  - Retry logic with exponential backoff
  - Parse responses with sources and citations
  - Execute multiple research queries
- Add prompt templates for architecture classification
- Add default query generation as fallback
- Add ArchitectureGenerator combining Claude + Perplexity
- Add 44 new tests (80 total, all passing)

All Phase 2 acceptance criteria met:
- Claude client sends prompts and retries on failure
- Perplexity client searches and parses with sources
- Architecture classification returns valid JSON
- Research queries generated (4-6 per architecture)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-01-10 12:17:42 +00:00
parent 606f27d6bb
commit ae0165a802
11 changed files with 1643 additions and 28 deletions

View File

@@ -18,3 +18,24 @@
* ralph-vibe init/new/validate/research exist
* ralph-vibe new fails gracefully without keys
[2026-01-10T12:18:00Z] [2] [COMPLETE] - Phase 2 Core API Integration implemented
- Claude API client with Anthropic SDK
* Retry logic with exponential backoff (3 attempts)
* Handles auth errors, rate limits, server errors
* Architecture classification with JSON parsing
* Research query generation
- Perplexity API client with native fetch
* Retry logic with exponential backoff
* Response parsing with sources and citations
* Research queries execution
- Prompt templates for architecture classification
- Default query generation for fallback
- ArchitectureGenerator for full pipeline
- 80 tests passing, all lint checks pass
- All Phase 2 acceptance criteria met:
* Can send prompt to Claude and receive response
* Retries on failure with exponential backoff
* Can search Perplexity and parse response with sources
* Given idea text, returns valid Architecture JSON
* Given architecture, generates 4-6 relevant search queries