Skip to content

Commit bc55661

Browse files
committed
Simplify test since all models behaves the same
1 parent fbb013e commit bc55661

File tree

4 files changed

+18
-113
lines changed

4 files changed

+18
-113
lines changed

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/bedrock.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def extract_attributes(self, attributes: _AttributeMapT):
6666
attributes[GEN_AI_REQUEST_MODEL] = model_id
6767

6868
# FIXME: add other model patterns
69-
text_model_patterns = ["amazon.titan-text", "anthropic.claude"]
69+
text_model_patterns = [
70+
"amazon.titan-text",
71+
"anthropic.claude",
72+
"meta.llama",
73+
]
7074
if any(pattern in model_id for pattern in text_model_patterns):
7175
attributes[GEN_AI_OPERATION_NAME] = (
7276
GenAiOperationNameValues.CHAT.value
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ interactions:
3434
aG9uIGNmZy9yZXRyeS1tb2RlI2xlZ2FjeSBCb3RvY29yZS8xLjM1LjU2
3535
X-Amz-Date:
3636
- !!binary |
37-
MjAyNDEyMzFUMTAwMjI1Wg==
37+
MjAyNDEyMzFUMTMyMDQxWg==
3838
X-Amz-Security-Token:
3939
- test_aws_security_token
4040
X-Amzn-Trace-Id:
4141
- !!binary |
42-
Um9vdD0xLTg5Y2FhMmUwLTUzY2NiZTE0MzQ0MGE4MWRjMTgyYzUwNjtQYXJlbnQ9ODdiZTZmMGI4
43-
YjlhNzQxZDtTYW1wbGVkPTE=
42+
Um9vdD0xLWY1MWY4NGM1LTNiZjk4YzY0YWMyNmJhNTk1OWJjODgxNjtQYXJlbnQ9YjNmOGZhM2Mz
43+
MDc1NGEzZjtTYW1wbGVkPTE=
4444
amz-sdk-invocation-id:
4545
- !!binary |
46-
YjE5MzViZmEtOGI3Ni00ODMwLTkzNDktMjZhODJjNTQ3Mjg0
46+
OTIyMjczMzItY2I5ZS00NGM1LTliZGUtYjU0NmJmODkxYmEy
4747
amz-sdk-request:
4848
- !!binary |
4949
YXR0ZW1wdD0x
@@ -56,37 +56,37 @@ interactions:
5656
string: |-
5757
{
5858
"metrics": {
59-
"latencyMs": 527
59+
"latencyMs": 811
6060
},
6161
"output": {
6262
"message": {
6363
"content": [
6464
{
65-
"text": ""
65+
"text": "I am happy to assist you today"
6666
}
6767
],
6868
"role": "assistant"
6969
}
7070
},
71-
"stopReason": "end_turn",
71+
"stopReason": "max_tokens",
7272
"usage": {
7373
"inputTokens": 8,
74-
"outputTokens": 5,
75-
"totalTokens": 13
74+
"outputTokens": 10,
75+
"totalTokens": 18
7676
}
7777
}
7878
headers:
7979
Connection:
8080
- keep-alive
8181
Content-Length:
82-
- '179'
82+
- '212'
8383
Content-Type:
8484
- application/json
8585
Date:
86-
- Tue, 31 Dec 2024 10:02:26 GMT
86+
- Tue, 31 Dec 2024 13:20:42 GMT
8787
Set-Cookie: test_set_cookie
8888
x-amzn-RequestId:
89-
- 8e183234-2be0-4d6f-8a0e-ff065d47ea60
89+
- 63dfbcb2-3536-4906-b10d-e5b126b3c0ae
9090
status:
9191
code: 200
9292
message: OK

instrumentation/opentelemetry-instrumentation-botocore/tests/cassettes/test_converse_with_content[anthropic.claude].yaml

Lines changed: 0 additions & 93 deletions
This file was deleted.

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,15 @@
3131
BOTO3_VERSION < (1, 35, 56), reason="Converse API not available"
3232
)
3333
@pytest.mark.vcr()
34-
@pytest.mark.parametrize("llm_model", ["amazon.titan", "anthropic.claude"])
3534
def test_converse_with_content(
36-
llm_model,
3735
span_exporter,
3836
log_exporter,
3937
bedrock_runtime_client,
4038
instrument_with_content,
4139
):
42-
llm_model_id = {
43-
"amazon.titan": "amazon.titan-text-lite-v1",
44-
"anthropic.claude": "anthropic.claude-3-haiku-20240307-v1:0",
45-
}
4640
messages = [{"role": "user", "content": [{"text": "Say this is a test"}]}]
4741

48-
llm_model_value = llm_model_id[llm_model]
42+
llm_model_value = "amazon.titan-text-lite-v1"
4943
max_tokens, temperature, top_p, stop_sequences = 10, 0.8, 1, ["|"]
5044
response = bedrock_runtime_client.converse(
5145
messages=messages,

0 commit comments

Comments
 (0)