track_bedrock

opik.integrations.bedrock.track_bedrock(client: BedrockRuntimeClient, project_name: str | None = None) BedrockRuntimeClient

Adds Opik tracking to an AWS Bedrock client.

Tracks calls to converse(), converse_stream(), invoke_model(), and invoke_model_with_response_stream() methods. Can be used within other Opik-tracked functions.

Supported Model subproviders for InvokeModel API (both streaming and non-streaming): - Anthropic (Claude) - Amazon (Nova) - Meta (Llama) - Mistral (Pixtral)

Parameters:
  • client – An instance of an AWS Bedrock client (botocore.client.BedrockRuntime or botocore.client.AgentsforBedrockRuntime).

  • project_name – The name of the project to log data.

Returns:

The modified bedrock client with Opik tracking enabled.