New models
We have added support for the following new models:
gcp/gemini-exp-1114
mistral/pixtral-large-latest-eu
xai/grok-beta
xai/grok-vision-beta
Support for custom models
There is now support for custom models in Opper. This means that you can bring your own key to an existing model or add a completely custom model.
The easiest way to add a model is to use the Opper CLI. The README explains how to add a model, but here is an example of adding your own Azure deployment:
opper models create example/my-gpt4 azure/gpt4-production my-api-key-here '{"api_base": "https://my-gpt4-deployment.openai.azure.com/", "api_version": "2024-06-01"}'
This adds your custom deployment on my-gpt4-deployment.openai.azure.com
and the model name gpt4-production
using the my-api-key-here
API key. This model is then accessible in Opper using the name example/my-gpt4
.
Support for fallback models
The Opper API now support providing a list of fallback models, in addition to the main model used in a call. They will be tried in order until a model returns successfully.
Python sync example
from opperai import Opper
opper = Opper()
response, _ = opper.call(
name="GetFirstWeekday",
input="Today is Tuesday, yesterday was Monday",
instructions="Extract the first weekday mentioned in the text",
model="azure/gpt-4o-eu",
fallback_models=["openai/gpt-4o"],
)
print(response)
Python async example
from opperai import AsyncOpper
import asyncio
opper = AsyncOpper()
async def main():
response, _ = await opper.call(
name="GetFirstWeekday",
input="Today is Tuesday, yesterday was Monday",
instructions="Extract the first weekday mentioned in the text",
model="azure/gpt-4o-eu",
fallback_models=["openai/gpt-4o"],
)
print(response)
if __name__ == "__main__":
asyncio.run(main())
Node example
import OpperAI from 'opperai';
import fs from "fs";
import path from "path";
import os from "os";
async function testCallFallback() {
// Replace 'your-api-key' with your actual OpperAI API key
const client = new OpperAI({ apiKey: 'your-api-key' });
const { message, span_id } = await client.call({
name: "GetFirstWeekday",
input: "Today is Tuesday, yesterday was Monday",
instructions: "Extract the first weekday mentioned in the text",
model: "azure/gpt-4o-eu",
fallback_models: ["openai/gpt-4o"],
});
console.log(message);
}
testCallFallback();