Getting Started
Knowledge Base
Use FutureAGI Knowledge Base to create and manage your knowledge base
You can checkout the colab notebook to quickly get started with the FutureAGI Knowledge Base.
Was this page helpful?
⌘I
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use FutureAGI Knowledge Base to create and manage your knowledge base
pip install futureagi
from fi.kb import KnowledgeBase
# Initialize the Knowledge Base client
kb_client = KnowledgeBase()
# Create a new knowledge base with files
kb_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 files
print(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 base
kb_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 files
print(f"Updated KB: {kb_client.kb.id}")
print(f"Total files: {len(kb_client.kb.files)}")
# Delete specific files from the knowledge base
file_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 files
print(f"Remaining files: {len(kb_client.kb.files)}")
# Delete the entire knowledge base
kb_id = kb_client.kb.id
kb_client = kb_client.delete_kb(kb_ids=[kb_id])
Was this page helpful?