77
88import httpx
99
10- from ..types import memory_add_params , memory_list_params
10+ from ..types import memory_add_params , memory_list_params , memory_update_params
1111from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
1212from .._utils import maybe_transform , async_maybe_transform
1313from .._compat import cached_property
2323from ..types .memory_get_response import MemoryGetResponse
2424from ..types .memory_list_response import MemoryListResponse
2525from ..types .memory_delete_response import MemoryDeleteResponse
26+ from ..types .memory_update_response import MemoryUpdateResponse
2627
2728__all__ = ["MemoriesResource" , "AsyncMemoriesResource" ]
2829
@@ -47,6 +48,50 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
4748 """
4849 return MemoriesResourceWithStreamingResponse (self )
4950
51+ def update (
52+ self ,
53+ id : str ,
54+ * ,
55+ content : str ,
56+ container_tags : List [str ] | NotGiven = NOT_GIVEN ,
57+ metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
58+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
59+ # The extra values given here take precedence over values defined on the client or passed to this method.
60+ extra_headers : Headers | None = None ,
61+ extra_query : Query | None = None ,
62+ extra_body : Body | None = None ,
63+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
64+ ) -> MemoryUpdateResponse :
65+ """
66+ Update a memory with any content type (text, url, file, etc.) and metadata
67+
68+ Args:
69+ extra_headers: Send extra headers
70+
71+ extra_query: Add additional query parameters to the request
72+
73+ extra_body: Add additional JSON properties to the request
74+
75+ timeout: Override the client-level default timeout for this request, in seconds
76+ """
77+ if not id :
78+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
79+ return self ._patch (
80+ f"/v3/memories/{ id } " ,
81+ body = maybe_transform (
82+ {
83+ "content" : content ,
84+ "container_tags" : container_tags ,
85+ "metadata" : metadata ,
86+ },
87+ memory_update_params .MemoryUpdateParams ,
88+ ),
89+ options = make_request_options (
90+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
91+ ),
92+ cast_to = MemoryUpdateResponse ,
93+ )
94+
5095 def list (
5196 self ,
5297 * ,
@@ -233,6 +278,50 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
233278 """
234279 return AsyncMemoriesResourceWithStreamingResponse (self )
235280
281+ async def update (
282+ self ,
283+ id : str ,
284+ * ,
285+ content : str ,
286+ container_tags : List [str ] | NotGiven = NOT_GIVEN ,
287+ metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
288+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
289+ # The extra values given here take precedence over values defined on the client or passed to this method.
290+ extra_headers : Headers | None = None ,
291+ extra_query : Query | None = None ,
292+ extra_body : Body | None = None ,
293+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
294+ ) -> MemoryUpdateResponse :
295+ """
296+ Update a memory with any content type (text, url, file, etc.) and metadata
297+
298+ Args:
299+ extra_headers: Send extra headers
300+
301+ extra_query: Add additional query parameters to the request
302+
303+ extra_body: Add additional JSON properties to the request
304+
305+ timeout: Override the client-level default timeout for this request, in seconds
306+ """
307+ if not id :
308+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
309+ return await self ._patch (
310+ f"/v3/memories/{ id } " ,
311+ body = await async_maybe_transform (
312+ {
313+ "content" : content ,
314+ "container_tags" : container_tags ,
315+ "metadata" : metadata ,
316+ },
317+ memory_update_params .MemoryUpdateParams ,
318+ ),
319+ options = make_request_options (
320+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
321+ ),
322+ cast_to = MemoryUpdateResponse ,
323+ )
324+
236325 async def list (
237326 self ,
238327 * ,
@@ -403,6 +492,9 @@ class MemoriesResourceWithRawResponse:
403492 def __init__ (self , memories : MemoriesResource ) -> None :
404493 self ._memories = memories
405494
495+ self .update = to_raw_response_wrapper (
496+ memories .update ,
497+ )
406498 self .list = to_raw_response_wrapper (
407499 memories .list ,
408500 )
@@ -421,6 +513,9 @@ class AsyncMemoriesResourceWithRawResponse:
421513 def __init__ (self , memories : AsyncMemoriesResource ) -> None :
422514 self ._memories = memories
423515
516+ self .update = async_to_raw_response_wrapper (
517+ memories .update ,
518+ )
424519 self .list = async_to_raw_response_wrapper (
425520 memories .list ,
426521 )
@@ -439,6 +534,9 @@ class MemoriesResourceWithStreamingResponse:
439534 def __init__ (self , memories : MemoriesResource ) -> None :
440535 self ._memories = memories
441536
537+ self .update = to_streamed_response_wrapper (
538+ memories .update ,
539+ )
442540 self .list = to_streamed_response_wrapper (
443541 memories .list ,
444542 )
@@ -457,6 +555,9 @@ class AsyncMemoriesResourceWithStreamingResponse:
457555 def __init__ (self , memories : AsyncMemoriesResource ) -> None :
458556 self ._memories = memories
459557
558+ self .update = async_to_streamed_response_wrapper (
559+ memories .update ,
560+ )
460561 self .list = async_to_streamed_response_wrapper (
461562 memories .list ,
462563 )
0 commit comments