Bird
Raised Fist0
Agentic AIml~10 mins

Code generation agent design in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the agent's model with a transformer architecture.

Agentic AI
agent_model = TransformerModel([1]=512, num_layers=6)
Drag options to blanks, or click blank then click option'
Alearning_rate
Bdropout_rate
Cbatch_size
Dhidden_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'learning_rate' instead of 'hidden_size' here.
Confusing 'batch_size' with model architecture parameters.
2fill in blank
medium

Complete the code to tokenize input text before feeding it to the agent.

Agentic AI
tokens = tokenizer.[1](input_text)
Drag options to blanks, or click blank then click option'
Aencode
Bdecode
Cgenerate
Dtrain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'decode' which converts tokens back to text.
Using 'generate' which is for producing output, not tokenizing.
3fill in blank
hard

Fix the error in the code to correctly generate code output from the agent.

Agentic AI
generated_code = agent.[1](input_tokens)
Drag options to blanks, or click blank then click option'
Atrain
Bgenerate_code
Cpredict
Dcompile
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'train' which is for learning, not generating output.
Using 'generate_code' which is not a standard method name.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps function names to their code strings if the code length is less than 50.

Agentic AI
code_map = {func_name: [1] for func_name, [2] in functions.items() if len(code) < 50}
Drag options to blanks, or click blank then click option'
Acode
Bfunc_code
Ccode_str
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names for the code string.
Confusing keys and values in the dictionary comprehension.
5fill in blank
hard

Fill all three blanks to filter and map functions with names starting with 'gen' and code length over 30.

Agentic AI
filtered_funcs = { [1]: [2] for [3], code in all_functions.items() if [3].startswith('gen') and len(code) > 30 }
Drag options to blanks, or click blank then click option'
Aname
Bfunc_name
Ccode
Dfunc_code
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not matching the loop variables with the condition variables.