Questionário vinculado ao guia · Médio Nível

Como construir um chatbot com um questionário de API LLM

Crie um chatbot em torno de um loop de solicitação de API, diferenças de estado e de provedor, streaming, execução de ferramentas, limites de token e tratamento seguro de erros.

Caminhos de guia relacionadosComo construir um chatbot com uma API LLM
Pergunta 1 de 8

Em um fluxo de conclusões de bate-papo gerenciado pelo cliente, qual contexto geralmente é enviado em cada novo turno?

Visualize cada pergunta8 perguntas

As respostas e explicações aparecem conforme você responde ao teste.

  1. Em um fluxo de conclusões de bate-papo gerenciado pelo cliente, qual contexto geralmente é enviado em cada novo turno?
    • Only the newest user message
    • The full array of prior messages plus the new one
    • A compressed binary session token
    • Just the system prompt
  2. Em um fluxo de chat sem estado e gerenciado pelo cliente, por que o bot pode se referir a turnos anteriores?
    • 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
  3. De acordo com o guia, qual é o principal benefício prático de transmitir respostas em um 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
  4. De acordo com o guia, o que deveria desencadear uma espera exponencial em vez de uma nova tentativa imediata?
    • 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
  5. Como a chamada de ferramenta é incorporada ao ciclo básico do chatbot?
    • 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
  6. 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
  7. 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
  8. 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