Logs Management
ProxAI provides a way to manage logs for each API call. This is useful for debugging and monitoring. There are several ways of enabling logging shown below.
- All log files are created in the
logging_path
directory. - All log files are created when the
px.connect()
is called. - Each new log is appended to the existing log files. This means that if you run the same experiment multiple times, the logs will be appended to the existing log files.
Plain Logging
px.connect(logging_path='~/proxai-logs')
This will create following files in the logging_path
to track the logs:
~/proxai-logs/info.log
: Only info logs from ProxAI.~/proxai-logs/warnings.log
: Only warning logs from ProxAI.~/proxai-logs/errors.log
: Only error logs from ProxAI.~/proxai-logs/merged.log
: Merged info, warning, and error logs from ProxAI and the provider.~/proxai-logs/provider_queries.log
: Exact provider queries and responses.~/proxai-logs/proxdash.log
: Logs about ProxDash connection and usage.
Logging with Experiment Path
px.connect(
experiment_path='translation/en-to-fr/experiment_1',
logging_path='~/proxai-logs')
This will create same files as above but in the root logging_path directory followed by the experiment_path directory.
For example, if the logging_path is ~/proxai-logs
and the experiment_path is
translation/en-to-fr/experiment_1
, the files will be created in
~/proxai-logs/translation/en-to-fr/experiment_1/
as:
~/proxai-logs/translation/en-to-fr/experiment_1/info.log
~/proxai-logs/translation/en-to-fr/experiment_1/warnings.log
- …
Logging Options
You can also pass additional logging options to the px.connect()
function.
px.connect(
logging_path='~/proxai-logs',
logging_options=px.LoggingOptions(
stdout=True,
hide_sensitive_content=True))
logging_options
get the px.types.LoggingOptions()
object (equivalent to
px.LoggingOptions()
for simplicity).
Logging Options Parameters
Option | Type | Default Value | Description |
---|---|---|---|
logging_path | Optional[str] | None | Path of the root logging directory. • If logging_path is not set in px.connect() , this path is
used as the root logging path. • Both logging_path in px.connect() and logging_path in
px.LoggingOptions() cannot be set at the same time. It raises an
error if both are set. |
stdout | Optional[bool] | False | If True , logs are printed to the stdout. |
hide_sensitive_content | Optional[bool] | False | If True , sensitive content is excluded from logging files. This
makes debugging harder but reduces the size and increases the privacy of
the logs. Following fields are removed from logging record:• system • messages • prompt • response |