Skip to content

Consolidate duplicate Venice AI client implementations into single canonical service #491

Description

@devJaja

Summary

There are currently two separate Venice AI client implementations in the backend:

  1. backend/src/services/venice/ — the canonical, well-tested client with cache, dedup, and circuit breaker (client.ts, cache.ts, dedup.ts)
  2. backend/src/venice/ — a smaller duplicate with its own circuitBreaker.ts and client.ts

This causes: divergent retry/backoff behavior, duplicated API key handling, confusion about which client agents use, and maintenance burden. The smaller duplicate also appears to be missing cache/dedup functionality.

Priority

P0 — Two competing Venice clients cause divergent behavior, duplicated config, and untracked fixes.

Files to work on

backend/src/services/venice/ (canonical — keep)
backend/src/venice/ (delete or merge)
backend/src/services/venice/circuitBreaker.ts (restore if missing)

Requirements

  • Audit usage of both clients across backend/src/agents/ and backend/src/coordinator/
  • Consolidate all imports to backend/src/services/venice/
  • Migrate any unique functionality from backend/src/venice/ into backend/src/services/venice/
  • Delete backend/src/venice/ directory
  • Update all imports and verify no residual references remain
  • Add a test that verifies only one VeniceClient class exists

Acceptance Criteria

  • Only backend/src/services/venice/ exists — backend/src/venice/ is deleted
  • All agents and coordinator import from backend/src/services/venice/
  • No duplicate imports of VeniceClient from both paths
  • grep -r "from '../venice/" returns no matches in backend/src/
  • All existing Venice client tests pass
  • npm run lint and npm test pass

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions