Skip to content

Commit

Permalink
update gen_ai.system attribute key (#302)
Browse files Browse the repository at this point in the history
*Description of changes:*
Updating `gen_ai.system` attribute key to better align with upstream
Otel conventions.

Context:
open-telemetry/semantic-conventions#1574 (comment)

*Test plan:*
Ran updated unit tests and contract tests.
<img width="2560" alt="Screenshot 2024-12-16 at 10 42 28 AM"
src="https://github.com/user-attachments/assets/b0886292-5a99-4e90-87b0-4ee009a3553e"
/>
<img width="2560" alt="Screenshot 2024-12-16 at 10 58 38 AM"
src="https://github.com/user-attachments/assets/4dab00d0-9141-43f5-980d-fdcd6924d69f"
/>


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Min Xia <[email protected]>
  • Loading branch information
yiyuan-he and mxiamxia authored Dec 16, 2024
1 parent 913203f commit 264493e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
_GUARDRAIL_ID: str = "guardrailId"
_GUARDRAIL_ARN: str = "guardrailArn"
_MODEL_ID: str = "modelId"
_AWS_BEDROCK_SYSTEM: str = "aws_bedrock"
_AWS_BEDROCK_SYSTEM: str = "aws.bedrock"

_logger = logging.getLogger(__name__)
# Set logger level to DEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
_BEDROCK_DATASOURCE_ID: str = "DataSourceId"
_BEDROCK_GUARDRAIL_ID: str = "GuardrailId"
_BEDROCK_KNOWLEDGEBASE_ID: str = "KnowledgeBaseId"
_GEN_AI_SYSTEM: str = "aws_bedrock"
_GEN_AI_SYSTEM: str = "aws.bedrock"
_GEN_AI_REQUEST_MODEL: str = "genAiReuqestModelId"
_SECRET_ARN: str = "arn:aws:secretsmanager:us-west-2:000000000000:secret:testSecret-ABCDEF"
_TOPIC_ARN: str = "topicArn"
Expand Down
7 changes: 7 additions & 0 deletions contract-tests/tests/test/amazon/botocore/botocore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
_GEN_AI_RESPONSE_FINISH_REASONS: str = "gen_ai.response.finish_reasons"
_GEN_AI_USAGE_INPUT_TOKENS: str = "gen_ai.usage.input_tokens"
_GEN_AI_USAGE_OUTPUT_TOKENS: str = "gen_ai.usage.output_tokens"
_GEN_AI_SYSTEM: str = "gen_ai.system"

_AWS_SECRET_ARN: str = "aws.secretsmanager.secret.arn"
_AWS_STATE_MACHINE_ARN: str = "aws.stepfunctions.state_machine.arn"
Expand Down Expand Up @@ -428,6 +429,7 @@ def test_bedrock_runtime_invoke_model_amazon_titan(self):
cloudformation_primary_identifier="amazon.titan-text-premier-v1:0",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "amazon.titan-text-premier-v1:0",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 3072,
_GEN_AI_REQUEST_TEMPERATURE: 0.7,
_GEN_AI_REQUEST_TOP_P: 0.9,
Expand Down Expand Up @@ -455,6 +457,7 @@ def test_bedrock_runtime_invoke_model_anthropic_claude(self):
cloudformation_primary_identifier="anthropic.claude-v2:1",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "anthropic.claude-v2:1",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 1000,
_GEN_AI_REQUEST_TEMPERATURE: 0.99,
_GEN_AI_REQUEST_TOP_P: 1,
Expand Down Expand Up @@ -482,6 +485,7 @@ def test_bedrock_runtime_invoke_model_meta_llama(self):
cloudformation_primary_identifier="meta.llama2-13b-chat-v1",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "meta.llama2-13b-chat-v1",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 512,
_GEN_AI_REQUEST_TEMPERATURE: 0.5,
_GEN_AI_REQUEST_TOP_P: 0.9,
Expand Down Expand Up @@ -509,6 +513,7 @@ def test_bedrock_runtime_invoke_model_cohere_command(self):
cloudformation_primary_identifier="cohere.command-r-v1:0",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "cohere.command-r-v1:0",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 512,
_GEN_AI_REQUEST_TEMPERATURE: 0.5,
_GEN_AI_REQUEST_TOP_P: 0.65,
Expand Down Expand Up @@ -538,6 +543,7 @@ def test_bedrock_runtime_invoke_model_ai21_jamba(self):
cloudformation_primary_identifier="ai21.jamba-1-5-large-v1:0",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "ai21.jamba-1-5-large-v1:0",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 512,
_GEN_AI_REQUEST_TEMPERATURE: 0.6,
_GEN_AI_REQUEST_TOP_P: 0.8,
Expand Down Expand Up @@ -565,6 +571,7 @@ def test_bedrock_runtime_invoke_model_mistral(self):
cloudformation_primary_identifier="mistral.mistral-7b-instruct-v0:2",
request_specific_attributes={
_GEN_AI_REQUEST_MODEL: "mistral.mistral-7b-instruct-v0:2",
_GEN_AI_SYSTEM: "aws.bedrock",
_GEN_AI_REQUEST_MAX_TOKENS: 4096,
_GEN_AI_REQUEST_TEMPERATURE: 0.75,
_GEN_AI_REQUEST_TOP_P: 0.99,
Expand Down

0 comments on commit 264493e

Please sign in to comment.