Add auto-parameter support & refactor
This commit is contained in:
parent
7192ba064a
commit
cfbbd578aa
1 changed files with 232 additions and 152 deletions
12
great_ai/src/great_ai/great_ai/parameters/log_metric.py
Normal file
12
great_ai/src/great_ai/great_ai/parameters/log_metric.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import inspect
|
||||
from typing import Any
|
||||
|
||||
from ..tracing import TracingContext
|
||||
|
||||
|
||||
def log_metric(argument_name: str, value: Any) -> None:
|
||||
context = TracingContext.get_current_context()
|
||||
caller = inspect.stack()[1].function
|
||||
actual_name = f"metric:{caller}:{argument_name}"
|
||||
if context:
|
||||
context.log_value(name=actual_name, value=value)
|
||||
Loading…
Reference in a new issue