Skip to content

Additions to Third-party APIs#6

Merged
vinta merged 1 commit intovinta:masterfrom
JoseRoman:patch-2
Jun 30, 2014
Merged

Additions to Third-party APIs#6
vinta merged 1 commit intovinta:masterfrom
JoseRoman:patch-2

Conversation

@JoseRoman
Copy link
Copy Markdown
Contributor

No description provided.

vinta added a commit that referenced this pull request Jun 30, 2014
Additions to Third-party APIs
@vinta vinta merged commit 480f233 into vinta:master Jun 30, 2014
AlexanderSmil pushed a commit to AlexanderSmil/awesome-python that referenced this pull request Apr 12, 2026
…metrics

Closes all remaining architectural audit recommendations.

1. ai/embedding_synthesizer.py (NEW — v2.0 audit item vinta#6)
   - Dynamic polarity detection via cosine similarity between concept embeddings
   - Replaces static POLARITY_MAP with semantic distance (threshold 0.55)
   - Intensity labels: profound/strong/noticeable/subtle based on distance
   - Concept embedding cache to avoid re-embedding within a session
   - Works with any school — no manual polarity pairs needed

2. agents/devops/health_agent.py (NEW)
   - HealthAgent: synchronous self-diagnostic of security/storage/ai/synthesis
   - Thread-isolated asyncio.run() to avoid event loop conflicts
   - Returns {"status": "healthy"|"degraded", "checks": {...}, "version": "1.2.0"}
   - Implements async execute() for orchestrator compatibility

3. monitoring/metrics_collector.py (NEW)
   - Thread-safe rolling-window MetricsCollector
   - timer() context manager, record_ms(), increment() counter
   - snapshot() with avg/min/max/p95 per metric name
   - Module-level singleton: from monitoring.metrics_collector import metrics

4. game/leela_psychological.py
   - Instrument analyze_turn: records total latency, per-school call counts,
     consent_granted/consent_denied counters

5. web/feedback_api.py
   - GET /api/health — liveness/readiness probe (200 healthy, 503 degraded)
   - GET /api/metrics — performance metrics snapshot

6. tests/test_embedding_synthesizer.py (NEW — 17 tests)
   - 6 EmbeddingSynthesizer tests (polarity detection, cache, alignment)
   - 6 MetricsCollector tests (counters, timers, rolling window, p95, reset)
   - 5 HealthAgent tests (all-ok, latency, async execute, unknown action)

Test results: 53/53 passed

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants