88import httpx
99
1010from ..types import memory_add_params , memory_list_params , memory_update_params , memory_upload_file_params
11- from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven , FileTypes
11+ from .._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven , FileTypes
1212from .._utils import extract_files , maybe_transform , deepcopy_minimal , async_maybe_transform
1313from .._compat import cached_property
1414from .._resource import SyncAPIResource , AsyncAPIResource
2222from ..types .memory_add_response import MemoryAddResponse
2323from ..types .memory_get_response import MemoryGetResponse
2424from ..types .memory_list_response import MemoryListResponse
25- from ..types .memory_delete_response import MemoryDeleteResponse
2625from ..types .memory_update_response import MemoryUpdateResponse
2726from ..types .memory_upload_file_response import MemoryUploadFileResponse
2827
@@ -51,10 +50,12 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
5150
5251 def update (
5352 self ,
54- id : str ,
53+ path_id : str ,
5554 * ,
55+ body_id : str ,
5656 content : str ,
5757 container_tags : List [str ] | NotGiven = NOT_GIVEN ,
58+ custom_id : str | NotGiven = NOT_GIVEN ,
5859 metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
5960 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6061 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -67,6 +68,29 @@ def update(
6768 Update a memory with any content type (text, url, file, etc.) and metadata
6869
6970 Args:
71+ body_id: Unique identifier of the memory.
72+
73+ content: The content to extract and process into a memory. This can be a URL to a
74+ website, a PDF, an image, or a video.
75+
76+ Plaintext: Any plaintext format
77+
78+ URL: A URL to a website, PDF, image, or video
79+
80+ We automatically detect the content type from the url's response format.
81+
82+ container_tags: Optional tags this memory should be containerized by. This can be an ID for your
83+ user, a project ID, or any other identifier you wish to use to group memories.
84+
85+ custom_id: Optional custom ID of the memory. This could be an ID from your database that
86+ will uniquely identify this memory.
87+
88+ metadata: Optional metadata for the memory. This is used to store additional information
89+ about the memory. You can use this to store any additional information you need
90+ about the memory. Metadata can be filtered through. Keys must be strings and are
91+ case sensitive. Values can be strings, numbers, or booleans. You cannot nest
92+ objects.
93+
7094 extra_headers: Send extra headers
7195
7296 extra_query: Add additional query parameters to the request
@@ -75,14 +99,16 @@ def update(
7599
76100 timeout: Override the client-level default timeout for this request, in seconds
77101 """
78- if not id :
79- raise ValueError (f"Expected a non-empty value for `id ` but received { id !r} " )
102+ if not path_id :
103+ raise ValueError (f"Expected a non-empty value for `path_id ` but received { path_id !r} " )
80104 return self ._patch (
81- f"/v3/memories/{ id } " ,
105+ f"/v3/memories/{ path_id } " ,
82106 body = maybe_transform (
83107 {
108+ "body_id" : body_id ,
84109 "content" : content ,
85110 "container_tags" : container_tags ,
111+ "custom_id" : custom_id ,
86112 "metadata" : metadata ,
87113 },
88114 memory_update_params .MemoryUpdateParams ,
@@ -161,7 +187,7 @@ def delete(
161187 extra_query : Query | None = None ,
162188 extra_body : Body | None = None ,
163189 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
164- ) -> MemoryDeleteResponse :
190+ ) -> None :
165191 """
166192 Delete a memory
167193
@@ -176,19 +202,21 @@ def delete(
176202 """
177203 if not id :
178204 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
205+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
179206 return self ._delete (
180207 f"/v3/memories/{ id } " ,
181208 options = make_request_options (
182209 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
183210 ),
184- cast_to = MemoryDeleteResponse ,
211+ cast_to = NoneType ,
185212 )
186213
187214 def add (
188215 self ,
189216 * ,
190217 content : str ,
191218 container_tags : List [str ] | NotGiven = NOT_GIVEN ,
219+ custom_id : str | NotGiven = NOT_GIVEN ,
192220 metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
193221 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
194222 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -201,6 +229,27 @@ def add(
201229 Add a memory with any content type (text, url, file, etc.) and metadata
202230
203231 Args:
232+ content: The content to extract and process into a memory. This can be a URL to a
233+ website, a PDF, an image, or a video.
234+
235+ Plaintext: Any plaintext format
236+
237+ URL: A URL to a website, PDF, image, or video
238+
239+ We automatically detect the content type from the url's response format.
240+
241+ container_tags: Optional tags this memory should be containerized by. This can be an ID for your
242+ user, a project ID, or any other identifier you wish to use to group memories.
243+
244+ custom_id: Optional custom ID of the memory. This could be an ID from your database that
245+ will uniquely identify this memory.
246+
247+ metadata: Optional metadata for the memory. This is used to store additional information
248+ about the memory. You can use this to store any additional information you need
249+ about the memory. Metadata can be filtered through. Keys must be strings and are
250+ case sensitive. Values can be strings, numbers, or booleans. You cannot nest
251+ objects.
252+
204253 extra_headers: Send extra headers
205254
206255 extra_query: Add additional query parameters to the request
@@ -215,6 +264,7 @@ def add(
215264 {
216265 "content" : content ,
217266 "container_tags" : container_tags ,
267+ "custom_id" : custom_id ,
218268 "metadata" : metadata ,
219269 },
220270 memory_add_params .MemoryAddParams ,
@@ -320,10 +370,12 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
320370
321371 async def update (
322372 self ,
323- id : str ,
373+ path_id : str ,
324374 * ,
375+ body_id : str ,
325376 content : str ,
326377 container_tags : List [str ] | NotGiven = NOT_GIVEN ,
378+ custom_id : str | NotGiven = NOT_GIVEN ,
327379 metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
328380 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
329381 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -336,6 +388,29 @@ async def update(
336388 Update a memory with any content type (text, url, file, etc.) and metadata
337389
338390 Args:
391+ body_id: Unique identifier of the memory.
392+
393+ content: The content to extract and process into a memory. This can be a URL to a
394+ website, a PDF, an image, or a video.
395+
396+ Plaintext: Any plaintext format
397+
398+ URL: A URL to a website, PDF, image, or video
399+
400+ We automatically detect the content type from the url's response format.
401+
402+ container_tags: Optional tags this memory should be containerized by. This can be an ID for your
403+ user, a project ID, or any other identifier you wish to use to group memories.
404+
405+ custom_id: Optional custom ID of the memory. This could be an ID from your database that
406+ will uniquely identify this memory.
407+
408+ metadata: Optional metadata for the memory. This is used to store additional information
409+ about the memory. You can use this to store any additional information you need
410+ about the memory. Metadata can be filtered through. Keys must be strings and are
411+ case sensitive. Values can be strings, numbers, or booleans. You cannot nest
412+ objects.
413+
339414 extra_headers: Send extra headers
340415
341416 extra_query: Add additional query parameters to the request
@@ -344,14 +419,16 @@ async def update(
344419
345420 timeout: Override the client-level default timeout for this request, in seconds
346421 """
347- if not id :
348- raise ValueError (f"Expected a non-empty value for `id ` but received { id !r} " )
422+ if not path_id :
423+ raise ValueError (f"Expected a non-empty value for `path_id ` but received { path_id !r} " )
349424 return await self ._patch (
350- f"/v3/memories/{ id } " ,
425+ f"/v3/memories/{ path_id } " ,
351426 body = await async_maybe_transform (
352427 {
428+ "body_id" : body_id ,
353429 "content" : content ,
354430 "container_tags" : container_tags ,
431+ "custom_id" : custom_id ,
355432 "metadata" : metadata ,
356433 },
357434 memory_update_params .MemoryUpdateParams ,
@@ -430,7 +507,7 @@ async def delete(
430507 extra_query : Query | None = None ,
431508 extra_body : Body | None = None ,
432509 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
433- ) -> MemoryDeleteResponse :
510+ ) -> None :
434511 """
435512 Delete a memory
436513
@@ -445,19 +522,21 @@ async def delete(
445522 """
446523 if not id :
447524 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
525+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
448526 return await self ._delete (
449527 f"/v3/memories/{ id } " ,
450528 options = make_request_options (
451529 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
452530 ),
453- cast_to = MemoryDeleteResponse ,
531+ cast_to = NoneType ,
454532 )
455533
456534 async def add (
457535 self ,
458536 * ,
459537 content : str ,
460538 container_tags : List [str ] | NotGiven = NOT_GIVEN ,
539+ custom_id : str | NotGiven = NOT_GIVEN ,
461540 metadata : Dict [str , Union [str , float , bool ]] | NotGiven = NOT_GIVEN ,
462541 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
463542 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -470,6 +549,27 @@ async def add(
470549 Add a memory with any content type (text, url, file, etc.) and metadata
471550
472551 Args:
552+ content: The content to extract and process into a memory. This can be a URL to a
553+ website, a PDF, an image, or a video.
554+
555+ Plaintext: Any plaintext format
556+
557+ URL: A URL to a website, PDF, image, or video
558+
559+ We automatically detect the content type from the url's response format.
560+
561+ container_tags: Optional tags this memory should be containerized by. This can be an ID for your
562+ user, a project ID, or any other identifier you wish to use to group memories.
563+
564+ custom_id: Optional custom ID of the memory. This could be an ID from your database that
565+ will uniquely identify this memory.
566+
567+ metadata: Optional metadata for the memory. This is used to store additional information
568+ about the memory. You can use this to store any additional information you need
569+ about the memory. Metadata can be filtered through. Keys must be strings and are
570+ case sensitive. Values can be strings, numbers, or booleans. You cannot nest
571+ objects.
572+
473573 extra_headers: Send extra headers
474574
475575 extra_query: Add additional query parameters to the request
@@ -484,6 +584,7 @@ async def add(
484584 {
485585 "content" : content ,
486586 "container_tags" : container_tags ,
587+ "custom_id" : custom_id ,
487588 "metadata" : metadata ,
488589 },
489590 memory_add_params .MemoryAddParams ,
0 commit comments