Download the PHP package prism-php/bedrock without Composer
On this page you can find all versions of the php package prism-php/bedrock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prism-php/bedrock
More information about prism-php/bedrock
Files in prism-php/bedrock
Package bedrock
Short Description A provider for Prism adding support for AWS Bedrock.
License MIT
Informations about the package bedrock
Prism Bedrock
Unlock the power of AWS Bedrock services in your Laravel applications with Prism Bedrock. This package provides a standalone Bedrock provider for the Prism PHP framework.
Installation
Configuration
Add the following to your Prism configuration (config/prism.php
):
Usage
Text Generation
Structured Output (JSON)
Embeddings (with Cohere models)
Model names
[!IMPORTANT] When using inference profiles via an ARN, you should urlencode the model name.
Supported API Schemas
AWS Bedrock supports several API schemas - some LLM vendor specific, some generic.
Prism Bedrock supports three of those API schemas:
- Converse: AWS's native interface for chat (default)*
- Anthropic: For Claude models**
- Cohere: For Cohere embeddings models
Each schema supports different capabilities:
Schema | Text | Structured | Embeddings |
---|---|---|---|
Converse | ✅ | ✅ | ❌ |
Anthropic | ✅ | ✅ | ❌ |
Cohere | ❌ | ❌ | ✅ |
* A unified interface for multiple providers. See AWS documentation for a list of supported models.
** The Converse schema does not support Anthropic's native features (e.g. PDF vision analysis). This schema uses Anthropic's native schema and therefore allows use of Anthropic native features. Please note however that Bedrock's Anthropic schema does not yet have feature parity with Anthropic. Notably it does not support documents or citations, and only supports prompt caching for Claude Sonnet 3.7 and Claude Haiku 3.5. To use documents with Anthropic's models, use them via the Converse schema (though note that this not the same as using Anthropic's PDF vision directly).
Auto-resolution of API schemas
Prism Bedrock resolves the most appropriate API schema from the model string. If it is unable to resolve a specific schema (e.g. anthropic for Anthropic), it will default to Converse.
Therefore if you use a model that is not supported by AWS Bedrock Converse, and does not have a specific Prism Bedrock implementation, your request will fail.
If you wish to force Prism Bedrock to use Converse instead of a vendor specific interface, you can do so with withProviderOptions()
:
Cache-Optimized Prompts
For supported models, you can enable prompt caching to reduce latency and costs:
[!TIP] Anthropic currently supports a cacheType of "ephemeral". Converse currently supports a cacheType of "default". It is possible that Anthropic and/or AWS may add additional types in the future.
Structured Adapted Support
Both Anthropic and Converse Schemas do not support a native structured format.
Prism Bedrock has adapted support by appending a prompt asking the model to a response conforming to the schema you provide.
The performance of that prompt may vary by model. You can override it using withProviderOptions()
:
License
The MIT License (MIT). Please see License File for more information.
Authors
This library is created by TJ Miller with contributions from the Open Source Community.
All versions of bedrock with dependencies
laravel/framework Version ^11.0|^12.0
aws/aws-sdk-php Version ^3.339
prism-php/prism Version >=0.77.1