@@ -33,7 +33,7 @@ async def test_init_service_account(tmp_path: Path, allow_model_requests: None):
33
33
assert model .url is None
34
34
assert model .auth is None
35
35
36
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
36
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
37
37
38
38
assert model .url == snapshot (
39
39
'https://us-central1-aiplatform.googleapis.com/v1/projects/my-project-id/locations/us-central1/'
@@ -58,7 +58,7 @@ async def test_init_env(mocker: MockerFixture, allow_model_requests: None):
58
58
59
59
assert patch .call_count == 0
60
60
61
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
61
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
62
62
63
63
assert patch .call_count == 1
64
64
@@ -69,7 +69,7 @@ async def test_init_env(mocker: MockerFixture, allow_model_requests: None):
69
69
assert model .auth is not None
70
70
assert model .name () == snapshot ('vertexai:gemini-1.5-flash' )
71
71
72
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
72
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
73
73
assert model .url is not None
74
74
assert model .auth is not None
75
75
assert patch .call_count == 1
@@ -83,7 +83,7 @@ async def test_init_right_project_id(tmp_path: Path, allow_model_requests: None)
83
83
assert model .url is None
84
84
assert model .auth is None
85
85
86
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
86
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
87
87
88
88
assert model .url == snapshot (
89
89
'https://us-central1-aiplatform.googleapis.com/v1/projects/my-project-id/locations/us-central1/'
@@ -99,7 +99,7 @@ async def test_init_service_account_wrong_project_id(tmp_path: Path):
99
99
model = VertexAIModel ('gemini-1.5-flash' , service_account_file = service_account_path , project_id = 'different' )
100
100
101
101
with pytest .raises (UserError ) as exc_info :
102
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
102
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
103
103
assert str (exc_info .value ) == snapshot (
104
104
"The project_id you provided does not match the one from service account file: 'different' != 'my-project-id'"
105
105
)
@@ -110,7 +110,7 @@ async def test_init_env_wrong_project_id(mocker: MockerFixture):
110
110
model = VertexAIModel ('gemini-1.5-flash' , project_id = 'different' )
111
111
112
112
with pytest .raises (UserError ) as exc_info :
113
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
113
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
114
114
assert str (exc_info .value ) == snapshot (
115
115
"The project_id you provided does not match the one from `google.auth.default()`: 'different' != 'my-project-id'"
116
116
)
@@ -124,7 +124,7 @@ async def test_init_env_no_project_id(mocker: MockerFixture):
124
124
model = VertexAIModel ('gemini-1.5-flash' )
125
125
126
126
with pytest .raises (UserError ) as exc_info :
127
- await model .prepare (function_tools = {}, allow_text_result = True , result_tools = None )
127
+ await model .agent_model (function_tools = {}, allow_text_result = True , result_tools = None )
128
128
assert str (exc_info .value ) == snapshot ('No project_id provided and none found in `google.auth.default()`' )
129
129
130
130
0 commit comments