Skip to content

Reusable Prompts with variables #398

Discussion options

You must be logged in to vote

First you'll need to create the prompt in the playground, then copy that id there.

Then you'll pass it in the CreateReponse constructor:

var conversation = new List<IResponseItem>
{
    new Message(Role.User, "{{customer_name}} purchased {{product}}. What are some other recommendations we can give this customer?"),
};
var request = new CreateResponseRequest(
    input: conversation,
    model: Model.GPT4_1_Nano,
    prompt: new Prompt("pmpt_abc123", new Dictionary<string, object>
    {
        { "customer_name", "Jane Doe" },
        { "product", "40oz juice box" }
    }));
var response = await OpenAIClient.ResponsesEndpoint.CreateModelResponseAsync(request);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArnaudC2Care
Comment options

Answer selected by ArnaudC2Care
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants