Overview

Here is a brief overview of the different concepts and how they work together. Please see the relevant sections in the sidebar for more details.

What is a Call?

In Opper, a call is the most primitive way of interacting with a generative model.

Opper calls are structured. This means that you need to declare input and output schemas whenever you want a model to do something.

Behind the scenes, the Opper API constructs prompts for the model to generate outputs that align with the desired schemas. The Opper platform implements best and emerging practices for structured generation, ensuring that the output consistently matches the desired schema. This includes optimizing prompts per model, performing retries with intelligent feedback, and more. A cool property of the Opper platform is that all actions that the Opper platform takes are completely observable in the form of traces.

Here is an example of a structured call that translates text to a given language:

This declarative nature of calls is quite different from the default model APIs, which are typically optimized for chat, with some structured output functionality added on top.

The benefits of defaulting to structured input and output are significant, such as:

  • They are model independent. Since you have clearly declared what you want, you can switch models without the task having to be described differently.
  • They work across modalities. Other modalities like voice, vision, and video don't fit chat as well as text. By starting from structure, you are setting yourself up for a better experience.
  • They are much easier to test, debug, and optimize as they are very clear in their task, input, and output.
  • They still allow you to build your own classes for use in chat messages and other use cases, but in a way that completely fits your use case.

What is an Index?

In Opper, an index is essentially a database with advanced semantic retrieval capabilities.

Indexes allow you to store data, knowledge, and information, and retrieve based on semantic similarity. This means that you can query the database not only for keywords but also for similar concepts.

For example, let's say you index large amounts of financial data, and you want to find the most relevant information about the question what is our ARR? You would do something like this to retrieve the 3 most relevant chunks of information:

What is a Trace?

A trace is a record of a call to a model. It contains the input, output, and other metadata. All interactions with the Opper platform are traced, and you can look at traces to deeply understand, debug, and correct your AI implementation.

Traces are very flexible and can be used to implement things like session logging, debugging, and more. For example, a trace of a complete end-user session in a chat app could look like this:

To have traces available from the start is of great benefit, as it allows you to experiment with different prompts, models, etc. faster and see exactly what the models are doing. In production, it is absolutely necessary as it is the only way for you to see the experience of your AI feature and how it is interacting with your users.

What is a Metric?

A metric in Opper is data you can attach to a trace to assign information on the performance of a given call. It is a simple way to build a feedback loop between your feature and yourself.

Being able to attach metrics to traces allows you to build features such as thumbs-up commands, or custom evaluations of calls and save them in the context of the call for later action.

For example, to attach a thumbs-up action to a call, you would do something like this:

What is an Example?

In Opper, an example is an example of a perfect execution of a call. An Example always includes a pair of input and output, and they allow you to show the model how perfect execution looks like for a given task and a set of inputs.

This technique is called few-shot prompting or in-context learning and is very powerful for steering the model to do what you want.

Opper supports examples in a call, but also offers a more automated way through datasets.

To provide examples with a call, you can do something like this:

This allows the model to see examples of how you would like output to look given some similar inputs. This technique can be used for steering output format as shown above, but it is even more powerful for reasoning-intensive tasks where you want to be able to describe how the model should think.

For more advanced usage of examples, you should use Datasets and automatic few-shot retrieval that automatically populates calls with the most semantically relevant examples for the input.

What is an Evaluation?

Evaluations are AI-powered observations that the Opper platform performs on calls. It effectively identifies if the call is performing well based on inputs, outputs, and instructions.

The benefit of evaluations is that they allow you to get an idea of high and low-performing AI calls, and they provide you with a way to see what is working and what is not.