Skip to content

Replace OpenAI GPT with Anthropic Claude#16

Open
Dev-Lan wants to merge 1 commit intomainfrom
feature/replace-openai-with-claude
Open

Replace OpenAI GPT with Anthropic Claude#16
Dev-Lan wants to merge 1 commit intomainfrom
feature/replace-openai-with-claude

Conversation

@Dev-Lan
Copy link
Collaborator

@Dev-Lan Dev-Lan commented Mar 8, 2026

Summary

  • Replace all OpenAI GPT API calls with Anthropic Claude (default claude-sonnet-4-6)
  • Model name configurable via CLAUDE_MODEL_NAME env variable
  • vLLM backend stays as-is (only the GPT orchestration path changes)

Changes

  • pyproject.toml — add anthropic dependency
  • src/udi_agent.py — replace OpenAI GPT client with Anthropic, use tool_use for structured outputs, add @observe() langfuse tracing
  • src/udi_api.py — load CLAUDE_MODEL_NAME env var, update agent init
  • src/vis_generate.py — convert _call_llm_with_tools to Anthropic tool format
  • .env.template — replace OPEN_API_KEY with ANTHROPIC_API_KEY, add CLAUDE_MODEL_NAME
  • README.md — update env var documentation

Spec

From .claude/todo/replace-openai-with-anthropic-claude.md

Test plan

  • Set ANTHROPIC_API_KEY and start the API server
  • Verify POST /v1/yac/completions returns correct orchestrator choices
  • Verify filter and visualization generation works end-to-end
  • Run python src/benchmark.py --path data/benchmark.json --limit 2 to validate against benchmark

🤖 Generated with Claude Code

Swap the GPT-4.1 client for Anthropic Claude (defaulting to
claude-sonnet-4-6) across all orchestration and structured-output
call sites. Uses tool_use for structured outputs (guided choice and
guided JSON) since Anthropic lacks json_schema response_format.
vLLM backend and langfuse OpenAI wrapper are unchanged.

- Add anthropic dependency to pyproject.toml
- Replace gpt_model/gpt_model_name with claude_model/claude_model_name
- Adapt completions_guided_choice to Anthropic tool_use
- Adapt gpt_completions_guided_json → claude_completions_guided_json
- Update _call_llm_with_tools in vis_generate.py for Anthropic format
- Switch langfuse tracing to @observe() decorator for Claude methods
- Add ANTHROPIC_API_KEY and CLAUDE_MODEL_NAME env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant