KnowledgeBase Class
The KnowledgeBase class provides a client for managing knowledge bases, including creating, updating, and deleting knowledge bases and their files.
Initialization
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.
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.
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.
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.
KnowledgeBaseinstance (self, for chaining)
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.
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.
KnowledgeBaseinstance (self, for chaining)
SDKException: If update fails or file upload fails.
delete_files_from_kb
Deletes files from the knowledge base.
file_names(List[str]): List of file names to delete.
KnowledgeBaseinstance (self, for chaining)
SDKException: If deletion fails.
delete_kb
Deletes a knowledge base by ID(s).
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.
KnowledgeBaseinstance (self, for chaining)
SDKException: If deletion fails.