Tracing (Manual)
Logging Prompt Templates & Variables
Integrating Prompt Templates into Spans
By instrumenting the prompt template, users can fully utilize Future AGI’s prompt playground. There’s no need to deploy a new template version to test if changes in prompt text or variables achieve the desired effect. Instead, you can experiment with these modifications directly in the playground UI.
Implementation Details
We provide a using_prompt_template
context manager to add a prompt template into the current OpenTelemetry Context. FI auto-instrumentors will read this Context and pass the prompt template fields as span attributes, adhering to the traceAI semantic conventions.
Required Parameters
Parameter | Type | Description | Example |
---|---|---|---|
template | str | The string for the prompt template | ”Please describe the weather forecast for on “ |
version | str | Identifier for the template version | ”v1.0” |
variables | Dict[str] | Dictionary containing variables to fill the template | {"city": "San Francisco", "date": "March 27"} |
Sample Implementation
Begin by installing the necessary dependencies:
Below is a comprehensive example demonstrating how to implement prompt template tracing: