Skip to main content
Prerequisite Please see here to get and set your API Key environment variable.
Install the Lytix pip package

Error Capturing

Error Class

You can now just replace all your raise Exception calls with raise LError. For example:
The error, along with the last 20 log lines will automatically get pushed to the Lytix platform here title

Error Increment

You can also send an error along with related logs without throwing an error by using the increment method.

Fast API Integration

Lytix also supports capturing errors in FastAPI. To get started first hook up our Lytix middleware:
Now you can throw errors in your FastAPI routes or subcalls as follows:

Examples

To see all examples please check the Github repo here

LLM Model Input Output Collection

Lytix supports automatically collecting the input and output of LLM models. To do this you can use the following
Lytix will automatically process the input and output of the LLM model and push the metrics to the Lytix platform. You can see your model metrics in the Lytix platform here.

LLM Model Trace Collection

Lytix also supports capturing trace information (e.g. duration) for the LLM model. To do this you can use the following
You’ll now see the model duration trace in the Lytix platform here. title

LLM Model Logs Collection

Similar to traces, we can also capture logs when a model is called. This will auto push the logs to the Lytix platform and associated with this trace
captureModelLogsExample

Model IO event with associated logs

Manual Metric Collection

You always have the option to manually push metrics to the Lytix platform with custom names and metadata. The following example pushes a metric to the Lytix platform with the name testMetic and the value 1 along with the env: prod metadata.
You then have access to that on the Lytix platform and can filter on any of the metadata passed. title