autogen/website/docs/Use-Cases/enhanced_inference.md
Templating  If the provided prompt or message is a template, it will be automatically materialized with a given context. For example,  ```python response = client.create(     context={"problem": "How many positive integers, not exceeding 100, are multiples of 2 or 3 but not 4?"},     prompt="{problem} Solve the problem carefully.",     allow_format_str_template=True,     **config ) ```  A template is either a format str, like the example above, or a function which produces a str from several input fields, like the example below.  ```python def content(turn, context):     return "\n".join(         [             context[f"user_message_{turn}"],             context[f"external_info_{turn}"]         ]     )  messages = [     {         "role": "system",         "content": "You are a teaching assistant of math.",     },     {         "role": "user",         "content": partial(content, turn=0),     }, ] context = {     "user_message_0": "Could you explain the solution to Problem 1?",     "external_info_0": "Problem 1: ...", }  response = client.create(context=context, messages=messages, **config) messages.append(     {         "role": "assistant",         "content": client.extract_text(response)[0]     } ) messages.append(     {         "role": "user",         "content": partial(content, turn=1),     }, ) context.append(     {         "user_message_1": "Why can't we apply Theorem 1 to Equation (2)?",         "external_info_1": "Theorem 1: ...",     } ) response = client.create(context=context, messages=messages, **config) ```