Skip to main content

profile_api

Function
This function is defined in the profiler module.
Decorator to profile a function as an API call.

Signature

def profile_api(func: Optional[Callable]) -> Any

Parameters

func
Optional
No description available.

Returns

Returns
Any
The result of the operation.

Usage

@profile_api(endpoint="openai/chat")
    def call_openai():
        pass

Uses

  • Profiler.is_enabled
  • fn
  • time.perf_counter
  • Profiler.record_api_call
  • functools.wraps
  • decorator

Source

View on GitHub

praisonai/profiler.py at line 1010