echolabsdev / prism
A powerful Laravel package for integrating Large Language Models (LLMs) into your applications.
Fund package maintenance!
sixlive
Installs: 691
Dependents: 0
Suggesters: 0
Security: 0
Stars: 520
Watchers: 15
Forks: 25
Open Issues: 10
Requires
- php: ^8.3|^8.4
- laravel/framework: ^11.0
Requires (Dev)
- laravel/pint: ^1.14
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.4
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.11
- phpstan/phpstan-deprecation-rules: ^1.2
- projektgopher/whisky: ^0.7.0
- rector/rector: ^1.1
- symplify/rule-doc-generator-contracts: ^11.2
README
Prism
Prism is a powerful Laravel package for integrating Large Language Models (LLMs) into your applications. It provides a fluent interface for generating text, handling multi-step conversations, and utilizing tools with various AI providers. This way, you can focus on developing outstanding AI applications for your users without getting lost in the technical intricacies.
Official documentation can be found at prism.echolabs.dev.
Installation
Step 1: Composer Installation
First, let's add Prism to your project using Composer. Open your terminal, navigate to your project directory, and run:
composer require echolabsdev/prism
This command will download Prism and its dependencies into your project.
Step 2: Publish the Configuration
Prism comes with a configuration file that you'll want to customize. Publish it to your config directory by running:
php artisan vendor:publish --tag=prism-config
This will create a new file at config/prism.php
. We'll explore how to configure Prism in the next section.
Usage
For more information about using Prism, please visit the documentation site at prism.echolabs.dev.
<?php use EchoLabs\Prism\Prism; // Usage example for Anthropic. $prism = Prism::text() ->using('anthropic', 'claude-3-5-sonnet-20240620') ->withSystemPrompt(view('prompts.nyx')) ->withPrompt('Explain quantum computing to a 5-year-old.'); echo $prism()->text; // Usage example for OpenAI. $prism = Prism::text() ->using('openai', 'gpt-4o') ->withSystemPrompt(view('prompts.nyx')) ->withPrompt('Explain quantum computing to a 5-year-old.'); echo $prism()->text; // Usage example for Ollama. $prism = Prism::text() ->using('ollama', 'qwen2.5:14b') ->withSystemPrompt(view('prompts.nyx')) ->withPrompt('Explain quantum computing to a 5-year-old.'); echo $prism()->text;
Authors
This library is created by TJ Miller with contributions from the Open Source Community.
License
The MIT License (MIT). Please see License File for more information.