Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kaleidoscope

AWS Bedrock provider for the Laravel AI SDK. Connect your Laravel agents to Claude, OpenAI, Meta Llama, Amazon Nova, and other models running on AWS Bedrock using IAM authentication (SigV4 signing) instead of API keys.

Requirements

  • PHP 8.4+
  • Laravel 13+
  • laravel/ai ^0.8
  • prism-php/prism ^0.100
  • aws/aws-sdk-php ^3.0

Installation

composer require jayi/kaleidoscope

Publish the config file (optional):

php artisan vendor:publish --tag=kaleidoscope-config

Configuration

Add a bedrock provider to your config/ai.php:

'providers' => [
    // ...existing providers...

    'bedrock' => [
        'driver' => 'bedrock',
        'region' => env('AWS_BEDROCK_REGION', 'us-east-1'),
        'profile' => env('AWS_BEDROCK_PROFILE'),
        'credentials' => [
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'token' => env('AWS_SESSION_TOKEN'),
        ],
    ],
],

Then set your environment variables:

AWS_BEDROCK_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key

Documentation

Document Description
Installation Setup, configuration, environment variables, authentication methods
Text Generation Agents, inline prompts, streaming, model selection
Models Anthropic, OpenAI, Mistral, Converse universal provider
Embeddings Amazon Titan Embed, Cohere Embed models and usage
Images Nova Canvas, Titan Image, Stability AI generation
Reranking Cohere Rerank, Amazon Rerank via Agent Runtime
Attachments Image and document attachments, support matrix
Extending Adding new model providers, architecture overview

Quick Start

With Agents

use Laravel\Ai\Attributes\Provider;
use Laravel\Ai\Contracts\Agent;

#[Provider('bedrock')]
class SummaryAgent implements Agent
{
    public function prompt(): string
    {
        return 'Summarize the given text concisely.';
    }
}

Inline Prompts

use Laravel\Ai\Facades\Ai;

$response = Ai::prompt('Explain quantum computing.', provider: 'bedrock');

Streaming

$stream = Ai::stream('Write a short story.', provider: 'bedrock');

foreach ($stream as $event) {
    echo $event->text;
}

Testing

php artisan test --filter=Bedrock

License

MIT

About

AWS Bedrock provider for the Laravel AI SDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages