diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/RequestAccess.java b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/RequestAccess.java index ddb5240a24af..0210c70a8365 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/RequestAccess.java +++ b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/RequestAccess.java @@ -95,6 +95,7 @@ private static String approximateTokenCount(Map jsonBody, String } // Model -> Path Mapping: + // Amazon Nova -> "/inferenceConfig/max_new_tokens" // Amazon Titan -> "/textGenerationConfig/maxTokenCount" // Anthropic Claude -> "/max_tokens" // Cohere Command -> "/max_tokens" @@ -106,10 +107,15 @@ private static String approximateTokenCount(Map jsonBody, String static String getMaxTokens(Object target) { Map jsonBody = getJsonBody(target); return findFirstMatchingPath( - jsonBody, "/max_tokens", "/max_gen_len", "/textGenerationConfig/maxTokenCount"); + jsonBody, + "/max_tokens", + "/max_gen_len", + "/textGenerationConfig/maxTokenCount", + "/inferenceConfig/max_new_tokens"); } // Model -> Path Mapping: + // Amazon Nova -> "/inferenceConfig/temperature" // Amazon Titan -> "/textGenerationConfig/temperature" // Anthropic Claude -> "/temperature" // Cohere Command -> "/temperature" @@ -120,10 +126,15 @@ static String getMaxTokens(Object target) { @Nullable static String getTemperature(Object target) { Map jsonBody = getJsonBody(target); - return findFirstMatchingPath(jsonBody, "/temperature", "/textGenerationConfig/temperature"); + return findFirstMatchingPath( + jsonBody, + "/temperature", + "/textGenerationConfig/temperature", + "inferenceConfig/temperature"); } // Model -> Path Mapping: + // Amazon Nova -> "/inferenceConfig/top_p" // Amazon Titan -> "/textGenerationConfig/topP" // Anthropic Claude -> "/top_p" // Cohere Command -> "/p" @@ -134,10 +145,12 @@ static String getTemperature(Object target) { @Nullable static String getTopP(Object target) { Map jsonBody = getJsonBody(target); - return findFirstMatchingPath(jsonBody, "/top_p", "/p", "/textGenerationConfig/topP"); + return findFirstMatchingPath( + jsonBody, "/top_p", "/p", "/textGenerationConfig/topP", "/inferenceConfig/top_p"); } // Model -> Path Mapping: + // Amazon Nova -> "/usage/inputTokens" // Amazon Titan -> "/inputTextTokenCount" // Anthropic Claude -> "/usage/input_tokens" // Cohere Command -> "/prompt" @@ -159,7 +172,8 @@ static String getInputTokens(Object target) { "/inputTextTokenCount", "/prompt_token_count", "/usage/input_tokens", - "/usage/prompt_tokens"); + "/usage/prompt_tokens", + "/usage/inputTokens"); if (directCount != null && !directCount.equals("null")) { return directCount; @@ -170,6 +184,7 @@ static String getInputTokens(Object target) { } // Model -> Path Mapping: + // Amazon Nova -> "/usage/outputTokens" // Amazon Titan -> "/results/0/tokenCount" // Anthropic Claude -> "/usage/output_tokens" // Cohere Command -> "/generations/0/text" @@ -191,7 +206,8 @@ static String getOutputTokens(Object target) { "/generation_token_count", "/results/0/tokenCount", "/usage/output_tokens", - "/usage/completion_tokens"); + "/usage/completion_tokens", + "/usage/outputTokens"); if (directCount != null && !directCount.equals("null")) { return directCount; @@ -202,6 +218,7 @@ static String getOutputTokens(Object target) { } // Model -> Path Mapping: + // Amazon Nova -> "/stopReason" // Amazon Titan -> "/results/0/completionReason" // Anthropic Claude -> "/stop_reason" // Cohere Command -> "/generations/0/finish_reason" @@ -215,6 +232,7 @@ static String getFinishReasons(Object target) { String finishReason = findFirstMatchingPath( jsonBody, + "/stopReason", "/finish_reason", "/stop_reason", "/results/0/completionReason",