๐งชTDD Challengeยทbeginnerยทโฑ๏ธ 10โ20mยทโญ 75 XP
M-003Build Your First LLM Prompt
Description
Nebula Corp's new intern needs to send their first request to an LLM API, but the prompt builder function is incomplete. It should take a user question and a system persona, then return a properly structured messages array that any LLM API can consume. The function currently returns an empty array. Wire it up so it produces the correct chat-completion message format with a system message and a user message.
Test Cases (3)
Returns correct message structure
Should return array with system and user messages
Input:buildPrompt('You are a helpful assistant', 'What is AI?')
Expected:CONTAINS_ALL:system,user,You are a helpful assistant,What is AI?
Estimates tokens correctly
28 chars / 4 = 7 tokens
Input:countTokensEstimate('Hello world! This is a test.')
Expected:7
Includes context in prompt
User message should contain both context and question
Input:buildPromptWithContext('Assistant', 'The sky is blue', 'What color is the sky?')
Expected:CONTAINS_ALL:Context,Question,sky is blue,What color
Related Lessons
Click Run / Check to validate your solution