Model APIs

Lesson 15 of 16

Quiz · 10 min

Quiz, Model APIs

Choose an answer for each question. Some questions have more than one right answer.

Question 1 of 14

A program classifies the comments of riders. The rules for the labels are the same for each call. Which message holds the rules?

Question 2 of 14

Which statements about tokens are true? Choose all that apply.

Choose all answers that apply.

Question 3 of 14

A response has this stop reason. What does it tell you?

response["stop_reason"]   # "max_tokens"
Question 4 of 14

A call uses 4,000 input tokens and 1,000 output tokens. The input price is 3 dollars for 1,000,000 tokens, and the output price is 12 dollars for 1,000,000 tokens. What does the call cost?

Question 5 of 14

Why does the model not know the name in the second call?

client.chat([{"role": "user", "content": "My name is Rosa."}])
client.chat([{"role": "user", "content": "What is my name?"}])
Question 6 of 14

A chat program sends the complete history with each call. What happens in a long conversation? Choose all that apply.

Choose all answers that apply.

Question 7 of 14

A program compares the answer of the model with the text "complaint". Which setting and which step make the comparison reliable?

Question 8 of 14

Which instructions give an answer that a program can read with json.loads most reliably?

Question 9 of 14

Your program allows the labels praise, complaint, question and other. The model gives this answer. json.loads reads it without an error. What does the program do?

{"label": "unclear", "reason": "The comment is short."}
Question 10 of 14

For which errors can a new try of the same call work? Choose all that apply.

Choose all answers that apply.

Question 11 of 14

A function tries a call up to 4 times. After each failure with a ServerError, it waits for min(2 ** attempt, 30) seconds, and attempt starts at 0. The first three calls fail, and the fourth call works. For how many seconds did the function wait in total?

Question 12 of 14

Where does the API key of a real service belong?

Question 13 of 14

A program processes 5,000 comments in a loop, with one call for each comment. Call number 3,200 raises a ServerError, and the loop has no try. What happens?

Question 14 of 14

On a test set of 200 comments, a small model gives 172 right labels, and a large model gives 190. The large model costs 12 times more for each call. Which statement is correct?

Answer every question to check.