Skip to main content

curator.LLM

curator.LLM is the main class for prompting LLMs in Curator. Calling an LLM object returns a CuratorResponse.

Constructor parameters

Class attributes

Call parameters

prompt()

Builds the prompt for one input row. It returns one of these.
  • A string, which Curator sends as a single user message.
  • A list of messages, each a dictionary with role and content.
  • A tuple of text and a curator.types.Image, for multimodal prompts.

parse()

Turns the LLM response into output rows. It gets the input row and the response, and returns one row as a dictionary or several rows as a list of dictionaries. The response is a string by default, an instance of response_format if you set one, or a dictionary if return_completions_object is True.

Backends

To use any other API that is compatible with the OpenAI API, set backend="openai" and pass base_url and api_key in backend_params. The Hugging Face Inference Providers guide shows an example.

Backend parameters

backend_params is a dictionary. The keys you can use depend on the mode.

Common parameters

These work with every backend.

Online parameters

These work in online mode, which is the default.

Batch parameters

These work when batch=True.

Offline parameters

These work with the vllm backend.

CuratorResponse

Every LLM call returns a CuratorResponse with these attributes.

Data

Model

Statistics

Other classes and functions

Environment variables