Models, Retrieval, Tools, and Control Flow › Partial results and graceful degradation
Language AI HandbookAll chapters A partial answer promises a narrower result. The assistant can explain which catalog rows matched the constraints even when it cannot answer whether a physical unit is in stock. A stock count of zero in the fixture is a complete result about availability. A stock state of unknown is a partial result. A query with no eligible catalog candidates abstains from making a recommendation.
The UI can check the outcome before showing a stock indicator. For the partial result, show the matched product and mark stock unknown. For the zero-stock result, show the count from the available fixture. The trace still gives you enough detail to diagnose whether the missing component was search, generation validation, or inventory.
PythonIn [24]Expand
zero_stock = run_assistant(QUERY, {})
assert zero_stock.outcome is Outcome.COMPLETE
assert zero_stock.product_ids == partial.product_ids
assert "0 in stock" in zero_stock.text
print(zero_stock.outcome.value, zero_stock.text)
print(partial.outcome.value, partial.text)ConsoleOut [24]Expand
complete Trail Runner Pro at $110. Size 10: p1: 0 in stock. partial Trail Runner Pro at $110. Stock is unknown.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!