The question
The main Brimfox server is written in A technical wordPHPThe programming language that Laravel, a popular web framework, is written in. with Laravel, a tool for building web servers. One part of it writes recipe explanationsBrimfox · The serverRecipe explanationsBuilds each explanation from the recipe. A provider writes the text, and the server checks it and keeps a saved copy. If something goes wrong, there is a fallback answer to use instead.See it in the Brimfox build. Brimfox AI Core is a separate Python service with helpers for rankingBrimfox · Brimfox 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 Brimfox build and for explanations. Laravel already has a web clientBrimfox · Brimfox 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 Brimfox build, a piece of code that can send requests to it. If I switch the service on in the settings, do recipe explanations go through Python? I followed a recipe request through the code to find out. They do not.
What is already there
The Python service has its own FastAPI starting point and its own list of the code libraries it needs. It also has a container set-up for running it, and its own tests. On the Laravel side, the client is set up. It can build requests for the ranking address and for the explanation address. It sends the data as A technical wordJSONA common text format that programs use to send each other structured data., a structured text format, with an optional pass key and an ID for following the call. Connecting and the whole request each have their own time limit. It retries connection failuresBrimfox · Brimfox 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 Brimfox build and server errors while it has tries left. Laravel waits for the answer before it goes on. Nothing holds the request in a queue between the client and the recipe answer.
What is missing
What is missing is the call itself. The service is off unless someone switches it on, and switching it on is not enough. The client checks that it has a web address for the service. It does not check whether the service is switched on. And nothing on the way to a recipe answer uses the client. A recipe explanation is still made entirely in PHP, inside Laravel. It goes from the recipe details Laravel gathers to a provider, which writes the text. After that come a check on what the provider wrote, a saved copy and a fallback answer. The app needs one place that checks the setting, sends the request and decides what to do with the answer.
What still needs testing
The client’s tests use a stand-in for the service, called a mock. They check the web address, the pass key and the trace ID the client sends. They also check the answer it reads back, and what happens when no web address is set. They do not run a real exchange between Laravel and Python. They do not test the series of retries either. The test that matters starts with a real recipe request and ends with the answer the user gets. It should cover the Python service running out of time or sending back a broken answer. It should also cover the case where the service refuses the pass keyBrimfox · Brimfox AI Core · The Python servicePass key checkChecks 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.See it in the Brimfox build.