# Create a new knowledge base with fileskb_client = kb_client.create_kb( name="my_knowledge_base", # Choose a unique name file_paths=["path/to/file1.txt", "path/to/file2.txt"] # List of file paths to include)# The created KB will have an ID and list of filesprint(f"Created KB: {kb_client.kb.id} with name: {kb_client.kb.name}")print(f"Number of files: {len(kb_client.kb.files)}")
# Add new files to the existing knowledge basekb_client = kb_client.update_kb( file_paths=["path/to/new_file.txt"] # List of new file paths to add)# The updated KB will have the new filesprint(f"Updated KB: {kb_client.kb.id}")print(f"Total files: {len(kb_client.kb.files)}")
# Delete specific files from the knowledge basefile_names = ["file_to_delete.txt"]kb_client = kb_client.delete_files_from_kb( file_names=file_names # List of file names to delete)# The KB will now have fewer filesprint(f"Remaining files: {len(kb_client.kb.files)}")