Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Geeking Out Over Laravel Prism
Lance Munyao
Lance Munyao

Posted on

     

Geeking Out Over Laravel Prism

So, there I was, casually checking my inbox when a notification fromLaravel News popped up. This one featured a new tool calledPrism. Naturally, my curiosity levels spiked. I mean, c'mon, a package that merges Laravel with the power of LLMs?Yes, please!

As someone who's dabbled in chatbot development before, I was hooked from the moment I read that article. Of course, I had to dive deeper...

My Pre-Prism Approach to Chatbots:

Picture this:

I used to build UIs that acted as the front-end for aFlask.py backend, serving as a proxy. The flow went something like this:

  1. UI sends JSON to the Flask backend.
  2. Flask forwards it to OpenAI’s GPT models (team OpenAI from the start).
  3. Flask waits for the response from OpenAI.
  4. The UI then gets the response.

Sounds smooth? Not really. The delay wasreal. 😅 It worked, sure, but slow as hell. I tried optimizing the Flask functions, but no matter what I did, the wait time was still noticeable.


So, What’s Prism?

Prism Excitement

Prism is a Laravel package that makes integratingLarge Language Models (LLMs) into your application a breeze. Minimalistic, elegant, and surprisingly powerful. The docs, albeit tailored forAnthropic,Ollama, andOpenAI, are so clear and direct that even a caffeine-deprived coder could follow them.


Why I’m Geeked Out Over Prism:

  1. Speed, glorious speed – No more waiting around like it's 2002.
  2. Clean, readable code – Because who doesn't love the smell of clean code in the morning?
  3. Seamless UI integration – Prism plays nice with views, making it super intuitive to mesh with interfaces.
  4. DIY Prism server setup – Prism lets you expose your custom AI models through a standardized API. It’s like having your own AI botnet... but for good. 😎

With the installation done, this is all you'd need to interact with your LLM! Cool right?

<?phpuseIlluminate\Support\Facades\Route;useEchoLabs\Prism\Prism;useEchoLabs\Prism\ValueObjects\Messages\UserMessage;useEchoLabs\Prism\ValueObjects\Messages\AssistantMessage;Route::get('/test-prism',function(){$prism=Prism::text()->using('openai','gpt-4o')->withMessages([newUserMessage('Hello, who are you?'),newAssistantMessage('I am an AI assistant created by Anthropic. How can I help you today?'),newUserMessage('Can you tell me about the weather in Paris?'),]);echo$prism()->text;});
Enter fullscreen modeExit fullscreen mode

In short, Prism isn't just a new tool—it's a time-saver, a workflow optimizer, and dare I say, a game-changer for Laravel + AI enthusiasts.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Nairobi, Kenya
  • Education
    Strathmore University
  • Work
    Student
  • Joined

More fromLance Munyao

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp