AI helper service / 2026 / Prototype
Brimfox AI Core.
A prototype Python service that re-orders recipes and checks explanations by rules you can follow, not yet used by Brimfox
Part of the Brimfox journey- Role
- Software engineering
- Built with
- Python 3.11 · FastAPI · Pydantic 2 · Uvicorn · pytest · Laravel HTTP client · Docker
01What I built
The problem.
A recipe app has to decide which recipes to show first. It also has to check whether a generated explanation sticks to the recipe. Rules for that are easier to test when they run on their own. But a separate service is one more thing that can be slow, down or set up wrong. And it does nothing until the app really calls it.
What I built.
Brimfox AI Core is a Python service with a small A technical wordAPIA set of web addresses that one program uses to ask another program for data, or to ask it to do something., two web addresses that the app can call. One puts the recipe choices it is given in a new order. It uses fixed weights, which are set numbers for how much each thing counts. The other compares an explanation with the source material it is given. It sends back counts of how much is supported, plus warnings. Neither one fetches recipes or calls an AI model. In the Brimfox Laravel server, a client sends the request as A technical wordJSONA common text format that programs use to send each other structured data., a common structured text format, with a pass key and a trace ID. The trace ID lets me follow one call through both systems. The client has time limits and only retries a set number of times.
The Python service
Python 3.11, FastAPI, Pydantic 2, Uvicorn, Docker
- Recipe ordering
- Gives each recipe choice points for matching the search words and phrases. It adds points for ingredients on hand and for swaps that cover a gap, then sorts.
- Explanation checker
- Turns down a fixed list of unsafe phrases. It also measures how many keywords an explanation shares with its source material.The storyWhat a keyword check can and can’t say about an explanation
- Pass key check
- Checks the pass key in a way that takes the same time whether it is right or wrong. So the timing gives nothing away. On the live setup, it refuses protected calls when no key is set.
- Request models
- Pydantic, a Python tool for checking data, checks the outer shape of each request and the limit of 1 to 20 results. The values inside stay loose.
The Laravel client
Laravel HTTP client
- Requests
- Sends the request as structured text, with a pass key and a trace ID. Connecting and the whole request each have their own time limit.The storyWhat Brimfox still needs before it calls its Python service
- Retries
- Tries again after a failed connection or a server error, up to a set limit. It does not retry every failed answer.
- Results and failures
- Returns the status and how long the call took. Or it raises a clear error that tells running out of time apart from other failures.
- Request logging
- When switched on, it records the address called, the trace ID, the delay and the status. It also records the names of the data fields, never their values.
02The journey
What broke, and what changed.
Broke, then fixedA decisionA milestone
- 01 of 04Decided
Fixed weights and counts I can follow
The questionA prototype’s calculations need to be easy to follow before anyone can judge whether they help.
What I choseBoth helpers use fixed weightsBrimfox AI Core · The Python serviceRecipe orderingGives each recipe choice points for matching the search words and phrases. It adds points for ingredients on hand and for swaps that cover a gap, then sorts.See it in the map above and plain counts. That gives a starting point for testing whether they help. The ranking is not learned from data, and the checkerBrimfox AI Core · The Python serviceExplanation checkerTurns down a fixed list of unsafe phrases. It also measures how many keywords an explanation shares with its source material.See it in the map above does not check meaning.
- 02 of 04Decided
Report support counts, do not rewrite the explanation
The questionThe checkerBrimfox AI Core · The Python serviceExplanation checkerTurns down a fixed list of unsafe phrases. It also measures how many keywords an explanation shares with its source material.See it in the map above counts the keywords each part of an explanation shares with the source material. The rules are easy to follow, but shared words do not prove a claim is supported.
What I choseIt sends back support counts, which say how many parts were supported and how many were dropped. It also sends warnings and an overall result. It never sends back a cleaned-up explanation. The app can then set its own rule for when to accept a result and when to fall back.
- 03 of 04Decided
Retry only what might work next time
The questionThe caller waits for the answer before it moves on, so it waits through every retry. And a request that was refused will only be refused again.
What I choseThe Laravel clientBrimfox AI Core · The Laravel clientRequestsSends the request as structured text, with a pass key and a trace ID. Connecting and the whole request each have their own time limit.See it in the map above retries connection failuresBrimfox AI Core · The Laravel clientRetriesTries again after a failed connection or a server error, up to a set limit. It does not retry every failed answer.See it in the map above and server errors, up to a set limit. Other failures come back at once. Time spent on retries counts toward how long the caller waits.
- 04 of 04Decided
Setting up a client is not the same as using it
The questionThe service runs on its own, and Laravel has a client for it. But when I followed a recipe request through the code, nothing called the service. Explanations are still made in A technical wordPHPThe programming language that Laravel, a popular web framework, is written in., through Laravel’s own provider and its check. They still use its saved copy and its fallback answer.
What I choseI treat setting it up and using it as separate steps. The service is off unless someone switches it on. The client itself does not check that switch. So the part of the app that calls the service must check it.
03Today
Where it stands.
The next step is a recipe request that really uses the service. It needs a planned response for success and for running out of time. It also needs one for a refused pass key and for an answer it cannot use. The checkerBrimfox AI Core · The Python serviceExplanation checkerTurns down a fixed list of unsafe phrases. It also measures how many keywords an explanation shares with its source material.See it in the map above needs stricter checks on the values inside each request. A missing field can turn into the word “None”, and the pass mark accepts any value. An earlier report shows six Python tests passing.