adachsoft / ai-integration-anthropic
Anthropic Claude tool-calling SPI adapter for adachsoft/ai-integration.
Package info
gitlab.com/a.adach/ai-integration-anthropic
pkg:composer/adachsoft/ai-integration-anthropic
v0.2.0
2026-03-31 20:40 UTC
Requires
- php: >=8.3
- adachsoft/ai-integration: ^0.7.0
- guzzlehttp/guzzle: ^7.0 || ^8.0
Requires (Dev)
- adachsoft/php-code-style: ^0.4.2
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.0
- rector/rector: ^2.3
- vlucas/phpdotenv: ^5.6
README
Integracja Anthropic Claude (tool calling) z biblioteką adachsoft/ai-integration.
Wersja
Aktualna wersja: 0.1.0 (pierwsze publiczne wydanie).
Wymagania
- PHP
>= 8.3 guzzlehttp/guzzle^7.0 || ^8.0adachsoft/ai-integration^0.6.3
Instalacja
composer require adachsoft/ai-integration-anthropic:^0.1.0
Konfiguracja w kodzie
Przykładowe spięcie z fasadą tool-calling z pakietu adachsoft/ai-integration:
use AdachSoft\AiIntegration\PublicApi\Builder\ToolCallingChatFacadeBuilder;
use AdachSoft\AiIntegrationAnthropic\AnthropicToolCallingChatSpi;
$apiKey = getenv('ANTHROPIC_KEY');
$builder = new ToolCallingChatFacadeBuilder();
$builder->withSpiProvider('anthropic', new AnthropicToolCallingChatSpi($apiKey));
$facade = $builder->build();
Szczegółowe przykłady użycia można znaleźć w testach produkcyjnych pod:
tests/Production/ToolCalling/AnthropicProviderProductionTest.phptests/Production/ToolCalling/AnthropicFileToolsConversationProductionTest.php
Testy
Domyślnie konfiguracja phpunit.xml definiuje dwa zestawy testów:
unit– testy jednostkowe (bez testów produkcyjnych)production– testy produkcyjne/integracyjne wymagające prawdziwego klucza API
Przykłady uruchomienia:
# Wszystkie testy
vendor/bin/phpunit
# Tylko unity
vendor/bin/phpunit --testsuite unit
# Tylko testy produkcyjne
ANTHROPIC_KEY=... vendor/bin/phpunit --testsuite production