Skip to main content
Zenbase also supports online optimization, where models are continuously optimized for each request. This is particularly useful for applications that require real-time adaptation. This technique dynamically optimizes the model or function for each incoming request. It adapts the model in real-time based on the current input and recent interactions. This approach ensures that the model can handle a wide variety of queries effectively, making it ideal for applications where the input context may change frequently or unpredictably.

Step 1: Install Required Libraries

Step 2: Set Up API Configuration

Step 3: Define Your Models

Define the input and output models for your task. Here we define the input and output models for the textual entailment task, which involves a premise and a hypothesis.

Step 4: Create a Function

Create a function that encapsulates the task’s objective, how the prompt is structured, and the expected inputs and outputs. In this case, we define a function for the textual entailment task.

Step 5: Create a Dataset

Create a dataset that includes the input and output examples for your function.

Step 6: Add Dataset Items to the Magic Dataset

Add input and output examples to the magic dataset.

Step 7: Configuration an Online Optimizer

Create an online optimizer configuration that defines the function, datasets, and parameters for the optimization process. In this case, we create an online optimizer configuration for the textual entailment function using the train, validation, and test datasets.

Step 8: Use the Optimized Function

Use the optimized function with any input and get the optimized output.