Skip to main content

Models

Models are the foundation of intelligence in the aiXplain ecosystem. They encapsulate capabilities such as language understanding, translation, summarization, speech processing, and more. Models can be directly used or integrated as tools into agents.

Key Concepts:

  • Models are callable assets that accept text, audio, or other modalities.

  • They support multiple functions: generation, translation, classification, etc.

  • Models can be run synchronously, asynchronously, or in streaming mode.

  • Streaming responses yield results incrementally while status=IN_PROGRESS.

Listing Models

To explore all accessible models for your team:

from aixplain.factories import ModelFactory
models = ModelFactory.list(
function=Function.TRANSLATION,
source_languages=[Language.ENGLISH],
target_languages=[Language.FRENCH]
)
for model in model_list:
print(model.id, model.name, model.supplier)

Alternatively, browse models and other assets in the marketplace.

Parameters

ParameterTypeDescription
functionFunctionFilter by model function (e.g., TEXT_GENERATION, TRANSLATION, SUMMARIZATION).
querystrOptional keyword to search by name or description.
suppliersSupplier or List[Supplier]Filter by model supplier (e.g., OPENAI, HUGGINGFACE).
source_languagesLanguage or List[Language]Accepted source/input language(s).
target_languagesLanguage or List[Language]Output language(s), applicable to translation models.
is_finetunableboolWhether the model supports fine-tuning.
ownershipTuple[OwnershipType, List[OwnershipType]]Ownership filter: OWNER, SUBSCRIBED, PUBLIC.
sort_bySortByAttribute to sort by (e.g., NAME, CREATED_AT).
sort_orderSortOrderASCENDING or DESCENDING.
page_numberintPage number for paginated results.
page_sizeintMaximum number of results to return (default: 20).
model_idsList[str]Specific model IDs to retrieve. Cannot be used with other filters.
api_keystrOptional API key override for authorization.

Running a Model

You can run a model by calling run() with the desired input:

model = ModelFactory.get("65c51c556eb563350f6e1bb1")
response = model.run("Latest news about AI agents")
print(response.data.output)

Streaming Output for LLMs

To receive tokens incrementally for LLMs:

response = model.run("Explain LLMs", stream=True)
for chunk in response:
print(chunk)

Each chunk is a ModelResponse object with:

  • status: IN_PROGRESS or COMPLETED

  • data: Partial output (if available)

  • details: Full content generated so far

You can also use a loop with next(response) until status is COMPLETE.

response = model.run("Explain how to change a light bulb", max_tokens=512, stream=True)

while response.status == ResponseStatus.IN_PROGRESS:
content = next(response)
print(content)