0
0
Prompt Engineering / GenAIml~20 mins

Chat completions endpoint in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Chat Completions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the role of system messages in chat completions

In the chat completions endpoint, what is the primary purpose of the system message?

ATo specify the output format of the AI's response
BTo represent the user's input or question to the AI
CTo store the AI's previous responses for reference
DTo provide instructions or context that guide the AI's behavior throughout the conversation
Attempts:
2 left
💡 Hint

Think about which message sets the tone or rules for the AI's replies.

Predict Output
intermediate
2:00remaining
Output of a chat completion request with multiple messages

Given the following chat messages sent to the chat completions endpoint, what will be the role and content of the AI's first response message?

Prompt Engineering / GenAI
messages = [
  {"role": "system", "content": "You are a helpful assistant."},
  {"role": "user", "content": "What is 2 + 2?"}
]

# The AI responds based on these messages.
A{"role": "assistant", "content": "2 + 2 equals 4."}
B{"role": "user", "content": "2 + 2 equals 4."}
C{"role": "system", "content": "2 + 2 equals 4."}
D{"role": "assistant", "content": "I don't understand the question."}
Attempts:
2 left
💡 Hint

The AI replies as the assistant role with an answer to the user's question.

Model Choice
advanced
2:00remaining
Choosing the best model for a chat completion task

You want to build a customer support chatbot that can handle complex questions and maintain context over multiple turns. Which model is best suited for this task?

AA large chat-optimized model trained for multi-turn conversations
BA small, fast model optimized for single-turn question answering
CA model specialized in image recognition
DA model designed only for text summarization
Attempts:
2 left
💡 Hint

Consider which model type is designed for conversations with context.

Hyperparameter
advanced
2:00remaining
Effect of temperature parameter in chat completions

What is the effect of increasing the temperature parameter in a chat completions request?

AThe AI's responses become shorter and more concise
BThe AI's responses become more random and creative
CThe AI ignores the system message instructions
DThe AI always repeats the same response
Attempts:
2 left
💡 Hint

Think about how randomness affects AI text generation.

Metrics
expert
3:00remaining
Evaluating chat completion quality with perplexity

You have two chat completion models. Model A has a perplexity of 15 on your test set, and Model B has a perplexity of 30. What does this tell you about their performance?

ABoth models perform equally well
BModel B predicts the test data better and is more confident in its responses
CModel A predicts the test data better and is more confident in its responses
DPerplexity measures response length, so Model B produces longer answers
Attempts:
2 left
💡 Hint

Lower perplexity means better prediction of the data.