vibe.metadata¶
Template metadata access system.
Provides a self-documenting namespace for accessing session, template, and assistant metadata from within Jinja2 templates.
Usage in templates
{{meta.session_id}} - Interview session UUID {{meta.now()|strftime('%Y-%m-%d')}} - Current timestamp {{meta.template.name}} - Template identifier {{meta.assistant.kravspec.turns}} - Assistant turn count {{meta.phase}} - Processing phase (PROBING or RENDERING)
Design principles: - Functions (): Compute/generate new values (e.g., now()) - Properties: Access existing data/state (e.g., session_id) - Strict errors: Raise ValueError when metadata unavailable during rendering - Graceful during probing: Return "N/A" when session not available
MetadataNamespace ¶
Root metadata namespace for template access.
Provides access to session, template, and assistant metadata through a self-documenting interface.
| Attributes: |
|
|---|
Methods:
-
now–Returns current datetime object
session_id ¶
session_id: str
Interview session UUID.
| Returns: |
|
|---|
| Raises: |
|
|---|
template ¶
template: TemplateMetadata
Template information (name, version, mode).
| Returns: |
|
|---|
assistant ¶
assistant: AssistantNamespace
Dynamic namespace for accessing assistant metadata by name.
Usage
{{meta.assistant.kravspec.turns}} {{meta.assistant.legal_review.tokens}}
| Returns: |
|
|---|
__init__ ¶
__init__(session_data: Mapping[str, Any] | None, template: TemplateData, phase: ProcessingPhase) -> None
Initialize metadata namespace.
| Parameters: |
|
|---|
now ¶
now() -> datetime
Return current timestamp as datetime object.
Use with Jinja filters for formatting
{{meta.now()|strftime('%Y-%m-%d %H:%M')}} {{meta.now().isoformat()}}
| Returns: |
|
|---|
TemplateMetadata ¶
Template metadata accessor.
Provides access to template properties like name, version, and mode.
| Attributes: |
|
|---|
name ¶
name: str
Template identifier.
| Returns: |
|
|---|
version ¶
version: str
Version identifier.
| Returns: |
|
|---|
__init__ ¶
__init__(template: TemplateData) -> None
Initialize template metadata.
| Parameters: |
|
|---|
AssistantNamespace ¶
Dynamic namespace for assistant metadata access.
Supports attribute access by assistant name. Each assistant name accessed returns an AssistantMetadata instance for that assistant.
Usage
meta.assistant.kravspec -> AssistantMetadata('kravspec') meta.assistant.legal_review -> AssistantMetadata('legal_review')
Attributes are resolved dynamically via getattr.
__init__ ¶
__init__(session_data: Mapping[str, Any] | None, template: TemplateData, phase: ProcessingPhase) -> None
Initialize assistant namespace.
| Parameters: |
|
|---|
AssistantMetadata ¶
Metadata for a specific assistant instance.
Provides access to assistant-specific data like turn count, token usage, endpoint name, and session ID.
| Attributes: |
|
|---|
turns ¶
turns: int
Number of turns/interactions with this assistant.
| Returns: |
|
|---|
tokens ¶
tokens: int
Total tokens consumed by this assistant.
| Returns: |
|
|---|
cost ¶
cost: str
Total cost for this assistant as a formatted string.
| Returns: |
|
|---|
average_tft ¶
average_tft: float
Average time-to-first-token across all turns with this assistant.
| Returns: |
|
|---|
average_tlt ¶
average_tlt: float
Average time-to-last-token across all turns with this assistant.
| Returns: |
|
|---|
endpoint ¶
endpoint: str
LLM endpoint/provider name.
First checks for dev override (if in debug mode), then tries session state (runtime value), then falls back to template config (static configuration).
| Returns: |
|
|---|
| Raises: |
|
|---|
session_id ¶
session_id: str
Assistant-specific session ID.
Note: This is different from the interview session ID. Each assistant has its own session ID for tracking assistant interactions.
| Returns: |
|
|---|
__init__ ¶
__init__(session_data: Mapping[str, Any], assistant_name: str, template: TemplateData, is_placeholder: bool = False) -> None
Initialize assistant metadata.
| Parameters: |
|
|---|