Skip to main content

Primitives

A primitive is a single Python function that is executed as a part of a task. RunLLM comes with 5 default primitives read, write, embed, retrieve, generate and a catch-all custom primitive that allows you to write arbitrary Python code. Each primitive is strongly typed and comes with a default implementation using state-of-the-art open-source tools like LangChain and Llama Index. Primitives come with sensible defaults for LLM parameters, all of which can be configured; primitives can also be fully customized with bespoke implementations.

This page provides you an overview of each primitive, and the detailed pages for each primitive expand on how to use and customize each one.

  • The embed primitive allows you to take a piece of text and generate a numerical vector representation for that text.
  • The read primitive allows you to load data into a RunLLM task. read can use one of many off-the-shelf data connectors to SQL systems and document systems.
  • The write primitive allows you to persist data to a storage system.
  • The retrieve primitive allows you to search a vector database for the most relevant documents to a particular piece of text.
  • The generate primitive allows you to send a prompt to an LLM's generation API.
  • The custom allows you to execute arbitrary Python code without type restrictions.