metadata object. This page explains how to preserve conversation identity, sample complete conversations, and understand the resulting project traces.
The OpenAI SDKs accept metadata as a built-in request parameter, so you don’t need extra_body. Older releases of the openai Python package that don’t have the metadata parameter still need extra_body={"metadata": {...}}.
Reserved metadata
forge.* and wandb.* keys are reserved for proxy controls. The proxy removes them before it sends a request to the provider, and it doesn’t record them as custom trace attributes. The proxy forwards other metadata to the provider. When representable, the proxy also adds that metadata to the trace.
Don’t use your own metadata keys that start with forge. or wandb.. The proxy treats them as controls.
The trace also doesn’t record custom metadata that reuses a name the proxy records itself, such as routing_mode, task_version, or alias. Agent Spans also skip error.type and gen_ai.* keys other than gen_ai.conversation.id. The proxy still forwards these keys to the provider.
Conversation precedence
Send the conversation identifier asgen_ai.conversation.id, the OpenTelemetry name. The proxy chooses the first available identifier:
gen_ai.conversation.id- Vapi
call.id
Sample complete conversations
Conversation-level trace sampling reduces the volume of project traffic saved to Weave without leaving partial conversations. Per-request sampling can keep isolated turns and discard the surrounding context, which makes the saved data less useful for debugging and dataset creation. To configure sampling for a project:- In Model Distillation, open the project’s Routing page.
- Under Models and traffic, set Weave trace sampling to the percentage of conversations to save.
- Select Save routing.
API: Set conversation trace sampling (PUT /projects/[PROJECT-ALIAS]/routing)
API: Set conversation trace sampling (PUT /projects/[PROJECT-ALIAS]/routing)
To configure conversation-level trace sampling without Model Distillation, use the routing API.Replace For another project version, use
[PROJECT-ALIAS] with the project alias, [WANDB-ENTITY] with the Weights & Biases entity, and [MODEL-REF] with an existing target model reference.Set trace_sampling_rate to a fraction from 0 to 1. Because a routing update replaces the complete configuration, include all existing targets in the request:PUT /v1/projects/[PROJECT-ALIAS]/versions/[PROJECT-VERSION]/routing. Replace [PROJECT-ALIAS] with the project alias and [PROJECT-VERSION] with the project version. Before you treat the setting as active, wait until the deployment status is Applied at the new routing revision.Project trace contents
Project traces capture the following routing, request, response, and metadata details:- Project ID (UUID), project alias, and version.
- Routing revision and selected provider and model.
- The routing mode (
routing_mode):weightedwhen the proxy selected a target, oroverridewhen the request named aprovider/modelmodel override. - The exact request that the proxy sends to the provider and the response that the proxy reconstructs.
- Token usage, finish reason, timing, and error status.
- Whether the response was replayed from the exact-response cache (
cache_hit). - Conversation, user, scenario, and safe custom metadata.
- A proxy request ID for support and comparison of trace outputs.
gen_ai.conversation.id. Weave’s Threads view reads only Calls, so project traffic appears there only for requests that also log a Call with forge.call_shadow.
Model overrides are project traffic, so datasets built from project traces can include them. To exclude overrides from a dataset, filter on metadata: {"routing_mode": "weighted"}. This filter also excludes traces written before the proxy began recording routing_mode.
API: Send a request with conversation identity (POST /chat/completions)
API: Send a request with conversation identity (POST /chat/completions)
Replace To pin a version other than version 1, add
[WANDB-ENTITY] with the Weights & Biases entity, [WANDB-PROJECT] with the project’s Weights & Biases project name (not its alias), and [CONVERSATION-ID] with an identifier for the conversation.Keep the same gen_ai.conversation.id for every turn in one conversation:"forge.project_version": "2" to metadata. The proxy removes reserved forge.* values before sending a request to the provider. See Create a routed chat completion.