What happens in an LLM API call
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
understand what your code sends and receives.
Planned topics
- An LLM API is an HTTP call: you send a list of messages, you get a reply message back.
- A system message sets the rules and role. User messages carry the request. Earlier assistant messages are context.
- Model parameters such as temperature (randomness) and a maximum output length shape the reply.
- Text is counted in tokens (word pieces). Cost and limits depend on input plus output tokens.
- Output is probabilistic: the same input can give different text, so never assume the format.
Draft outline details
Demonstration
{ "model": "<configured>",
"messages": [
{"role":"system","content":"You write short product descriptions."},
{"role":"user","content":"Wireless mouse, 2.4 GHz, black"} ],
"max_tokens": 150 }Check your understanding
What do you pay for?
Show answer
Tokens sent and tokens received.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.