Skip to content

Commit f696f40

Browse files
authored
Update gen ai contract tests in v1.33.x patch branch (#987)
*Description of changes:* Same as #976 but merging to our v1.33.x patch branch *Test plan:* Ran updated contract tests. <img width="1920" alt="Screenshot 2025-01-06 at 10 36 24 AM" src="https://github.com/user-attachments/assets/f8c0fcbc-1b69-4420-ab66-ca426d5c355c" /> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 5ea8459 commit f696f40

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/base/AwsSdkBaseTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,7 @@ protected void doTestBedrockRuntimeAi21Jamba() {
19971997
List.of(
19981998
assertAttribute(
19991999
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL, "ai21.jamba-1-5-mini-v1:0"),
2000+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
20002001
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.7"),
20012002
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.8"),
20022003
assertAttribute(SemanticConventionsConstants.GEN_AI_RESPONSE_FINISH_REASONS, "[stop]"),
@@ -2071,6 +2072,7 @@ protected void doTestBedrockRuntimeAmazonTitan() {
20712072
assertAttribute(
20722073
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL,
20732074
"amazon.titan-text-premier-v1:0"),
2075+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
20742076
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_MAX_TOKENS, "100"),
20752077
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.7"),
20762078
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.9"),
@@ -2149,6 +2151,7 @@ protected void doTestBedrockRuntimeAnthropicClaude() {
21492151
assertAttribute(
21502152
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL,
21512153
"anthropic.claude-3-haiku-20240307-v1:0"),
2154+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
21522155
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_MAX_TOKENS, "512"),
21532156
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.6"),
21542157
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.53"),
@@ -2226,6 +2229,7 @@ protected void doTestBedrockRuntimeCohereCommandR() {
22262229
List.of(
22272230
assertAttribute(
22282231
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL, "cohere.command-r-v1:0"),
2232+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
22292233
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_MAX_TOKENS, "4096"),
22302234
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.8"),
22312235
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.45"),
@@ -2303,6 +2307,7 @@ protected void doTestBedrockRuntimeMetaLlama() {
23032307
List.of(
23042308
assertAttribute(
23052309
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL, "meta.llama3-70b-instruct-v1:0"),
2310+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
23062311
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_MAX_TOKENS, "128"),
23072312
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.1"),
23082313
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.9"),
@@ -2380,11 +2385,12 @@ protected void doTestBedrockRuntimeMistral() {
23802385
assertAttribute(
23812386
SemanticConventionsConstants.GEN_AI_REQUEST_MODEL,
23822387
"mistral.mistral-large-2402-v1:0"),
2388+
assertAttribute(SemanticConventionsConstants.GEN_AI_SYSTEM, "aws.bedrock"),
23832389
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_MAX_TOKENS, "4096"),
23842390
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TEMPERATURE, "0.75"),
23852391
assertAttribute(SemanticConventionsConstants.GEN_AI_REQUEST_TOP_P, "0.25"),
23862392
assertAttribute(SemanticConventionsConstants.GEN_AI_RESPONSE_FINISH_REASONS, "[stop]"),
2387-
assertAttribute(SemanticConventionsConstants.GEN_AI_USAGE_INPUT_TOKENS, "15"),
2393+
assertAttribute(SemanticConventionsConstants.GEN_AI_USAGE_INPUT_TOKENS, "16"),
23882394
assertAttribute(SemanticConventionsConstants.GEN_AI_USAGE_OUTPUT_TOKENS, "24")));
23892395
assertMetricClientAttributes(
23902396
metrics,

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/utils/SemanticConventionsConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class SemanticConventionsConstants {
6464
public static final String AWS_GUARDRAIL_ID = "aws.bedrock.guardrail.id";
6565
public static final String AWS_GUARDRAIL_ARN = "aws.bedrock.guardrail.arn";
6666
public static final String GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
67+
public static final String GEN_AI_SYSTEM = "gen_ai.system";
6768
public static final String GEN_AI_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens";
6869
public static final String GEN_AI_REQUEST_TEMPERATURE = "gen_ai.request.temperature";
6970
public static final String GEN_AI_REQUEST_TOP_P = "gen_ai.request.top_p";

0 commit comments

Comments
 (0)