Model configuration#
CyteOnto uses two models. An LLM, called through a pydantic-ai agent, describes cell
types and splits compound labels, and an embedding model turns the descriptions into
vectors. LlmConfig names the LLM of the agent, and EmbdConfig configures the
embedding requests. The ModelArtifactKey of each model names the cache files, so each
model pair has files of its own. Descriptions from a fallback agent are saved in the files
of the primary LLM.
from cyteonto import EmbdConfig, LlmConfig
llm = LlmConfig(provider="nebius", model="moonshotai/Kimi-K2.6")
embedding = EmbdConfig(provider="nebius", model="Qwen/Qwen3-Embedding-8B")
These two configurations match the precomputed ontology files that
python -m cyteonto.setup downloads. Models and providers
explains how to choose a model pair, set API keys and add fallback models.
- class cyteonto.LlmConfig(*, provider, model)#
LLM routing identity for description generation caches.
modelmust equal themodel_nameof the agent’s model.provideris only a label for the cache files; the agent decides where requests go.- provider: str#
Required. Provider slug, such as
nebius,fireworksortogether. It is lowercased in the cache key.
- model: str#
Required. The model id, as
agent.model.model_namereports it, such asmoonshotai/Kimi-K2.6.
- to_artifact_key()#
Return the cache key of this model.
- Return type:
- class cyteonto.EmbdConfig(*, provider='openrouter', model='qwen/qwen3-embedding-8b', apiKey=None, modelSettings=None, maxConcurrent=10)#
Parameters used to call an embedding provider.
Defaults target OpenRouter with
qwen/qwen3-embedding-8brouted primarily to DeepInfra. PassmodelSettings={}to disable the default routing, or override it with your own{"provider": {...}}block.- provider: str = 'openrouter'#
The embedding provider:
deepinfra,fireworks,google,nebius,ollama,openai,openrouterortogether.ollamasends the requests to a local Ollama server and needs no API key.
- model: str = 'qwen/qwen3-embedding-8b'#
The model id, as the provider names it. It also names the cache files, so its case matters.
- apiKey: str | None = None#
API key of the provider. When
None,CyteOntoreads it from the provider’s environment variable, such asNEBIUS_API_KEY, or else fromEMBEDDING_MODEL_API_KEY.
- modelSettings: dict[str, Any] | None = None#
Fields added to each request body, for
openrouteronly. Foropenrouter,Nonebecomes{"provider": {"order": ["deepinfra"], "allow_fallbacks": True}}, which routes requests to DeepInfra first. Pass{}to send no routing.
- maxConcurrent: int = 10#
Maximum number of embedding requests that run at the same time; at least 1. Each text is sent in a request of its own.
- to_artifact_key()#
Return the cache key of this model.
- Return type:
- class cyteonto.ModelArtifactKey(*, provider, model)#
Canonical cache key for an LLM or embedding model configuration.
The provider is lowercased; the model id keeps its case.
filename_segment()names the cache files of the model.- provider: str#
Required. Provider slug, lowercased.
- model: str#
Required. The full model id.
- property company: str#
The part of
modelbefore the first/, or all of it.
- property modelName: str#
The part of
modelafter the first/, or all of it.
- filename_segment()#
{provider}_{company}-{modelName}after filesystem sanitization./and:become-, and spaces become_. For example,nebiusandmoonshotai/Kimi-K2.6givenebius_moonshotai-Kimi-K2.6.- Return type:
str
- classmethod from_provider_model(provider, model)#
Return the key of
modelserved byprovider.- Return type: