Japanese-English Broker LLM Middleware
A two-call pipeline that reasons over Japanese input in English before translating the result back to Japanese. A legal-domain PoC that handles ambiguous input with a clarifying-question loop.
Duration
Short-term development
Team
1 person
01 // OVERVIEW
Project Overview
A two-call middleware PoC that, rather than passing Japanese input directly to the LLM, first has the model reason in English and then translates the result back into Japanese. It aims to raise output quality in domains where the model reasons more accurately in English, and is designed with the legal domain in mind.
02 // KEY FEATURES
Key Features
Two-Call JA-to-EN Reasoning, EN-to-JA Translation Pipeline
Call 1 reads the Japanese input and generates reasoning and an answer in English; Call 2 translates that English answer back into Japanese. Designed to preserve the user's writing style and level of politeness during translation.
Ambiguity Detection and Clarifying-Question Loop
If Call 1 detects ambiguity in the input, it returns a clarifying question in Japanese instead of an answer. The user can either answer the question or choose to "proceed as is," preventing incorrect answers from being given on ambiguous input.
Switchable Mock/Live Configuration
The LLM_PROVIDER setting toggles between an offline mock mode and real OpenAI calls. All services launch via Docker Compose, allowing functionality to be verified even without an API key.
03 // TECHNICAL DEEP-DIVE
Technical Highlights
Solution
Trade-off Between Translation Quality and Latency
The two-call setup increases latency, but we confirmed that in domains requiring high precision, such as legal documents, output quality is more stable than with a single call. The design also allows the clarifying-question loop to be quickly verified using mock mode.
04 // IMPACT & RESULTS
Results
2 calls
LLM invocations per query
Ambiguity detection
Returns a clarifying question for unclear input
Docker-based
Full stack runs in a local environment