Skip to main content
Lyceum serves open models through an OpenAI-compatible serverless endpoint. Pair them with LightOn search to build RAG pipelines where the retrieval stays on LightOn’s infrastructure and the generation runs on Lyceum. The flow is:
  1. Search LightOn for the passages most relevant to the user’s question.
  2. Pack those passages into the model’s context window.
  3. Call the Lyceum model to generate an answer grounded in the retrieved content.

Prerequisites

  • A LIGHTON_API_KEY, available in the Console → API Keys section.
  • A Lyceum API key. Store it as LYCEUM_API_KEY.
  • At least one workspace with indexed documents on LightOn.

Installation

The openai package is used here only for its client; Lyceum’s endpoint is fully compatible with it.

Full example

LightOn search as a tool

Instead of always searching before calling the model, you can expose LightOn search as a tool and let the model decide when to call it. The model issues a lighton_search tool call when it needs context; your code executes the search and feeds the results back; the model then produces a final answer.
The loop handles the case where the model issues multiple search calls in sequence before producing a final answer.

Multimodal input

Several models on Lyceum (such as openbmb/MiniCPM-V-4_5) are vision-language models that accept images alongside text. Pass an image_url content part to describe or reason over an image:
You can combine this with LightOn search to ground answers about an image in your indexed documents.

Scoping retrieval to a workspace

Pass workspace_id to limit search to a specific workspace. This is useful in multi-tenant products where each customer’s data lives in a dedicated workspace.

Choosing a model

Lyceum’s catalog includes a wide range of hosted models. Pass the model name to the model parameter: You can list the models available to your key at any time:
Check the Lyceum documentation for the current model list and pricing.

Streaming responses

Lyceum’s endpoint supports streaming. Enable it by passing stream=True and iterating over the response: