Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Environment and limits

Environment variables

VariableReadPurposeDefault
NEBIUS_API_KEY, DEEPINFRA_API_KEY, FIREWORKS_API_KEY, GOOGLE_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, TOGETHER_API_KEYWhen CyteOnto is createdThe API key of the embedding provider, when EmbdConfig.apiKey is NoneUnset
EMBEDDING_MODEL_API_KEYWhen cyteonto is importedThe embedding API key when the provider’s own variable is unsetEmpty
NCBI_API_KEYWhen cyteonto is importedSent with PubMed searches, to raise NCBI’s rate limitEmpty
CYTEONTO_LOG_LEVELWhen cyteonto is importedThe log level, such as DEBUG, INFO or WARNINGDEBUG
CYTEONTO_LOG_FILEWhen cyteonto is importedA file to write the log to as well, rotated at 10 MBUnset

Set the variables that are read on import before the first import cyteonto. When it is imported, cyteonto loads a .env file with python-dotenv: in a notebook or another interactive session, the nearest one from the working directory up, and in a script, the nearest one from the installed package’s directory up. Variables that are already set keep their values. In a script, call load_dotenv() from the dotenv package yourself to load the .env file next to the script.

CyteOnto does not read the API key of the LLM: you give it to the pydantic-ai provider of your agent, which may read its own variable, such as OPENAI_API_KEY, when you do not.

Logging

CyteOnto logs with loguru to standard output, as LEVEL: message, and to CYTEONTO_LOG_FILE with timestamps. When imported, it removes the handlers of loguru’s global logger and adds its own, so configure your own loguru handlers after importing cyteonto.

At the INFO level, the log shows the progress of descriptions and embeddings, the generated run IDs and the files that are read and written. DEBUG, the default, adds details such as missing embeddings. WARNING shows only failed attempts, labels that stayed undescribed and other problems.

Retries and limits

These rules are set in the code, mostly in cyteonto.config.Config. Only the concurrency limits are options of CyteOnto.

RuleValue
Attempts per LLM request, to describe or to split a label5, with waits of 1, 2, 4 and 8 seconds
Time limit per LLM attempt120 seconds
Second pass over the labels whose description failedOnce, after 5 seconds, with 5 attempts per label
Usage limits per description or split50 requests and 60,000 input tokens
PubMed searches per descriptionAt most 3, as the prompt asks
Attempts per embedding request3, with waits of 1 and 2 seconds
Time limit per embedding request5 minutes, the default of aiohttp
Concurrent LLM requestsmax_description_concurrency, 100 by default
Concurrent embedding requestsEmbdConfig.maxConcurrent, 10 by default

LLM requests are retried after errors of the model’s API, such as HTTP and connection errors, unexpected model behavior, output that fails validation and attempts that run out of time. A request that exceeds the usage limits is not retried. When all attempts fail:

Troubleshooting lists the errors and what to do about them.