Implementation:Elevenlabs Elevenlabs python GetKnowledgeBaseFileResponseModel
| Attribute | Value |
|---|---|
| Page Type | Implementation |
| Package | elevenlabs |
| Module | elevenlabs.types.get_knowledge_base_file_response_model |
| Class | GetKnowledgeBaseFileResponseModel |
| Base Class | UncheckedBaseModel |
| Source File | src/elevenlabs/types/get_knowledge_base_file_response_model.py |
| Auto-Generated | Yes (Fern API Definition) |
Overview
Description
GetKnowledgeBaseFileResponseModel is a Pydantic-based data model representing the full response for a file-type knowledge base document. It includes identification fields, document metadata, supported usage modes, access control information, folder hierarchy details, the extracted HTML content, and the original filename.
Usage
This model is returned by API endpoints that retrieve detailed information about a specific file stored in the knowledge base. It provides access to both the document metadata and the extracted content (as inner HTML), making it suitable for displaying file details or processing file content programmatically.
Code Reference
Source Location
src/elevenlabs/types/get_knowledge_base_file_response_model.py
Class Signature
class GetKnowledgeBaseFileResponseModel(UncheckedBaseModel):
...
Import Statement
from elevenlabs.types.get_knowledge_base_file_response_model import GetKnowledgeBaseFileResponseModel
I/O Contract
| Field Name | Type | Required | Default | Description |
|---|---|---|---|---|
| id | str | Yes | N/A | Unique identifier of the knowledge base file |
| name | str | Yes | N/A | Name of the knowledge base file |
| metadata | KnowledgeBaseDocumentMetadataResponseModel | Yes | N/A | Document metadata including status and processing details |
| supported_usages | List[DocumentUsageModeEnum] | Yes | N/A | List of supported usage modes for this document |
| access_info | ResourceAccessInfo | Yes | N/A | Access control information for the resource |
| folder_parent_id | Optional[str] | No | None | The ID of the parent folder, or null if the document is at the root level |
| folder_path | Optional[List[KnowledgeBaseFolderPathSegmentResponseModel]] | No | None | The folder path segments leading to this entity, from root to parent folder |
| extracted_inner_html | str | Yes | N/A | The extracted HTML content of the file |
| filename | str | Yes | N/A | The original filename of the uploaded file |
Usage Examples
Accessing File Details from an API Response
from elevenlabs.types.get_knowledge_base_file_response_model import GetKnowledgeBaseFileResponseModel
# Assuming `response` is a GetKnowledgeBaseFileResponseModel returned by the API
print(f"File: {response.filename}")
print(f"Name: {response.name}")
print(f"ID: {response.id}")
print(f"Supported usages: {response.supported_usages}")
Working with Folder Path and Content
# Display the folder hierarchy
if response.folder_path:
path_str = " / ".join(segment.name for segment in response.folder_path)
print(f"Path: {path_str}")
# Access the extracted content
content = response.extracted_inner_html
print(f"Content length: {len(content)} characters")