File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ def main():
21
21
22
22
# Memory name and document ID to delete
23
23
memory_name = "product-knowledge" # Replace with your memory name
24
- document_name = "name .txt" # Replace with the document name you want to delete
24
+ document_name = "intro .txt" # Replace with the document name you want to delete
25
25
26
26
# Delete the document
27
27
try :
28
28
response = lb .memories .documents .delete (
29
- memory_name = memory_name , document_name = document_id
29
+ memory_name = memory_name , document_name = document_name
30
30
)
31
31
32
32
print (
33
- f"Document '{ document_id } ' deleted successfully from memory '{ memory_name } '"
33
+ f"Document '{ document_name } ' deleted successfully from memory '{ memory_name } '"
34
34
)
35
35
print (json .dumps (response , indent = 2 ))
36
36
Original file line number Diff line number Diff line change @@ -23,17 +23,16 @@ def main():
23
23
24
24
# Upload documents to the memory
25
25
try :
26
- # Example 1: Upload string content as bytes
27
- content1 = "Langbase is a powerful platform for building AI applications with composable AI."
28
- response1 = lb .memories .documents .upload (
26
+ content = "Langbase is a powerful platform for building AI applications with composable AI."
27
+ response = lb .memories .documents .upload (
29
28
memory_name = memory_name ,
30
29
document_name = "intro.txt" ,
31
- document = content1 .encode ("utf-8" ), # Convert string to bytes
30
+ document = content .encode ("utf-8" ), # Convert string to bytes
32
31
content_type = "text/plain" ,
33
32
meta = {"source" : "documentation" , "section" : "introduction" },
34
33
)
35
- print ("Document 1 uploaded successfully!" )
36
- print (f"Status: { response1 .status_code } " )
34
+ print ("Document uploaded successfully!" )
35
+ print (f"Status: { response .status_code } " )
37
36
38
37
except Exception as e :
39
38
print (f"Error uploading documents: { e } " )
You can’t perform that action at this time.
0 commit comments