Clarifai

Clarifai is a full-stack AI platform for building, fine-tuning, and deploying models across text, image, video, and audio. It provides a unified environment for data management, vector search, annotation, training, and real-time inference, making it a strong option for teams that want an end-to-end system rather than an inference-only service.

This tutorial will guide you through using Arcee AI’s language models on Clarifai through the Clarifai SDK.

Prerequisites

  • Clarifai Account

  • Clarifai API Key If you do not have one, create it in your Clarifai console.

  • Clarifai Python SDK

Quickstart

Run a completion using an Arcee model.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.clarifai.com/v2/ext/openai/v1",
    api_key="<YOUR_API_KEY>",
)
response = client.chat.completions.create(
    model="https://clarifai.com/arcee_ai/AFM/models/trinity-mini/versions/7c698b6ebd604853ad3f75adecb59c1c",
    messages=[
        {"role": "system", "content": "Talk like a pirate."},
        {
            "role": "user",
            "content": "How do I check if a Python object is an instance of a class?",
        },
    ],
    temperature=0.7,
    stream=False, # stream=True also works, just iterator over the response
)
print(response)

Last updated