Model comparison
You can send the same request to two specific text models of your choice and compare the results.
Just select two models from the Text Models (LLM) list, copy their Model IDs, and paste them into the Specify the models to compare
section of this code example as the values for model1
and model2
.
Don't forget to also insert your LAPLAS API Key instead of <YOUR_LAPLASAPI_KEY>
:
import requests
from openai import OpenAI
# API credentials
BASE_URL = "https://api.apilaplas.com/v1"
# insert your LAPLAS API Key instead of <YOUR_LAPLASAPI_KEY>:
API_KEY = "<YOUR_LAPLASAPI_KEY>"
# Specify the models to compare
model1 = "gpt-4o"
model2 = "MiniMax-Text-01"
def generate_joke(model):
client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
system_prompt = "You are an AI assistant that only responds with jokes."
user_prompt = "Why did the programmer break up with their keyboard?"
response = client.chat.completions.create(
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
],
model=model,
)
return response.choices[0].message.content
def main():
for model in [model1, model2]:
joke = generate_joke(model)
print(f"--- {model} ---")
print(f"USER: Why did the programmer break up with their keyboard?")
print(f"AI : {joke}")
if __name__ == "__main__":
main()
In our example run, we received the following output:
--- gpt-4o ---
USER: Why did the programmer break up with their keyboard?
AI : Because it just wasn't their type!
--- MiniMax-Text-01 ---
USER: Why did the programmer break up with their keyboard?
AI : Because it kept hitting the wrong keys!
Last updated