Skip to main content

Basic monitoring is only available for prompts retrieved directly from Basalt using the get method. This approach is designed for simple use cases where you’re using a single prompt and not complex workflows. For advanced monitoring scenarios, please refer to the Tracing documentation.

Basic Usage

When you retrieve a prompt using the SDK, it automatically includes a generation object that can be used to monitor the complete interaction. Here’s how to use it:
This simple pattern automatically tracks:

User and Organization Identification

You can associate the generation with a specific user and organization by using the identify method:

Evaluation

You can add automatic evaluators to assess the quality of the LLM output:
Evaluators run automatically when generation.end() is called. For more information on available evaluators and how to create custom ones, see the Evaluation documentation.

Evaluation Configuration

By default, evaluations are run on 10% of logs. You can configure the evaluation sample rate to control how often evaluations are run.

Complete Example

Here’s a complete example showing how to use basic monitoring with variables, user identification, and automatic evaluation:

Advanced Use Cases

Basic monitoring is suitable for simple scenarios where you’re using a single prompt. For more advanced use cases, such as: Please refer to the Tracing documentation, which provides comprehensive tools for these scenarios.