
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:
- UI sends JSON to the Flask backend.
- Flask forwards it to OpenAI’s GPT models (team OpenAI from the start).
- Flask waits for the response from OpenAI.
- 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 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:
- Speed, glorious speed – No more waiting around like it's 2002.
- Clean, readable code – Because who doesn't love the smell of clean code in the morning?
- Seamless UI integration – Prism plays nice with views, making it super intuitive to mesh with interfaces.
- 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;});
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)
For further actions, you may consider blocking this person and/orreporting abuse