Skip to main content
Sometimes the data you want to monitor isn’t available at inference time. Openlayer lets you update existing traces after they were streamed to the platform. Common use cases:
  • Adding ground truths that only became available later.
  • Logging human feedback (e.g., thumbs up/down, ratings).
  • Attaching business signals such as conversions or revenue impact.

How updates work

Every trace streamed to Openlayer has an inference_id, which is a unique identifier.
  • If you provide your own inference IDs, you can easily reference and update those traces later.
  • If you don’t, Openlayer auto-generates them for you.
For maximum flexibility, set custom inference IDs when tracing. This makes it simple to tie traces to feedback, business outcomes, or other systems.

Example: Add a ground truth

Let’s say you want to add a ground_truth column for a previously logged trace.
from openlayer import Openlayer
from openlayer.types.inference_pipelines import row_update_params

row_updates = {
    "ground_truth": "The sun is 94.471 million miles from the earth."
}

config = row_update_params.Config(
    ground_truth_column_name="ground_truth"
)

client = Openlayer()
client.inference_pipelines.rows.update(
    inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    inference_id="832y98d3",
    row=row_updates,
    config=config,
)
This updates the trace with inference_id="832y98d3" by attaching a ground truth.

Using custom inference IDs

When tracing with the @trace decorator, you can set your own inference IDs. This makes it easy to correlate requests with later feedback or business signals.
from openlayer.lib import trace, update_current_trace

@trace()
def process_chat_message(user_id: str, message: str, conversation_id: str):
    custom_id = f"chat_{conversation_id}_{user_id}"
    update_current_trace(inference_id=custom_id)

    response = generate_ai_response(message)

    # Store custom_id in your DB for later updates
    store_for_feedback(custom_id, user_id, message, response)

    return response
Later, use that custom ID (chat_{conversation_id}_{user_id}) in your update calls.
I