@track
Decorator which creates a Pay-i instrumentation scope. Every inference request in this scope will be instrumented by Pay-i with the properties defined
To use @track effectively, you must also understand how python decorators are evaluted. @track is called once when the decoratored function is defined and NOT each time the decorated function is called. For instance the following example, @track() is called when do_work() declared on line 4, generating one random use_case_id value that will be shared across all calls to do_work(). In other words, @track()is not called when do_work() is called on lines 8 and 9.
from random import random
@track(use_case_name="example", use_case_id=str(random()))
def do_work():
# inference calls
...
do_work()
do_work()All parameters are optional and default to None
| Parameter | Type | Notes |
|---|---|---|
limit_ids | list[str] | |
use_case_name | str | |
use_case_id | str | If Noneand the passed use_case_name 1. creates a new payi instrumentation scope 2. or is different value comapred to the current payi instrumentation scope Then in a new use_case_id will be automatically generated for the new payi instrumenation scope. This evaluation occurs every time the decorated function (do_work() in the example) is called. |
use_case_version | int | |
user_id | str | |
account_name | str | |
request_properties | dict[str, str] | |
use_case_properties | dict[str, str] | |
log_prompt_and_response | bool | Overrides the global log_prompt_and_response setting created by payi_instrument() |