Laravel Tutorials

Decide with Jev: Three Questions in One Request with the Laravel AI SDK

Published

▶️ Watch the video tutorial (9 minutes)

A single yes or no doesn't tell you much about a draft. It can tell you the draft matches the brief, but not what kind of text it is or whether the steps are easy to follow. So in this episode of Decide with Jev, I ask Jev three questions about the same draft and still send only one request. Each question gets its own kind of answer:

  • A Boolean: does the draft deliver the brief?
  • A choice: is it a tutorial, an announcement, an opinion, or something else?
  • A score: does the reader get clear steps and a way to check the result?

Why not one overall score? Because "7 out of 10" hides too much. When it drops to a 5, you can't tell which part got worse. Three separate answers point straight at the part that changed.

First I move the request into its own service, so the app and the tests ask the exact same questions. That set of questions gets a name and a version, and if the rules change later, it becomes a new version.

I also add "other" to the list of formats. Without it, Jev has to squeeze every draft into one of the three, even when none of them fit. Then I read the answers. A choice answer tells you which option Jev picked and how likely each option was. It also comes with a confidence number that shows how clear the pick was. A score answer can land between two levels, so I use  level()  to get the most likely level and  normalized()  to turn the score into a number from 0 to 1.

One catch: the three questions don't see each other's answers. Jev answers all of them at the same time, so the format pick can't change how the steps get scored. When one answer should affect another decision, I handle it in PHP after the request comes back.

⭐ GitHub: https://github.com/harris21/decide-with-jev ▶️ Watch Episode 2 now →

Harris Raftopoulos photo

Senior Software Engineer • Staff & Educator @ Laravel News • Co-organizer @ Laravel Greece Meetup

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux image

pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux

Read article
Laranon: Reversible PII Anonymization for Laravel and LLMs image

Laranon: Reversible PII Anonymization for Laravel and LLMs

Read article
PHP 8.6 is released!  image

PHP 8.6 is released!

Read article
Laravel Warrant: Row-Level Permissions With Eloquent image

Laravel Warrant: Row-Level Permissions With Eloquent

Read article
JSON Schema Validation Rules and a RetryFor Attribute in Laravel 13.43 image

JSON Schema Validation Rules and a RetryFor Attribute in Laravel 13.43

Read article
Durable Workflow: Long-Running Workflows for Laravel image

Durable Workflow: Long-Running Workflows for Laravel

Read article