Guide-linked quiz · Medium Level
How to Build a Chatbot with an LLM API Quiz
Build a chatbot around an API request loop, state and provider differences, streaming, tool execution, token limits, and safe error handling.
Question 1 of 8
In a client-managed Chat Completions flow, what context is commonly sent on each new turn?
Preview every question8 questions
Answers and explanations appear as you take the quiz.
- In a client-managed Chat Completions flow, what context is commonly sent on each new turn?
- Only the newest user message
- The full array of prior messages plus the new one
- A compressed binary session token
- Just the system prompt
- In a client-managed, stateless chat flow, why can the bot refer to earlier turns?
- The model stores a session on the provider's server automatically
- The client resends the full message history on every call
- The API caches embeddings of prior turns
- The model has a persistent memory across all users
- According to the guide, what is the main practical benefit of streaming responses in a chatbot?
- It reduces the total token cost of the request
- It allows the model to skip the system prompt
- It improves perceived speed by rendering text as it arrives
- It removes the need for error handling
- According to the guide, what should trigger exponential backoff rather than an immediate retry?
- A successful 200 response
- Rate limit errors (429) and transient server errors (5xx)
- Any assistant message longer than expected
- A user typing a new message
- How does tool calling get incorporated into the basic chatbot loop?
- The model executes the function itself on the provider's servers
- The application runs the requested function and appends its result as a message before calling the model again
- Tool calls replace the system prompt entirely
- The client must switch to a different API endpoint
- For a new OpenAI chatbot, what API and conversation-state approach does current documentation recommend?
- Chat Completions is no longer supported
- Responses is recommended for new projects; Chat Completions remains supported and commonly uses client-supplied message history
- Responses can only accept one user turn
- Both APIs always store the same server-side conversation
- Why is counting characters or words insufficient for managing a chatbot's context window?
- Context limits are enforced in tokens, which don't map directly to characters or words
- Characters are always more expensive than tokens
- The API rejects any request with punctuation
- Word counts are only relevant for streaming
- According to the guide, what is a recommended strategy when a conversation's message array grows too large for the context window?
- Delete the system prompt to save space
- Trim or summarize older turns before the limit is reached
- Switch every message to the assistant role
- Stop streaming responses
Keep testing yourself
More quizzes picked for your level.