From 2b406a5d93a5ca59810e3a9d9c0113ea1e8c1a3e Mon Sep 17 00:00:00 2001 From: Marcello Duarte Date: Mon, 27 Jul 2026 14:12:01 +0100 Subject: [PATCH] Require papi-core ^0.14 Caret locks the minor below 1.0, so ^0.9 excluded core 0.14 and left this package resolvable only against a stale core. Also commits the docs page, correcting its requirements line: the package is papi-ai/papi-core, not papi-ai/core. --- composer.json | 2 +- docs/provider.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 docs/provider.md 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