Skip to content

Commit 55f31b2

Browse files
Ark-kuncopybara-github
authored andcommitted
chore: GenAI - Improved type annotations
PiperOrigin-RevId: 617348553
1 parent 8bd832e commit 55f31b2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

vertexai/generative_models/_generative_models.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ def from_dict(cls, generation_config_dict: Dict[str, Any]) -> "GenerationConfig"
11461146
def to_dict(self) -> Dict[str, Any]:
11471147
return type(self._raw_generation_config).to_dict(self._raw_generation_config)
11481148

1149-
def __repr__(self):
1149+
def __repr__(self) -> str:
11501150
return self._raw_generation_config.__repr__()
11511151

11521152

@@ -1208,7 +1208,7 @@ def __init__(
12081208
def from_function_declarations(
12091209
cls,
12101210
function_declarations: List["FunctionDeclaration"],
1211-
):
1211+
) -> "Tool":
12121212
gapic_function_declarations = [
12131213
function_declaration._raw_function_declaration
12141214
for function_declaration in function_declarations
@@ -1221,16 +1221,16 @@ def from_function_declarations(
12211221
@classmethod
12221222
def from_retrieval(
12231223
cls,
1224-
retrieval: "Retrieval",
1225-
):
1224+
retrieval: "grounding.Retrieval",
1225+
) -> "Tool":
12261226
raw_tool = gapic_tool_types.Tool(retrieval=retrieval._raw_retrieval)
12271227
return cls._from_gapic(raw_tool=raw_tool)
12281228

12291229
@classmethod
12301230
def from_google_search_retrieval(
12311231
cls,
1232-
google_search_retrieval: "GoogleSearchRetrieval",
1233-
):
1232+
google_search_retrieval: "grounding.GoogleSearchRetrieval",
1233+
) -> "Tool":
12341234
raw_tool = gapic_tool_types.Tool(
12351235
google_search_retrieval=google_search_retrieval._raw_google_search_retrieval
12361236
)
@@ -1259,7 +1259,7 @@ def from_dict(cls, tool_dict: Dict[str, Any]) -> "Tool":
12591259
def to_dict(self) -> Dict[str, Any]:
12601260
return type(self._raw_tool).to_dict(self._raw_tool)
12611261

1262-
def __repr__(self):
1262+
def __repr__(self) -> str:
12631263
return self._raw_tool.__repr__()
12641264

12651265

@@ -1347,7 +1347,7 @@ def __init__(
13471347
)
13481348

13491349

1350-
def _convert_schema_dict_to_gapic(schema_dict: Dict[str, Any]):
1350+
def _convert_schema_dict_to_gapic(schema_dict: Dict[str, Any]) -> Dict[str, Any]:
13511351
"""Converts a JsonSchema to a dict that the GAPIC Schema class accepts."""
13521352
gapic_schema_dict = copy.copy(schema_dict)
13531353
if "type" in gapic_schema_dict:
@@ -1390,7 +1390,7 @@ def from_dict(cls, response_dict: Dict[str, Any]) -> "GenerationResponse":
13901390
def to_dict(self) -> Dict[str, Any]:
13911391
return type(self._raw_response).to_dict(self._raw_response)
13921392

1393-
def __repr__(self):
1393+
def __repr__(self) -> str:
13941394
return self._raw_response.__repr__()
13951395

13961396
@property
@@ -1435,7 +1435,7 @@ def from_dict(cls, candidate_dict: Dict[str, Any]) -> "Candidate":
14351435
def to_dict(self) -> Dict[str, Any]:
14361436
return type(self._raw_candidate).to_dict(self._raw_candidate)
14371437

1438-
def __repr__(self):
1438+
def __repr__(self) -> str:
14391439
return self._raw_candidate.__repr__()
14401440

14411441
@property
@@ -1515,7 +1515,7 @@ def from_dict(cls, content_dict: Dict[str, Any]) -> "Content":
15151515
def to_dict(self) -> Dict[str, Any]:
15161516
return type(self._raw_content).to_dict(self._raw_content)
15171517

1518-
def __repr__(self):
1518+
def __repr__(self) -> str:
15191519
return self._raw_content.__repr__()
15201520

15211521
@property
@@ -1579,7 +1579,7 @@ def from_dict(cls, part_dict: Dict[str, Any]) -> "Part":
15791579
json_format.ParseDict(part_dict, raw_part._pb)
15801580
return cls._from_gapic(raw_part=raw_part)
15811581

1582-
def __repr__(self):
1582+
def __repr__(self) -> str:
15831583
return self._raw_part.__repr__()
15841584

15851585
@staticmethod

0 commit comments

Comments
 (0)