0
0
Prompt Engineering / GenAIml~20 mins

First interaction with GenAI APIs - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GenAI API Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding GenAI API Response Structure

When you send a prompt to a GenAI API, what is the typical structure of the response you receive?

AA JSON object containing the generated text, usage details, and metadata about the request
BA binary file that needs special decoding to extract the generated text
CAn XML file with multiple nested tags describing the model internals
DA plain text string with only the generated text and no additional information
Attempts:
2 left
💡 Hint

Think about what extra information might be useful besides just the generated text.

Predict Output
intermediate
2:00remaining
Output of a GenAI API Call with a Simple Prompt

What will be the output of this Python code snippet that calls a GenAI API with a prompt?

Prompt Engineering / GenAI
response = {
    'choices': [{'message': {'content': 'Hello, how can I help you today?'}}],
    'usage': {'prompt_tokens': 5, 'completion_tokens': 7, 'total_tokens': 12}
}
print(response['choices'][0]['message']['content'])
AKeyError
Bresponse
C{'message': {'content': 'Hello, how can I help you today?'}}
DHello, how can I help you today?
Attempts:
2 left
💡 Hint

Look at how the dictionary keys are accessed to get the message content.

Model Choice
advanced
2:00remaining
Choosing the Right GenAI Model for Summarization

You want to use a GenAI API to summarize long articles quickly and accurately. Which model type should you choose?

AA small model optimized for image recognition
BA general-purpose language model trained only on chat conversations
CA large language model fine-tuned specifically for summarization tasks
DA model designed for speech-to-text transcription
Attempts:
2 left
💡 Hint

Think about which model is trained for text summarization.

Hyperparameter
advanced
2:00remaining
Effect of Temperature Parameter in GenAI API Calls

What happens if you increase the temperature parameter in a GenAI API call?

AThe output text becomes shorter and more concise
BThe generated text becomes more random and creative
CThe API call fails with an error
DThe model runs faster but with less accuracy
Attempts:
2 left
💡 Hint

Temperature controls randomness in text generation.

Metrics
expert
2:00remaining
Interpreting Token Usage Metrics from GenAI API

After a GenAI API call, you receive usage metrics: prompt_tokens=50, completion_tokens=150, total_tokens=200. What does this tell you?

AThe model used 50 tokens from your prompt and generated 150 tokens in response, totaling 200 tokens processed
BThe model generated 50 tokens and used 150 tokens from the prompt, totaling 200 tokens
CThe total tokens count is incorrect because 50 + 150 does not equal 200
DThe model only processed 150 tokens in total
Attempts:
2 left
💡 Hint

Think about what prompt and completion tokens represent.