Messages, roles, and the response — the call AI ships every time — step 8 of 9
Build the stub of a real LLM call. Write a function called ask that
takes a single string question, builds a messages list with one
user turn, calls the provided fake_create(messages) to simulate the
API, and returns the text from response["content"][0]["text"].
Then call ask("What's 2 + 2?") and print the result.
Expected output:
4
Build the stub of a real LLM call. Write a function called ask that
takes a single string question, builds a messages list with one
user turn, calls the provided fake_create(messages) to simulate the
API, and returns the text from response["content"][0]["text"].
Then call ask("What's 2 + 2?") and print the result.
Expected output:
4
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.