Give the model a focused context
An assistant is more useful when it receives a small, curated profile or document context instead of an entire codebase. Keep the context current, structured, and limited to information the user should be allowed to see.
Stream the response
Streaming makes the interface feel responsive and lets users stop an unhelpful answer early. The server should still handle timeouts, cancellation, rate limits, and provider errors explicitly.
Design for uncertainty
Prompt instructions cannot guarantee perfect answers. Link answers to trusted source material where possible, avoid making claims about data the system has not received, and provide a clear path to contact a human.
Protect the boundary
Never place provider credentials in browser code. Validate incoming messages, limit request size, log failures without storing sensitive content unnecessarily, and apply abuse controls before the endpoint becomes public.
