SDK Reference
KnowledgeBase
Reference for the KnowledgeBase class in the Future AGI Python SDK.
KnowledgeBase
Class
The KnowledgeBase
class provides a client for managing knowledge bases, including creating, updating, and deleting knowledge bases and their files.
Initialization
Arguments:
kbase
(Optional[KnowledgeBaseConfig]): The configuration for the knowledge base. If provided and has no ID, the config will be fetched by name.fi_api_key
(Optional[str]): API key for authentication.fi_secret_key
(Optional[str]): Secret key for authentication.fi_base_url
(Optional[str]): Base URL for the API.**kwargs
: Additional keyword arguments for advanced configuration.
Raises:
SDKException
: If the knowledge base is not found or already exists.
KnowledgeBaseConfig
Class
The KnowledgeBaseConfig
class defines the configuration and metadata for a knowledge base.
Attributes:
id
(Optional[uuid.UUID]): Unique identifier for the knowledge base.name
(str): Name of the knowledge base.status
(str): Status of the knowledge base (default:"PROCESSING"
).last_error
(Optional[str]): Last error message, if any.files
(List[str]): List of file names associated with the knowledge base.
Instance Methods
create_kb
Creates a new knowledge base and optionally uploads files.
Arguments:
name
(Optional[str]): Name of the knowledge base.file_paths
(Optional[Union[str, List[str]]]): List of file paths or a directory path to upload.
Returns:
KnowledgeBase
instance (self, for chaining)
Raises:
SDKException
: If a knowledge base already exists or file upload fails.
update_kb
Updates the name of the knowledge base and/or adds files to it.
Arguments:
name
(Optional[str]): New name for the knowledge base.file_paths
(Optional[Union[str, List[str]]]): List of file paths or a directory path to upload.
Returns:
KnowledgeBase
instance (self, for chaining)
Raises:
SDKException
: If update fails or file upload fails.
delete_files_from_kb
Deletes files from the knowledge base.
Arguments:
file_names
(List[str]): List of file names to delete.
Returns:
KnowledgeBase
instance (self, for chaining)
Raises:
SDKException
: If deletion fails.
delete_kb
Deletes a knowledge base by ID(s).
Arguments:
kb_ids
(Optional[Union[str, List[str]]]): List of knowledge base IDs or a single ID to delete. If not provided, deletes the currently configured knowledge base.
Returns:
KnowledgeBase
instance (self, for chaining)
Raises:
SDKException
: If deletion fails.