aiq.profiler.utils#
Attributes#
Functions#
Analyze a function's source (the build_fn) to see which LLM frameworks it uses. Also recurses |
|
|
Merge usage stats for all requests into one DataFrame, each row representing a usage_stats entry. |
Module Contents#
- _FRAMEWORK_REGEX_MAP#
- logger#
- detect_llm_frameworks_in_build_fn(
- registration: aiq.cli.type_registry.RegisteredFunctionInfo,
Analyze a function’s source (the build_fn) to see which LLM frameworks it uses. Also recurses into any additional Python functions that the build_fn calls while passing
builder
, so that references to LLMFrameworkEnum in those helper calls are also detected.If
registration.framework_wrappers
is non-empty, we return that first. (We do convert them to LLMFrameworkEnum if possible.)Otherwise, we attempt to:
Get the build_fn’s source via
inspect.getsource(...)
Parse it for references to LLMFrameworkEnum
Find any function calls that include the word “builder” in the arguments
Recursively parse those functions’ source code for frameworks
If we cannot parse the source at all (e.g. OSError), we return a list of all frameworks.
- create_standardized_dataframe(
- requests_data: list[list[aiq.data_models.intermediate_step.IntermediateStep]],
Merge usage stats for all requests into one DataFrame, each row representing a usage_stats entry. - Include a column ‘example_number’ to mark which request it originated from.