Skip to main content

Files

The files resource manages indexed documents (EliseFiles) on the Elise platform. It is available via client.files.

import asyncio
from biolevate import BiolevateClient

async def main():
async with BiolevateClient(
base_url="https://<api-domain>",
token="<your-pat>",
) as client:
file = await client.files.create(
provider_id="550e8400-e29b-41d4-a716-446655440000",
key="reports/research-paper.pdf",
)
print(f"Created EliseFile: {file.id.id}")

asyncio.run(main())
Indexation is asynchronous

Creating a file triggers indexation in the background. Poll client.files.get(file_id) and check file.last_indexation_infos.status until it reaches SUCCESS or FAILED.

Methods

create()

Create an EliseFile from a file that already exists in a provider. This triggers indexation.

file = await client.files.create(
provider_id="550e8400-e29b-41d4-a716-446655440000",
key="reports/research-paper.pdf",
)
print(f"Created: {file.id.id} (indexed: {file.indexed})")
ParameterTypeDescription
provider_idstrUUID of the provider
keystrFull file key in the provider

Returns File

Raises NotFoundError, AuthenticationError, APIError


list()

List indexed EliseFiles for a provider with pagination.

page = await client.files.list(
provider_id="550e8400-e29b-41d4-a716-446655440000",
page=0,
page_size=20,
)
for file in page.data:
print(f"{file.name} (indexed: {file.indexed})")
ParameterTypeDefaultDescription
provider_idstrUUID of the provider
pageint0Page number (0-based)
page_sizeint20Number of files per page
sort_propertystr | NoneNoneField to sort by
sort_orderstr | NoneNone"ASC" or "DESC"

Returns FilePage

Raises AuthenticationError, APIError


get()

Retrieve a single EliseFile by its UUID, including its current indexation status.

file = await client.files.get("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
print(f"{file.name}: indexed={file.indexed}")
if file.last_indexation_infos:
print(f"Status: {file.last_indexation_infos.status}")
ParameterTypeDescription
file_idstrUUID of the EliseFile

Returns File

Raises NotFoundError, AuthenticationError, APIError


delete()

Delete an EliseFile from the Elise index. The original file in the provider is not affected.

await client.files.delete("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
ParameterTypeDescription
file_idstrUUID of the EliseFile

Returns None

Raises NotFoundError, AuthenticationError, APIError


reindex()

Force reindexation of an already indexed file.

await client.files.reindex("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
ParameterTypeDescription
file_idstrUUID of the EliseFile

Returns File

Raises NotFoundError, AuthenticationError, APIError


get_ontologies()

Retrieve AI-extracted ontologies (concepts and metadata) for an indexed file.

ontologies = await client.files.get_ontologies("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
for ontology in ontologies:
print(f"Concept: {ontology.name}")
if ontology.metas:
for key, meta in ontology.metas.items():
print(f" {key}: {meta.meta_value}")
ParameterTypeDescription
file_idstrUUID of the EliseFile

Returns list[Ontology]

Raises NotFoundError, AuthenticationError, APIError


recompute_ontologies()

Force recomputation of AI-extracted ontologies without reindexing the full document.

await client.files.recompute_ontologies("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
ParameterTypeDescription
file_idstrUUID of the EliseFile

Returns File

Raises NotFoundError, AuthenticationError, APIError

Full Example — Index and Poll

import asyncio
import time
from biolevate import BiolevateClient, NotFoundError, APIError

async def main():
async with BiolevateClient(
base_url="https://<api-domain>",
token="<your-pat>",
) as client:
provider_id = "550e8400-e29b-41d4-a716-446655440000"

file = await client.files.create(
provider_id=provider_id,
key="reports/research-paper.pdf",
)
file_id = file.id.id
print(f"Created EliseFile: {file_id}")

while True:
info = await client.files.get(file_id)
status = info.last_indexation_infos.status if info.last_indexation_infos else "UNKNOWN"
print(f"Indexation status: {status}")
if status in ("SUCCESS", "FAILED", "ABORTED"):
break
await asyncio.sleep(3)

if status == "SUCCESS":
ontologies = await client.files.get_ontologies(file_id)
print(f"Extracted {len(ontologies)} concepts")
for o in ontologies[:5]:
print(f" {o.name}")

asyncio.run(main())

Next Steps