Example: Using gemma

from openai import OpenAI

client = OpenAI(
    api_key = "Own API key",
    base_url = "https://api.zgiai.com/v1"
)

chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Tell a joke",
        }
    ],
    model="google/gemma-7b-it", # Please refer to the list of models to replace other models here eg: google/gemma-7b-it
)

print(chat_completion.choices[0].message.content)

Was this page helpful?