Skip to content

feat: add native Anthropic Claude provider - #3

Merged
roboshyim merged 1 commit into
mainfrom
feat/anthropic-provider
Jul 21, 2026
Merged

feat: add native Anthropic Claude provider#3
roboshyim merged 1 commit into
mainfrom
feat/anthropic-provider

Conversation

@roboshyim

Copy link
Copy Markdown
Collaborator

What

Adds a first-class Anthropic Claude provider (P0 roadmap item #1), following the existing Gemini provider pattern.

Implementation

  • AnthropicProvider (src/Provider/Anthropic/) — ID anthropic, models.dev id anthropic, API-key auth. Capabilities: TextGeneration, Vision, ToolCalling, StructuredOutput, Reasoning, Temperature (no image generation).
  • AnthropicClient — maps to the Anthropic Messages API (POST /v1/messages, x-api-key + anthropic-version: 2023-06-01 headers):
    • system messages → top-level system param
    • temperature + max_tokens (required by Anthropic; defaults 4096)
    • structured output via forced tool-use (tool_choice) — extracts the tool_use block as JSON
    • usage (input_tokens/output_tokens) → TokenUsage; stop_reasonFinishReason
    • generateImage() throws ImageGenerationNotSupportedException
  • Registered in services.xml (frosh_ai.provider tag) + config card in config.xml (API key / base URL / default model, de-DE translations).
  • Admin settings component frosh-ai-provider-anthropic (html.twig/scss/index.js) wired into the provider page + en-GB/de-DE snippets.

Tests

tests/Unit/Provider/AnthropicClientTest.php (168 lines): chat mapping, structured output via tool-use, finish-reason mapping, error handling, image-generation-not-supported. Suite: 75 → 80 tests, green in the container (Shopware 6.7.2.2 / PHP 8.3).

- AnthropicProvider: config keys anthropicApiKey/BaseUrl/DefaultModel,
  capabilities TextGeneration/Vision/ToolCalling/StructuredOutput/Reasoning/
  Temperature (no image generation)
- AnthropicClient: Messages API (/v1/messages) with x-api-key +
  anthropic-version headers, system prompt mapping, required max_tokens
  (default 4096), structured output via forced 'structured_output' tool use,
  usage + stop_reason mapping; generateImage() throws
  ImageGenerationNotSupportedException
- DI registration with frosh_ai.provider tag, config.xml card
- Admin settings component frosh-ai-provider-anthropic (en-GB + de-DE snippets)
- Unit tests: chat mapping, structured output tool-use, finish reasons,
  HTTP error handling, image not-supported
@roboshyim
roboshyim force-pushed the feat/anthropic-provider branch from 99f86b7 to ca141d3 Compare July 21, 2026 16:45
@roboshyim
roboshyim merged commit d0b09bc into main Jul 21, 2026
2 checks passed
@roboshyim
roboshyim deleted the feat/anthropic-provider branch July 21, 2026 17:00
roboshyim added a commit that referenced this pull request Jul 21, 2026
- Add FeatureId::CategoryDescription with config key and label
- Add featureCategoryDescription checkbox to config.xml (en + de-DE)
- Create CategoryDescriptionGenerator mirroring ProductDescriptionGenerator
  - Reuses ProductDescriptionToneStore for shared tone presets
  - Accepts category context: name, parentCategories, keywords, metaTitle,
    metaDescription, existingDescription, tone, language, maxWords
- Create CategoryDescriptionController with POST /api/_action/frosh-ai/category/generate-description
  and GET /api/_action/frosh-ai/category/description-status
- Register generator + controller in services.xml
- Add CategoryDescriptionGeneratorTest (5 tests) and update FeatureFlagsTest
  for the new feature flag
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