Operation Type and Prompt Version
Operation Type is a user-defined label for grouping and filtering LLM calls by business context. The label you specify becomes part of the metric tags, so you can analyze various metrics by your own unit.
Prompt Version is a user-defined label that indicates which revision of the prompt text was used within an operation_type. If operation_type answers "what does this call do" (business unit), prompt_version answers "which prompt did this call use" (revision unit).
Operation Type and Prompt Version labeling supports the Python agent only.
How to use
from whatap.llm import prompt_meta
@prompt_meta(operation_type='checkout_chain', prompt_version='v3')
def checkout(question):
return client.chat.completions.create(...)
from whatap.llm import prompt_meta_scope
def handler(req):
with prompt_meta_scope(operation_type='greeting', prompt_version='v2'):
return client.chat.completions.create(...)
from whatap.llm import get_prompt_meta
op_type, version = get_prompt_meta() # Returns ('default', 'v1') if there is no scope
When you do not specify values
When there is no label, operation_type is automatically replaced with the name of the enclosing workflow or agent. Whether the prompt text has been revised, however, is information the WhaTap agent cannot know, so prompt_version is recorded with the value of llm_prompt_default_version. If you do not set this option, it is recorded as v1.
Changing the prompt version in bulk
If you revised prompts in bulk but it is hard to touch every decorator, move the default version in whatap.conf. Calls that already carry an explicit label are not affected.
llm_prompt_default_version=v2
The setting is applied at runtime, so the new default applies from the next call without a restart.