Dev Blog: Why a Chat Client Should Return Partial Results Instead of Hard Errors
A software developer has argued against Go's conventional constructor pattern — returning either a usable object or an error — when building AI chat clients with complex configuration options. The author contends that a chat client involves many independent settings, such as temperature, credentials, and streaming support, where some may not apply to a chosen model without making the entire client unusable. Instead of failing completely, their library returns the best functional client it can build along with an itemised list of settings that could not be applied, called a 'receipt'. A hard failure is still triggered for truly fatal issues, such as missing credentials, using a sentinel error called ErrUnableToConstruct. The author emphasises that each dropped-setting error must carry enough detail — including the affected field, required capability, and reason — to allow developers to diagnose and fix the problem quickly.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in