Localizer Project

You’ve learned about memory, structured output, and human-in-the-loop interactions. These are all things you can apply to your app string localizer project. This segment will summarize the changes, and in the next section, you’ll implement them.

Memory

Your app state is already taken care of with your custom State object and the StateGraph, but you’ll still need to implement checkpoints to add a breakpoint for human-in-the-loop interaction.

Structured Output

You eventually want the translated app strings to be in a format appropriate for Android, iOS, Flutter, or whatever your framework requires. For Android, the strings should be in XML format in a strings.xml file. And for iOS, the format should be key-value pairs in a .strings file. Forcing the output to be a Pydantic model or a TypedDict isn’t super useful for either of those formats, so you won’t go that route. However, you can still write a custom LLM prompt to get your formatter node to output the right format.

Human-in-the-Loop

While the translator-checker cycle was interesting in Lesson 3, you’ll replace that workflow with a human-in-the-loop. The checker will pass any dubious translations to a human to verify or improve. The image below shows the old architecture on the left and the new architecture on the right:

Checker Checker Contextualizer Contextualizer Translator Translator Formatter Formatter Human

You’ll also use a different screenshot with different app strings. The screenshot you’ll use this time is the image below:

The text on this screen could be ambiguous, even for a native speaker. What does “Would you like to save the puppy” mean? Is this a drawing program where the dialog is asking whether you want to save the current state? Or is it asking whether you want to save the puppy from something dangerous like drowning? They’re the same word in English, but in Spanish and many other languages, those are different words. So, the meaning makes a difference.

Which meaning do you think the AI agent will choose?

Whichever it chooses, you’ll see if you can get it to sufficiently doubt itself enough to be willing to ask a human. Thankfully, Fernando, the tech editor and native Spanish speaker, is here to help. Given the fact that the app developer actually meant to ask whether the user wants to save the puppy from something dangerous, Fernando will be able to set the AI agent on the right path.

See forum comments
Download course materials from Github
Previous: Human-in-the-Loop Demo Next: Localizer Project Demo