@@ -329,6 +329,9 @@ def _RetrieveAgentEngineMemoriesConfig_to_vertex(
329329 [item for item in getv (from_object , ["filter_groups" ])],
330330 )
331331
332+ if getv (from_object , ["memory_types" ]) is not None :
333+ setv (parent_object , ["memoryTypes" ], getv (from_object , ["memory_types" ]))
334+
332335 return to_object
333336
334337
@@ -365,6 +368,20 @@ def _RetrieveAgentEngineMemoriesRequestParameters_to_vertex(
365368 return to_object
366369
367370
371+ def _RetrieveMemoryProfilesRequestParameters_to_vertex (
372+ from_object : Union [dict [str , Any ], object ],
373+ parent_object : Optional [dict [str , Any ]] = None ,
374+ ) -> dict [str , Any ]:
375+ to_object : dict [str , Any ] = {}
376+ if getv (from_object , ["name" ]) is not None :
377+ setv (to_object , ["_url" , "name" ], getv (from_object , ["name" ]))
378+
379+ if getv (from_object , ["scope" ]) is not None :
380+ setv (to_object , ["scope" ], getv (from_object , ["scope" ]))
381+
382+ return to_object
383+
384+
368385def _RollbackAgentEngineMemoryRequestParameters_to_vertex (
369386 from_object : Union [dict [str , Any ], object ],
370387 parent_object : Optional [dict [str , Any ]] = None ,
@@ -935,6 +952,72 @@ def _retrieve(
935952 self ._api_client ._verify_response (return_value )
936953 return return_value
937954
955+ def retrieve_profiles (
956+ self ,
957+ * ,
958+ name : str ,
959+ scope : dict [str , str ],
960+ config : Optional [types .RetrieveMemoryProfilesConfigOrDict ] = None ,
961+ ) -> types .RetrieveProfilesResponse :
962+ """
963+ Retrieves memory profiles for an Agent Engine.
964+
965+ Args:
966+ name (str): Required. A fully-qualified resource name or ID such as
967+ "projects/123/locations/us-central1/reasoningEngines/456".
968+ scope (dict[str, str]): Required. The scope of the memories to retrieve.
969+ A memory must have exactly the same scope as the scope provided here
970+ to be retrieved (i.e. same keys and values). Order does not matter,
971+ but it is case-sensitive.
972+
973+ """
974+
975+ parameter_model = types ._RetrieveMemoryProfilesRequestParameters (
976+ name = name ,
977+ scope = scope ,
978+ config = config ,
979+ )
980+
981+ request_url_dict : Optional [dict [str , str ]]
982+ if not self ._api_client .vertexai :
983+ raise ValueError ("This method is only supported in the Vertex AI client." )
984+ else :
985+ request_dict = _RetrieveMemoryProfilesRequestParameters_to_vertex (
986+ parameter_model
987+ )
988+ request_url_dict = request_dict .get ("_url" )
989+ if request_url_dict :
990+ path = "{name}/memories:retrieveProfiles" .format_map (request_url_dict )
991+ else :
992+ path = "{name}/memories:retrieveProfiles"
993+
994+ query_params = request_dict .get ("_query" )
995+ if query_params :
996+ path = f"{ path } ?{ urlencode (query_params )} "
997+ # TODO: remove the hack that pops config.
998+ request_dict .pop ("config" , None )
999+
1000+ http_options : Optional [types .HttpOptions ] = None
1001+ if (
1002+ parameter_model .config is not None
1003+ and parameter_model .config .http_options is not None
1004+ ):
1005+ http_options = parameter_model .config .http_options
1006+
1007+ request_dict = _common .convert_to_dict (request_dict )
1008+ request_dict = _common .encode_unserializable_types (request_dict )
1009+
1010+ response = self ._api_client .request ("post" , path , request_dict , http_options )
1011+
1012+ response_dict = {} if not response .body else json .loads (response .body )
1013+
1014+ return_value = types .RetrieveProfilesResponse ._from_response (
1015+ response = response_dict , kwargs = parameter_model .model_dump ()
1016+ )
1017+
1018+ self ._api_client ._verify_response (return_value )
1019+ return return_value
1020+
9381021 def _rollback (
9391022 self ,
9401023 * ,
@@ -1909,6 +1992,74 @@ async def _retrieve(
19091992 self ._api_client ._verify_response (return_value )
19101993 return return_value
19111994
1995+ async def retrieve_profiles (
1996+ self ,
1997+ * ,
1998+ name : str ,
1999+ scope : dict [str , str ],
2000+ config : Optional [types .RetrieveMemoryProfilesConfigOrDict ] = None ,
2001+ ) -> types .RetrieveProfilesResponse :
2002+ """
2003+ Retrieves memory profiles for an Agent Engine.
2004+
2005+ Args:
2006+ name (str): Required. A fully-qualified resource name or ID such as
2007+ "projects/123/locations/us-central1/reasoningEngines/456".
2008+ scope (dict[str, str]): Required. The scope of the memories to retrieve.
2009+ A memory must have exactly the same scope as the scope provided here
2010+ to be retrieved (i.e. same keys and values). Order does not matter,
2011+ but it is case-sensitive.
2012+
2013+ """
2014+
2015+ parameter_model = types ._RetrieveMemoryProfilesRequestParameters (
2016+ name = name ,
2017+ scope = scope ,
2018+ config = config ,
2019+ )
2020+
2021+ request_url_dict : Optional [dict [str , str ]]
2022+ if not self ._api_client .vertexai :
2023+ raise ValueError ("This method is only supported in the Vertex AI client." )
2024+ else :
2025+ request_dict = _RetrieveMemoryProfilesRequestParameters_to_vertex (
2026+ parameter_model
2027+ )
2028+ request_url_dict = request_dict .get ("_url" )
2029+ if request_url_dict :
2030+ path = "{name}/memories:retrieveProfiles" .format_map (request_url_dict )
2031+ else :
2032+ path = "{name}/memories:retrieveProfiles"
2033+
2034+ query_params = request_dict .get ("_query" )
2035+ if query_params :
2036+ path = f"{ path } ?{ urlencode (query_params )} "
2037+ # TODO: remove the hack that pops config.
2038+ request_dict .pop ("config" , None )
2039+
2040+ http_options : Optional [types .HttpOptions ] = None
2041+ if (
2042+ parameter_model .config is not None
2043+ and parameter_model .config .http_options is not None
2044+ ):
2045+ http_options = parameter_model .config .http_options
2046+
2047+ request_dict = _common .convert_to_dict (request_dict )
2048+ request_dict = _common .encode_unserializable_types (request_dict )
2049+
2050+ response = await self ._api_client .async_request (
2051+ "post" , path , request_dict , http_options
2052+ )
2053+
2054+ response_dict = {} if not response .body else json .loads (response .body )
2055+
2056+ return_value = types .RetrieveProfilesResponse ._from_response (
2057+ response = response_dict , kwargs = parameter_model .model_dump ()
2058+ )
2059+
2060+ self ._api_client ._verify_response (return_value )
2061+ return return_value
2062+
19122063 async def _rollback (
19132064 self ,
19142065 * ,
0 commit comments