Log Prompt Templates & Variables
Last updated
Last updated
Copyright © 2023 Arize AI, Inc
By instrumenting the prompt template, users can take full advantage of the Arize prompt playground. You don't need to deploy a new template version in order to see if prompt text or prompt variables changes have the intended effect. Instead, you can experiment with these changes in the playground UI.
We provide a using_prompt_template context manager (example below) to add a prompt template to the current OpenTelemetry Context. OpenInference auto-instrumentors will read this Context and pass the prompt template fields as span attributes, following the OpenInference semantic conventions. The interface expects the following:
template
str
"Please describe the weather forecast for {city} on {date}"
version
str
"v1.0"
variables
Dict[str]
{"city": "Johannesburg", "date":"July 11"}
Refer to the code below for a working example: