Skip to content

Commit c992d70

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: use .model_copy() instead of deprecated .copy()
PiperOrigin-RevId: 930640671
1 parent f8f9749 commit c992d70

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

google/genai/models.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6476,7 +6476,9 @@ def generate_content(
64766476
response = types.GenerateContentResponse()
64776477
i = 0
64786478
while remaining_remote_calls_afc > 0:
6479-
parsed_config_to_call = parsed_config.copy() if parsed_config else None
6479+
parsed_config_to_call = (
6480+
parsed_config.model_copy(deep=True) if parsed_config else None
6481+
)
64806482
function_map = _extra_utils.get_function_map(parsed_config)
64816483
if function_map:
64826484
parsed_config_to_call = _extra_utils.get_usage_header(
@@ -6649,7 +6651,9 @@ def generate_content_stream(
66496651
func_response_parts = None
66506652
i = 0
66516653
while remaining_remote_calls_afc > 0:
6652-
parsed_config_to_call = parsed_config.copy() if parsed_config else None
6654+
parsed_config_to_call = (
6655+
parsed_config.model_copy(deep=True) if parsed_config else None
6656+
)
66536657
function_map = _extra_utils.get_function_map(parsed_config)
66546658
if function_map:
66556659
parsed_config_to_call = _extra_utils.get_usage_header(
@@ -7040,7 +7044,7 @@ def list(
70407044
if config.query_base is None:
70417045
config.query_base = True
70427046
if self._api_client.vertexai:
7043-
config = config.copy()
7047+
config = config.model_copy(deep=True)
70447048
if not config.query_base:
70457049
# Filter for tuning jobs artifacts by labels.
70467050
filter_value = config.filter
@@ -8654,7 +8658,7 @@ async def generate_content(
86548658
is_caller_method_async=True,
86558659
)
86568660
final_parsed_config_to_call = (
8657-
final_parsed_config.copy() if final_parsed_config else None
8661+
final_parsed_config.model_copy(deep=True) if final_parsed_config else None
86588662
)
86598663
if function_map:
86608664
final_parsed_config_to_call = _extra_utils.get_usage_header(
@@ -8853,7 +8857,7 @@ async def async_generator(model, contents, config): # type: ignore[no-untyped-d
88538857
function_map = _extra_utils.get_function_map(
88548858
config, mcp_to_genai_tool_adapters, is_caller_method_async=True
88558859
)
8856-
config_to_call = config.copy() if config else None
8860+
config_to_call = config.model_copy(deep=True) if config else None
88578861
if function_map:
88588862
config_to_call = _extra_utils.get_usage_header(config_to_call)
88598863
i += 1
@@ -9033,7 +9037,7 @@ async def list(
90339037
if config.query_base is None:
90349038
config.query_base = True
90359039
if self._api_client.vertexai:
9036-
config = config.copy()
9040+
config = config.model_copy(deep=True)
90379041
if not config.query_base:
90389042
# Filter for tuning jobs artifacts by labels.
90399043
filter_value = config.filter

0 commit comments

Comments
 (0)