File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/phoenix-evals/tests/phoenix/evals/models Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ import asyncio
2
+
1
3
import boto3
4
+ import pytest
5
+
2
6
from phoenix .evals import BedrockModel
3
7
4
8
5
9
def test_bedrock_model_can_be_instantiated ():
6
10
session = boto3 .Session (region_name = "us-west-2" )
7
11
model = BedrockModel (session = session )
8
12
assert model
13
+
14
+
15
+ def test_bedrock_async_propagates_errors ():
16
+ with pytest .raises (
17
+ AttributeError , match = "'NoneType' object has no attribute 'invoke_model'"
18
+ ):
19
+ session = boto3 .Session (region_name = "us-west-2" )
20
+ client = session .client ("bedrock-runtime" )
21
+ model = BedrockModel (session = session , client = client )
22
+
23
+ # Sets client to None to force an exception
24
+ model .client = None
25
+
26
+ # this should raise an exception
27
+ asyncio .run (model ._async_generate ("prompt" ))
You can’t perform that action at this time.
0 commit comments