The Prism Bedrock package is a standalone Bedrock provider for the Prism PHP Package for Laravel. The Bedrock provider supports text generation, structured output, embeddings, and more:
use Prism\Prism\Prism;use Prism\Bedrock\Bedrock; $response = Prism::text() ->using(Bedrock::KEY, 'anthropic.claude-3-sonnet-20240229-v1:0') ->withPrompt('Explain quantum computing in simple terms') ->asText(); echo $response->text;
This package also supports cache-optimized prompts to reduce latency and costs:
use Prism\Prism\Prism;use Prism\Bedrock\Bedrock;use Prism\Prism\ValueObjects\Messages\UserMessage; $response = Prism::text() ->using(Bedrock::KEY, 'anthropic.claude-3-sonnet-20240229-v1:0') ->withMessages([ new UserMessage('Message with cache breakpoint') ->withProviderOptions(['cacheType' => 'ephemeral']), new UserMessage('Message with another cache breakpoint') ->withProviderOptions(['cacheType' => 'ephemeral']), new UserMessage('Compare the last two messages.') ]) ->asText();
Main Features
- Auto-resolution of API schemas
- A unified interface for multiple providers
- Cache-optimized prompts to reduce latency and costs
- Support for Converse, Anthropic, and Cohere (embeddings) schemas
- And more...
You can learn more about this package, get full installation instructions, and view the source code on GitHub. The primary Prism documentation is also a helpful place to get started with this package regardless of the providers you use.