Prism

Prism stats

Downloads
6
Stars
208
Open Issues
3
Forks
6

View on GitHub →

A powerful Laravel package for integrating Large Language Models (LLMs) into your applications.

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

<?php
 
$response = Prism::using('anthropic', 'claude-3-5-sonnet-20240620')
->generateText()
->withSystemMessage(view('prompts.nyx'))
->withPrompt('Explain quantum computing to a 5-year-old.')();
 
echo $response->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.

echolabsdev photo

Crafting developer experiences for Laravel

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Echolabsdev Prism Related Articles

Prism Workers AI — A Cloudflare Workers AI Provider for Prism PHP image

Prism Workers AI — A Cloudflare Workers AI Provider for Prism PHP

Read article
Laravel News 2025 Recap image

Laravel News 2025 Recap

Read article
Laravel Live Denmark image

Laravel Live Denmark

Read article
Laravel AI Chat Starter Kit image

Laravel AI Chat Starter Kit

Read article
Prism Relay image

Prism Relay

Read article
Use Amazon Bedrock in Laravel with Prism PHP image

Use Amazon Bedrock in Laravel with Prism PHP

Read article
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel