diff --git a/composer.json b/composer.json index 9b2955a..8301f24 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^8.2", - "papi-ai/papi-core": "^0.9", + "papi-ai/papi-core": "^0.14", "ext-curl": "*" }, "require-dev": { diff --git a/docs/provider.md b/docs/provider.md new file mode 100644 index 0000000..41a7cb8 --- /dev/null +++ b/docs/provider.md @@ -0,0 +1,60 @@ +# Cohere + +Cohere provider for PapiAI. + +## Installation + +```bash +composer require papi-ai/cohere +``` + +## Usage + +```php +use PapiAI\Core\Agent; +use PapiAI\Cohere\CohereProvider; + +$provider = new CohereProvider( + apiKey: $_ENV['COHERE_API_KEY'], +); + +$agent = new Agent( + provider: $provider, + instructions: 'You are a helpful assistant.', +); + +$response = $agent->run('Hello!'); +echo $response->text; +``` + +## Chat Models + +```php +CohereProvider::MODEL_COMMAND_R_PLUS // 'command-r-plus' (default) +CohereProvider::MODEL_COMMAND_R // 'command-r' +CohereProvider::MODEL_COMMAND // 'command' +``` + +## Embedding Models + +```php +CohereProvider::MODEL_EMBED_ENGLISH // 'embed-english-v3.0' +CohereProvider::MODEL_EMBED_MULTILINGUAL // 'embed-multilingual-v3.0' +``` + +## Capabilities + +| Capability | Supported | +|---|---| +| Chat | Yes | +| Streaming | Yes | +| Tool calling | Yes | +| Embeddings | Yes | + +Cohere uses its own v2 Chat API format, which is not OpenAI-compatible. The PapiAI provider handles all format conversion transparently, so you use the same unified API as with any other provider. + +## Requirements + +- PHP 8.2+ +- `ext-curl` +- `papi-ai/papi-core` ^0.14