Adapter Configurations#
You can set up the following adapters for tracing.
The following table summarizes the list of adapters supported by NeMo Guardrails and their use cases.
Adapter Type |
Use Case |
Configuration |
---|---|---|
Development, debugging, local logging |
|
|
Production, monitoring platforms, distributed systems |
Requires SDK configuration |
|
Specialized backends or formats |
Implement |
The following sections explain how to configure each adapter in config.yml
.
FileSystem Adapter#
For development and debugging, use the FileSystem
adapter to log traces locally.
tracing:
enabled: true
adapters:
- name: FileSystem
filepath: "./logs/traces.jsonl"
OpenTelemetry Adapter#
For production environments with observability platforms.
tracing:
enabled: true
adapters:
- name: OpenTelemetry
Important
OpenTelemetry requires additional SDK configuration in your application code. See the sections below for setup instructions.
Custom Adapter#
You can create custom adapters and use them in your application code.
Create custom adapters for specialized backends or formats for your use case.
from nemoguardrails.tracing.adapters.base import InteractionLogAdapter class MyCustomAdapter(InteractionLogAdapter): name = "MyCustomAdapter" def __init__(self, custom_option: str): self.custom_option = custom_option def transform(self, interaction_log): # Transform logic for your backend pass
Register the adapter in
config.py
.from nemoguardrails.tracing.adapters.registry import register_log_adapter register_log_adapter(MyCustomAdapter, "MyCustomAdapter")
Use the adapter in
config.yml
.tracing: enabled: true adapters: - name: MyCustomAdapter custom_option: "value"