Custom model
Opik provides a set of LLM as a Judge metrics that are designed to be model-agnostic and can be used with any LLM. In order to achieve this, we use the LiteLLM library to abstract the LLM calls.
By default, Opik will use the gpt-4o
model. However, you can change this by setting the model
parameter when initializing your metric to any model supported by LiteLLM:
Using a model supported by LiteLLM
In order to use many models supported by LiteLLM, you also need to pass additional parameters. For this, you can use the LiteLLMChatModel class and passing it to the metric:
Creating your own custom model class
You can create your own custom model class by subclassing the OpikBaseModel
class and implementing a few methods:
This model class can then be used in the same way as the built-in models: