logs
log
Can be used either as a regular function to create logs or as a decorator to log function inputs, intermediates and outputs.When used as a regular function: Creates one or more logs associated to a project. unify.Logs are LLM-call-level data that might depend on other variables.When used as a decorator: Logs function inputs and intermediate values.
Arguments:
fn
- When used as a decorator, this is the function to be wrapped.project
- Name of the project the stored logs will be associated to.context
- Context for the logs.params
- Dictionary containing one or more key:value pairs that will benew
- Whether to create a new log if there is a currently active global log.overwrite
- If adding to an existing log, dictates whether or not to overwritemutable
- Either a boolean to apply uniform mutability for all fields, or a dictionary mapping field names to booleans for per-field control. Defaults to True.api_key
- If specified, unify API key to be used. Defaults to the value in theentries
- Dictionary containing one or more key:value pairs that will be logged
Returns:
When used as a regular function: The unique id of newly created log. When used as a decorator: The wrapped function.