Prism With TJ Miller

Prism With TJ Miller

Feb 25, 2025

In this episode, Scott talks with TJ Miller about Prism "a powerful Laravel package for integrating Large Language Models (LLMs) into your applications". php[tek] is looking for sponsors! See https://phptek.io/blog/elevate-your-brand-sponsorship-phptek-2025 for more information. 00:00 Intro 00:62 What is prism? 06:14 HoneyBadger 07:04 LLM Calling Closures 17:51 Outro Links: Prism Website - https://prism.echolabs.dev/ HoneyBadger.io - https://HoneyBadger.io Our Discord - https://discord.gg/aMTxunVx TJ's Social Media: Twitter - https://x.com/heytjmiller Bluesky - https://bsky.app/profile/tjmiller.bsky.social Scott's Social Media: Bluesky - https://bsky.app/profile/scottkeckwarren.bsky.social Mastodon - https://phpc.social/@scottkeckwarren

Transcript

Scott Keck-Warren Scott Keck-Warren 0:05
Hello developers, and welcome to the PHP Community Corner podcast, where we have conversations with members of the web development community. I'm your host, Scott Keck Warren, and today we're talking with TJ Miller about Prism, working in Laravel, large language models, and his talks at PHP Tech 2025. TJ Miller is a veteran developer who spent 2 decades turning coffee into code. As principal at Geocodeo and creator of Prism, they're on a mission to make large language models nice to play with in Laravel. Equal parts dreamer and doer, they're known for launching development tools that can make the Laravel ecosystem more awesome. When not crafting APIs or geeking out over CLI tools, you'll find them advocating for ADHD awareness and proving that neurodivergent minds build amazing things. Thank you, TJ, for finding some time to talk to us today.
B
Speaker B 0:50
Oh yeah, thank you so much for having me.
Scott Keck-Warren Scott Keck-Warren 0:52
Yeah, absolutely. So you kind of came onto my radar because you're working with the— you're creating the Prism library. Can you talk to us a little bit about what that is and what it enables developers to do?
B
Speaker B 1:02
Yeah, so Prism is a big passion project of mine. I got started with AI like just before ChatGPT came out. Just kind of like it caught me and I ran with it, but I was always bothered by like like not working with Laravel. I had to go out and learn Python to like start playing with things. Stuff started kind of happening in the Node.js atmosphere. And I just, I wanted to get back to working with Laravel. So Prism is kind of my answer to allowing me to do a lot of different things with AI and large language models inside of Laravel. And kind of what like Prism's purpose is to serve is really to be like a centralized entry point to work with any number of different large language model providers. So right now, out of the box, we support OpenAI, Anthropic, DeepSeek, Ollama. We're working on AWS Bedrock and Azure OpenAI. So we kind of have this centralized, like unified API for working with any of these providers and really just swapping out a couple of things to be able to, you know, swap between Anthropic or OpenAI for example, and kind of use the same interface for all of that.
Scott Keck-Warren Scott Keck-Warren 2:20
Yeah. So I found that really fascinating to kind of like read through the, the, like the documentation that you have on the, on the Prism website. And like, I'm, I'm like a very, um, like AI large language model, like newbie. And so like, I didn't even realize that like there were so many like publicly available models to mess with, right? That's the correct term is models.
B
Speaker B 2:40
Yeah. So there's like providers and models. So providers have different models available. So for example, um, with OpenAI, you've got GPT-4, you've got 4o, you've got the 01 series of models. Anthropic, you've got Claude, Haiku. And with like Ollama, you've got an almost infinite number of different models that you can run using Ollama as the provider. Oh,
Scott Keck-Warren Scott Keck-Warren 3:06
okay. I didn't even realize like there was a distinction between that. That's interesting. So then, so like as like somebody who has minimal like experience with even with ChatGPT, right? Like my thing is like I throw stuff into ChatGPT and it kind of summarizes it for me. Like how hard is it gonna be for me who knows Laravel to, to kind of get up and running in inside the Prism infrastructure?
B
Speaker B 3:26
My hope with Prism is that it's very easy for you to be able to hop in and be able to start figuring out the basics and, and building any sort of thing you want. I think a really common starting place is to, you know, it's similar to how I kind of think about jumping into things with Laravel is let me just build an artisan command and kind of be able to just drop in there and be able to play inside of the terminal with different outputs. So, um, the, the hope would be it's very easy. easy to do, just hop in and do the basics of just input/output stuff for sure.
Scott Keck-Warren Scott Keck-Warren 3:55
So like, I guess more of my question is like, what is it, what is involved in me getting set up to be able to like, to talk to ChatGPT or to talk to one of the other models?
B
Speaker B 4:04
Yes. With Prism, install the library, you hop over to OpenAI, get yourself a set of API keys. Um, and then you just drop your API key into the like Laravel environment file and you're basically like up and running to start using the Prism library. So I've tried to make it super simple to like get And like a very simple API, but enough with the API that you can also start diving into more advanced things like tool use and function calling.
Scott Keck-Warren Scott Keck-Warren 4:32
I, I, I'm again, like, I'm very basic in this whole thing. So like, we're, we have like a, we have been in chat, we're in discussions at work essentially about like how we can like integrate more ChatGPT or, or whatever into like our, into our products. And like, I'm just like, I don't even know how to talk to these things. So this looks like it's a good like way for me to get like started on that, at least like working down the pathway. Have you found like some really interesting— have people reached out and said, here's like a cool thing that we're building with this? Or do you— have you seen those kind of things online?
B
Speaker B 5:00
Yeah, yeah. I've started to see a lot more stuff come out. Somebody had reached out on Twitter over the holidays that they had started building a suite of tools that drop right into the Prism ecosystem. So having tools like being able to chat with a Prism agent, like setting up like Prism with a model and provider and then be able to chat with that and be able to write queries to your like database, be able to like interface with Eloquent, which is like Laravel's ORM. So you can do some like pretty, you can get into doing some like pretty wild stuff with it. Um, and I also know that there's a law firm that's using us to like, um, using Prism to like analyze different art, like different aspects of contracts, um, which I think is super fascinating. So there's definitely a lot of stuff out there and the more features I'm putting out with with Laravel, the more, or with the more features I'm putting out with Prism, the more people are building stuff. And I'm starting to hear like a lot, a lot more cool things. So as we're getting towards, like, I wouldn't say like feature completion, but, um, as we're getting to like really rounding out the feature set and offering more providers, I think that opens the door for a lot more people to get involved.
Scott Keck-Warren Scott Keck-Warren 6:11
And we'll be right back with, after this word from our sponsors. Let me tell you a quick story about our sponsor, honeybadger.io. One time a customer of theirs had a background job that ran overnight that caused hundreds hundreds of thousands of errors to be reported to Honeybadger by mistake. Like many other application and performance monitoring tools, Honeybadger bills for monthly usage, so this customer's mistake was going to cost them a lot of extra money that month. If you've ever used a monitoring service, you might have experienced something like this. Well, fortunately for this customer, they emailed Honeybadger support and received the most amazing reply. Honeybadger was resetting their monthly quota and canceling the bill. This is one example of how the small team at Honeybadger cares about their users. Ask anyone who knows and you'll hear similar stories. Go check them out at honeybadger.io. It's free to get started and setup takes less than 5 minutes. Don't forget to bookmark it. That's honeybadger.io. And you can use our link to show that we sent you there. And we're back with TJ Miller. So, so, and I guess like, can I take a step back and can we talk about like, so, so you have the ability for Prism to kind of like, it like escapes like the PHP section and like can talk to the database. How does that, how does that?
B
Speaker B 7:15
Yeah, so there's a concept of like tools and function calling. You can kind of use like tool use and function calling like interchangeably, 'cause they're basically the same thing. If we boil it down to its simplest form, you can essentially expose a closure to Prism that the large language model now has use of. So you can like register a tool, for example, that makes API requests to a weather API. And so you can be just like chatting the model and you could ask it, you know, like, hey, like, what's the weather gonna be like for Detroit? And you can have a closure defined that takes as its input a city and its output, you know, we make the API request in the closure and then its output is like a textual representation of what the weather forecast is gonna be. The large language model will then take the result of that closure and use it as part of its text generation. So it'll be able to tell you like, hey, the weather for Detroit's gonna be, you know, such and such temperature, you know, it's gonna be freezing and snowy like we've got right now. So.
Scott Keck-Warren Scott Keck-Warren 8:18
That's, I, okay. I, every so often, like somebody shows me something with like all these, these language models and I'm just like, okay, that blew me, blows me away. And then like, this was just like another thing where like it being able to use, like interface with a code base, right? Like that's, that is a fast, I didn't, didn't, I didn't, I read through the docs. I really like did like a quick skim, skim through and I like started getting it set up, but I ran outta time and I apologize for that. But I didn't even like realize that that was like a functionality of that.
B
Speaker B 8:43
Yeah, yeah. Being able to expose like different— enhance the language model with additional functionality is like really what you can get out of these tools. So you can define them as like class-based tools or closures, and you can define all sorts of different parameters with them. And yeah, you could have it basically like give it a connection to your database and, you know, the closure's input is going to be like SQL queries. And so you could like have a chat with this agent and it's now like writing queries against your database. And you could have like another tool, for example, that exposes the schema of your database. So it knows to use that one tool to get your database schema, and then we'll write a query and use the other tool to then actually query your database and get results back out of it. So you can do some pretty wild stuff.
Scott Keck-Warren Scott Keck-Warren 9:29
So could I give it access to my database and then say, can you make some— look at this table and make some summarizations and things like that? Is that within the realm of possibility?
B
Speaker B 9:40
Absolutely.
Scott Keck-Warren Scott Keck-Warren 9:41
I am sorry. This is like just blowing my mind whenever we talk about these things. Yeah.
B
Speaker B 9:45
Yeah. Yeah. When I first discovered like tool use, I think that was, that was a big, that was a big moment for me too, of just like, wow, like that, that opens up the possibility for you to do just about anything and be able to build these like really powerful agents that, you know, you could chain together and like they can optionally use tools, different providers. You can tell 'em like, you have to use this tool. So you can really give it, you know, you could give it 30 different tools and just have a conversation with it, and it will pick and choose what and when to use different tools. So you can really have a really in-depth chat experience with, you know, a language model that is completely up to date. Like, one of my favorite things to do for a lot of my personal agents is to expose a Google search-like tool to them so that they can go out and look for more relevant information. I did a livestream with Nuno Maduro, And one of the things we did is we built a CLI chat that had access to a Google search tool. So first, before we gave it access to the tool, we asked it, you know, hey, what's the latest version of Laravel? Well, these models are trained on data, but that training stops at a certain point in time. So it said, you know, hey, the latest version of Laravel is Laravel 10. Then we gave it the tool to, you know, be able to search the web with it. And it came back with the right version. It says, yeah, we looked at the GitHub for Laravel. The latest version's Laravel 11. And will like even give us some of the features, I think, of like what's new in Laravel 11. Um, pretty wild stuff.
Scott Keck-Warren Scott Keck-Warren 11:16
That is really wild. So, so you must have like a lot of access to like, so you probably touched like a lot more like models than the, like the normal developer. Like, is there, are there ones that you prefer to work with when you're trying to do things? Or are they all kind of like close, closely similar in like their capabilities at this point?
B
Speaker B 11:31
There's, it's a race. Like I think every, every week, like a provider comes out with a new model that's supposed to rival other models. Um, I get exposed to a lot of them just building through building Prism, like needing to like test functionality against different providers. My favorites right now that I use on a day-to-day basis, I use Claude, like Anthropic's Claude, their Sonnet 3.5 model. I use that all day, every day. There's another really good one that just came out for Ollama, DeepSeek R1. It's like a reasoning model. That one just came out a few days ago. days ago, and I've been trying to like experiment and play with that, and that's been super promising. So yeah, that's, those are pretty much the leaders. Like I'll jump over to OpenAI and use, um, GPT a little bit here and there, but for the most part, I get almost everything I need out of Claude and their, their Sonnet models.
Scott Keck-Warren Scott Keck-Warren 12:30
That's interesting because like from, from like my perspective, like as somebody who works with, you know, non-technical people, like ChatGPT is like the only thing that they've like really even heard of. You know what I mean? Like there's, there's all this stuff out there, but like, ChatGPT has gotten like the mindshare, it seems like, from, at least for normal people.
B
Speaker B 12:46
Yeah. I mean, they were the, they were really the front runners in exposing, you know, large language models and AI to the mass, mass majority of people. So I think they've definitely got their foot in the door marketing-wise. I think the next biggest one is probably Anthropic, which has got that Claude series of models. Those seem to be very popular in the programming community as well.
Scott Keck-Warren Scott Keck-Warren 13:09
I'm going to— that's, I guess I'll make that one like my, like target to see like how, how I can get stuff to work.
B
Speaker B 13:14
Yeah. In my opinion, if you were going to go out and spend like, for the most, most places it's like $20 a month, you know, to have like a ChatGPT subscription. Um, it's the same cost over at Anthropic and I think you'll get your, you'll get more than your money's worth out of going with Anthropic. Um, but there's some really cool stuff that people are doing right now with the 01 series of models. from OpenAI. So it's kind of just this back and forth. Um, I've got subscriptions with just about everybody. So, um, I, I kind of will, will pop around a little bit, but, um, yeah, I, I personally, I just prefer Anthropic.
Scott Keck-Warren Scott Keck-Warren 13:51
Okay. Yeah, I'm definitely gonna check that out. And so is there, so like, so Prism is like fairly stable at this point, right? Like we can go out and deploy it in production. It sounds like if lawyers are using it, it's, it's fairly stable. Or is there still like a lot left to be done within the project?
B
Speaker B 14:06
I think the API, especially with my most recent refactor, um, I think the API is very stable at this point. Um, there's still like, we're, we haven't gone to 1.0 yet. There's a few things that I want to massage a little bit. There's a few features that I need to build that may affect the API, but I definitely see us getting to 1.0 within the next like 2 months. So I'd say we're, we're pretty close to that, like Yeah, being able to hit 1.0, but I'd say it's fairly stable and there's definitely people using it in production right now. Um, so like worst case, pin your ver— like be very specific about pinning your version. And that's something I call out on the docs too, is that, you know, we're still, we're still pre-1.0. Um, I'm trying not to rock the boat too much, but yeah, pin, pin the version down and just kind of take a look through the release notes and make sure you're up to date. Cause I definitely call out any breaking changes. Well,
Scott Keck-Warren Scott Keck-Warren 15:00
that's great to hear, 'cause that always can like really bite us when we don't notice those things. So.
B
Speaker B 15:06
Yeah, I just use GitHub releases, make life easy, put all the changes in there.
Scott Keck-Warren Scott Keck-Warren 15:10
Okay, great. Yeah, I'm definitely like, I'm gonna be checking it out and for sure, and like trying some of these things, 'cause that's like one of our big things this year is trying to do more AI, uh, um, like in our, in my day job, essentially.
B
Speaker B 15:21
In your day-to-day, I think one of the things that's also really worth looking at, um, inside of Prism is our structured output functionality. And that is essentially a way to do text generation. But your final result being an associative array. So if you want, as you're programming, instead of just getting plain text back, you get a blob of a paragraph or 2 back from the language model. Sometimes that's what you want, but other times, if you're gonna be passing that data off to, let's say, create an Eloquent model, you're like, hey, take a look at this chunk of text. It's like a biography from a user, right? And I want an associative array back of the person's name and an array of all of their interests. of their different hobbies, you know, and you want to store that as an Eloquent model, structured output's probably the way to go. You can throw that piece of text at it, you get back an associative array, and then you can, you know, maybe validate that and then pass it to an Eloquent creation model. And like, now you've got stuff stored in the database. So as you're working with programming, definitely take a look at the structured output stuff. I think that'd be very beneficial.
Scott Keck-Warren Scott Keck-Warren 16:26
Yeah, well, I'm definitely going to be like playing with it. So that's— thank you for that little tip there. Um, is there anything else that you want to direct our listeners to before we let you go for today?
B
Speaker B 16:34
Yeah, sure. Uh, you can find me all over the place. Uh, I've got a podcast with my, one of my really good friends, Chris Kamir, Slightly Caffeinated. Um, you can tune in there and you get to hear all about like stuff I'm working on with Prism and just, you know, keep up to date with what, what the two of us are up to. Um, and then you can find me like pretty much socials everywhere. Uh, Bluesky, Twitter, all over. Um, easiest place to find that is go to tjmiller.me/links. And yeah, you can find me all over the place. And if you're doing anything geocoding-wise, make sure you check out Geocodio. My day job, we do a lot of awesome stuff there, and I think we're going to have the whole crew out at Laracon, and that'd be great. And speaking of conferences, I'll be doing a workshop and a talk this year at PHP Tech. So definitely something to come check out. We're going to do a workshop on building with Prism and do some cool stuff talking about ClickHouse and database migrations. So that'll be super fun.
Scott Keck-Warren Scott Keck-Warren 17:33
That sounds interesting too. I'm struggling with like all the tutorial tracks look like something I want to go to. So I had to pick one and just go to it.
B
Speaker B 17:40
So. Yeah. Yeah. We'll have some fun. It'll be a really good conference this year. I had a blast last year, so definitely looking forward to it.
Scott Keck-Warren Scott Keck-Warren 17:46
Thank you. Thank you again for finding some time to talk to us today.
B
Speaker B 17:48
Yeah. Thank you so much for having me. This was a blast.
Scott Keck-Warren Scott Keck-Warren 17:51
I have to say another heartfelt thank you to TJ and to you for finding time to watch our podcast today. If you're not already a subscriber, make sure you subscribe with whatever your preferred method is. This video— this episode is available both as a video version on the YouTube, our YouTube channel, and an audio version on the PHP Architect website. This is Scott Keck Warren for the PHP Community Corner signing off and remind you to keep listening, keep coding, and keep reading.