Skip to content

Commit 3f6c824

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
Copybara import of the project:
-- 1bf0392 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: fix: Allow Protobuf 6.x chore: Update gapic-generator-python to v1.23.5 PiperOrigin-RevId: 735388698 Source-Link: googleapis/googleapis@a3dda51 Source-Link: googleapis/googleapis-gen@c329c69 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzMyOWM2OTNkMmRhMDYzYTg5ZWNjMjllMTVkYzE5Njc2OWFhODU0YiJ9 -- d4388d6 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 64b08bc by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add reranker config to RAG v1 API PiperOrigin-RevId: 735952331 Source-Link: googleapis/googleapis@4ce00b0 Source-Link: googleapis/googleapis-gen@28a0272 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjhhMDI3MjU3N2Y2NzllYzMzOWEwNTYxYWQ3ZmNhM2Q0ZjYyMjBjZiJ9 -- 6ae7da7 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- f80b888 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add function_call.id and function_response.id PiperOrigin-RevId: 736282512 Source-Link: googleapis/googleapis@ba5a2fb Source-Link: googleapis/googleapis-gen@d9edc74 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDllZGM3NGViNmQ1MGQxYTZmY2YyOWZhYzQwYjk0OGIyNTNhN2JmZCJ9 -- 91aa90e by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- d994bc7 by Amy Wu <[email protected]>: Update snippet_metadata_google.cloud.aiplatform.v1.json -- b53c87c by Amy Wu <[email protected]>: Update snippet_metadata_google.cloud.aiplatform.v1beta1.json COPYBARA_INTEGRATE_REVIEW=#5032 from googleapis:owl-bot-copy 821681c PiperOrigin-RevId: 736638151
1 parent 2a67076 commit 3f6c824

File tree

7 files changed

+183
-36
lines changed

7 files changed

+183
-36
lines changed

google/cloud/aiplatform_v1/types/tool.py

+79
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ class RagRetrievalConfig(proto.Message):
663663
Optional. The number of contexts to retrieve.
664664
filter (google.cloud.aiplatform_v1.types.RagRetrievalConfig.Filter):
665665
Optional. Config for filters.
666+
ranking (google.cloud.aiplatform_v1.types.RagRetrievalConfig.Ranking):
667+
Optional. Config for ranking and reranking.
666668
"""
667669

668670
class Filter(proto.Message):
@@ -705,6 +707,78 @@ class Filter(proto.Message):
705707
number=2,
706708
)
707709

710+
class Ranking(proto.Message):
711+
r"""Config for ranking and reranking.
712+
713+
This message has `oneof`_ fields (mutually exclusive fields).
714+
For each oneof, at most one member field can be set at the same time.
715+
Setting any member of the oneof automatically clears all other
716+
members.
717+
718+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
719+
720+
Attributes:
721+
rank_service (google.cloud.aiplatform_v1.types.RagRetrievalConfig.Ranking.RankService):
722+
Optional. Config for Rank Service.
723+
724+
This field is a member of `oneof`_ ``ranking_config``.
725+
llm_ranker (google.cloud.aiplatform_v1.types.RagRetrievalConfig.Ranking.LlmRanker):
726+
Optional. Config for LlmRanker.
727+
728+
This field is a member of `oneof`_ ``ranking_config``.
729+
"""
730+
731+
class RankService(proto.Message):
732+
r"""Config for Rank Service.
733+
734+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
735+
736+
Attributes:
737+
model_name (str):
738+
Optional. The model name of the rank service. Format:
739+
``semantic-ranker-512@latest``
740+
741+
This field is a member of `oneof`_ ``_model_name``.
742+
"""
743+
744+
model_name: str = proto.Field(
745+
proto.STRING,
746+
number=1,
747+
optional=True,
748+
)
749+
750+
class LlmRanker(proto.Message):
751+
r"""Config for LlmRanker.
752+
753+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
754+
755+
Attributes:
756+
model_name (str):
757+
Optional. The model name used for ranking. Format:
758+
``gemini-1.5-pro``
759+
760+
This field is a member of `oneof`_ ``_model_name``.
761+
"""
762+
763+
model_name: str = proto.Field(
764+
proto.STRING,
765+
number=1,
766+
optional=True,
767+
)
768+
769+
rank_service: "RagRetrievalConfig.Ranking.RankService" = proto.Field(
770+
proto.MESSAGE,
771+
number=1,
772+
oneof="ranking_config",
773+
message="RagRetrievalConfig.Ranking.RankService",
774+
)
775+
llm_ranker: "RagRetrievalConfig.Ranking.LlmRanker" = proto.Field(
776+
proto.MESSAGE,
777+
number=3,
778+
oneof="ranking_config",
779+
message="RagRetrievalConfig.Ranking.LlmRanker",
780+
)
781+
708782
top_k: int = proto.Field(
709783
proto.INT32,
710784
number=1,
@@ -714,6 +788,11 @@ class Filter(proto.Message):
714788
number=3,
715789
message=Filter,
716790
)
791+
ranking: Ranking = proto.Field(
792+
proto.MESSAGE,
793+
number=4,
794+
message=Ranking,
795+
)
717796

718797

719798
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/aiplatform_v1beta1/services/migration_service/client.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,23 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]:
242242
@staticmethod
243243
def dataset_path(
244244
project: str,
245+
location: str,
245246
dataset: str,
246247
) -> str:
247248
"""Returns a fully-qualified dataset string."""
248-
return "projects/{project}/datasets/{dataset}".format(
249+
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
249250
project=project,
251+
location=location,
250252
dataset=dataset,
251253
)
252254

253255
@staticmethod
254256
def parse_dataset_path(path: str) -> Dict[str, str]:
255257
"""Parses a dataset path into its component segments."""
256-
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
258+
m = re.match(
259+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
260+
path,
261+
)
257262
return m.groupdict() if m else {}
258263

259264
@staticmethod
@@ -281,23 +286,18 @@ def parse_dataset_path(path: str) -> Dict[str, str]:
281286
@staticmethod
282287
def dataset_path(
283288
project: str,
284-
location: str,
285289
dataset: str,
286290
) -> str:
287291
"""Returns a fully-qualified dataset string."""
288-
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
292+
return "projects/{project}/datasets/{dataset}".format(
289293
project=project,
290-
location=location,
291294
dataset=dataset,
292295
)
293296

294297
@staticmethod
295298
def parse_dataset_path(path: str) -> Dict[str, str]:
296299
"""Parses a dataset path into its component segments."""
297-
m = re.match(
298-
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
299-
path,
300-
)
300+
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
301301
return m.groupdict() if m else {}
302302

303303
@staticmethod

google/cloud/aiplatform_v1beta1/types/tool.py

+16
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ class FunctionCall(proto.Message):
305305
JSON object containing the parameters and their values.
306306
307307
Attributes:
308+
id (str):
309+
Optional. The unique id of the function call. If populated,
310+
the client to execute the ``function_call`` and return the
311+
response with the matching ``id``.
308312
name (str):
309313
Required. The name of the function to call. Matches
310314
[FunctionDeclaration.name].
@@ -314,6 +318,10 @@ class FunctionCall(proto.Message):
314318
parameter details.
315319
"""
316320

321+
id: str = proto.Field(
322+
proto.STRING,
323+
number=3,
324+
)
317325
name: str = proto.Field(
318326
proto.STRING,
319327
number=1,
@@ -333,6 +341,10 @@ class FunctionResponse(proto.Message):
333341
based on model prediction.
334342
335343
Attributes:
344+
id (str):
345+
Optional. The id of the function call this response is for.
346+
Populated by the client to match the corresponding function
347+
call ``id``.
336348
name (str):
337349
Required. The name of the function to call. Matches
338350
[FunctionDeclaration.name] and [FunctionCall.name].
@@ -345,6 +357,10 @@ class FunctionResponse(proto.Message):
345357
treated as function output.
346358
"""
347359

360+
id: str = proto.Field(
361+
proto.STRING,
362+
number=3,
363+
)
348364
name: str = proto.Field(
349365
proto.STRING,
350366
number=1,

tests/unit/gapic/aiplatform_v1/test_gen_ai_cache_service.py

+16
Original file line numberDiff line numberDiff line change
@@ -4690,6 +4690,10 @@ def test_create_cached_content_rest_call_success(request_type):
46904690
"vector_similarity_threshold": 0.2917,
46914691
"metadata_filter": "metadata_filter_value",
46924692
},
4693+
"ranking": {
4694+
"rank_service": {"model_name": "model_name_value"},
4695+
"llm_ranker": {"model_name": "model_name_value"},
4696+
},
46934697
},
46944698
},
46954699
"disable_attribution": True,
@@ -5162,6 +5166,10 @@ def test_update_cached_content_rest_call_success(request_type):
51625166
"vector_similarity_threshold": 0.2917,
51635167
"metadata_filter": "metadata_filter_value",
51645168
},
5169+
"ranking": {
5170+
"rank_service": {"model_name": "model_name_value"},
5171+
"llm_ranker": {"model_name": "model_name_value"},
5172+
},
51655173
},
51665174
},
51675175
"disable_attribution": True,
@@ -6496,6 +6504,10 @@ async def test_create_cached_content_rest_asyncio_call_success(request_type):
64966504
"vector_similarity_threshold": 0.2917,
64976505
"metadata_filter": "metadata_filter_value",
64986506
},
6507+
"ranking": {
6508+
"rank_service": {"model_name": "model_name_value"},
6509+
"llm_ranker": {"model_name": "model_name_value"},
6510+
},
64996511
},
65006512
},
65016513
"disable_attribution": True,
@@ -7000,6 +7012,10 @@ async def test_update_cached_content_rest_asyncio_call_success(request_type):
70007012
"vector_similarity_threshold": 0.2917,
70017013
"metadata_filter": "metadata_filter_value",
70027014
},
7015+
"ranking": {
7016+
"rank_service": {"model_name": "model_name_value"},
7017+
"llm_ranker": {"model_name": "model_name_value"},
7018+
},
70037019
},
70047020
},
70057021
"disable_attribution": True,

tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py

+40-8
Original file line numberDiff line numberDiff line change
@@ -4617,8 +4617,16 @@ def test_create_cached_content_rest_call_success(request_type):
46174617
"mime_type": "mime_type_value",
46184618
"file_uri": "file_uri_value",
46194619
},
4620-
"function_call": {"name": "name_value", "args": {"fields": {}}},
4621-
"function_response": {"name": "name_value", "response": {}},
4620+
"function_call": {
4621+
"id": "id_value",
4622+
"name": "name_value",
4623+
"args": {"fields": {}},
4624+
},
4625+
"function_response": {
4626+
"id": "id_value",
4627+
"name": "name_value",
4628+
"response": {},
4629+
},
46224630
"executable_code": {"language": 1, "code": "code_value"},
46234631
"code_execution_result": {"outcome": 1, "output": "output_value"},
46244632
"video_metadata": {"start_offset": {}, "end_offset": {}},
@@ -5096,8 +5104,16 @@ def test_update_cached_content_rest_call_success(request_type):
50965104
"mime_type": "mime_type_value",
50975105
"file_uri": "file_uri_value",
50985106
},
5099-
"function_call": {"name": "name_value", "args": {"fields": {}}},
5100-
"function_response": {"name": "name_value", "response": {}},
5107+
"function_call": {
5108+
"id": "id_value",
5109+
"name": "name_value",
5110+
"args": {"fields": {}},
5111+
},
5112+
"function_response": {
5113+
"id": "id_value",
5114+
"name": "name_value",
5115+
"response": {},
5116+
},
51015117
"executable_code": {"language": 1, "code": "code_value"},
51025118
"code_execution_result": {"outcome": 1, "output": "output_value"},
51035119
"video_metadata": {"start_offset": {}, "end_offset": {}},
@@ -6437,8 +6453,16 @@ async def test_create_cached_content_rest_asyncio_call_success(request_type):
64376453
"mime_type": "mime_type_value",
64386454
"file_uri": "file_uri_value",
64396455
},
6440-
"function_call": {"name": "name_value", "args": {"fields": {}}},
6441-
"function_response": {"name": "name_value", "response": {}},
6456+
"function_call": {
6457+
"id": "id_value",
6458+
"name": "name_value",
6459+
"args": {"fields": {}},
6460+
},
6461+
"function_response": {
6462+
"id": "id_value",
6463+
"name": "name_value",
6464+
"response": {},
6465+
},
64426466
"executable_code": {"language": 1, "code": "code_value"},
64436467
"code_execution_result": {"outcome": 1, "output": "output_value"},
64446468
"video_metadata": {"start_offset": {}, "end_offset": {}},
@@ -6948,8 +6972,16 @@ async def test_update_cached_content_rest_asyncio_call_success(request_type):
69486972
"mime_type": "mime_type_value",
69496973
"file_uri": "file_uri_value",
69506974
},
6951-
"function_call": {"name": "name_value", "args": {"fields": {}}},
6952-
"function_response": {"name": "name_value", "response": {}},
6975+
"function_call": {
6976+
"id": "id_value",
6977+
"name": "name_value",
6978+
"args": {"fields": {}},
6979+
},
6980+
"function_response": {
6981+
"id": "id_value",
6982+
"name": "name_value",
6983+
"response": {},
6984+
},
69536985
"executable_code": {"language": 1, "code": "code_value"},
69546986
"code_execution_result": {"outcome": 1, "output": "output_value"},
69556987
"video_metadata": {"start_offset": {}, "end_offset": {}},

tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py

+4
Original file line numberDiff line numberDiff line change
@@ -4630,10 +4630,12 @@ def test_create_tuning_job_rest_call_success(request_type):
46304630
"file_uri": "file_uri_value",
46314631
},
46324632
"function_call": {
4633+
"id": "id_value",
46334634
"name": "name_value",
46344635
"args": {"fields": {}},
46354636
},
46364637
"function_response": {
4638+
"id": "id_value",
46374639
"name": "name_value",
46384640
"response": {},
46394641
},
@@ -6258,10 +6260,12 @@ async def test_create_tuning_job_rest_asyncio_call_success(request_type):
62586260
"file_uri": "file_uri_value",
62596261
},
62606262
"function_call": {
6263+
"id": "id_value",
62616264
"name": "name_value",
62626265
"args": {"fields": {}},
62636266
},
62646267
"function_response": {
6268+
"id": "id_value",
62656269
"name": "name_value",
62666270
"response": {},
62676271
},

0 commit comments

Comments
 (0)