Skip to main content

🆕 Clarifai

Anthropic, OpenAI, Mistral, Llama and Gemini LLMs are Supported on Clarifai.

Pre-Requisites​

pip install clarifai

pip install litellm

Required Environment Variables​

To obtain your Clarifai Personal access token follow this link. Optionally the PAT can also be passed in completion function.

os.environ["CALRIFAI_API_KEY"] = "YOUR_CLARIFAI_PAT"  # CLARIFAI_PAT

Usage​

import os
from litellm import completion

os.environ["CLARIFAI_API_KEY"] = ""

response = completion(
model="clarifai/mistralai.completion.mistral-large",
messages=[{ "content": "Tell me a joke about physics?","role": "user"}]
)

Output

{
"id": "chatcmpl-572701ee-9ab2-411c-ac75-46c1ba18e781",
"choices": [
{
"finish_reason": "stop",
"index": 1,
"message": {
"content": "Sure, here's a physics joke for you:\n\nWhy can't you trust an atom?\n\nBecause they make up everything!",
"role": "assistant"
}
}
],
"created": 1714410197,
"model": "https://api.clarifai.com/v2/users/mistralai/apps/completion/models/mistral-large/outputs",
"object": "chat.completion",
"system_fingerprint": null,
"usage": {
"prompt_tokens": 14,
"completion_tokens": 24,
"total_tokens": 38
}
}

Clarifai models​

liteLLM supports all models on Clarifai community

Example Usage - Note: liteLLM supports all models deployed on Clarifai

Llama LLMs​

Model NameFunction Call
clarifai/meta.Llama-2.llama2-7b-chatcompletion('clarifai/meta.Llama-2.llama2-7b-chat', messages)
clarifai/meta.Llama-2.llama2-13b-chatcompletion('clarifai/meta.Llama-2.llama2-13b-chat', messages)
clarifai/meta.Llama-2.llama2-70b-chatcompletion('clarifai/meta.Llama-2.llama2-70b-chat', messages)
clarifai/meta.Llama-2.codeLlama-70b-Pythoncompletion('clarifai/meta.Llama-2.codeLlama-70b-Python', messages)
clarifai/meta.Llama-2.codeLlama-70b-Instructcompletion('clarifai/meta.Llama-2.codeLlama-70b-Instruct', messages)

Mistal LLMs​

Model NameFunction Call
clarifai/mistralai.completion.mixtral-8x22Bcompletion('clarifai/mistralai.completion.mixtral-8x22B', messages)
clarifai/mistralai.completion.mistral-largecompletion('clarifai/mistralai.completion.mistral-large', messages)
clarifai/mistralai.completion.mistral-mediumcompletion('clarifai/mistralai.completion.mistral-medium', messages)
clarifai/mistralai.completion.mistral-smallcompletion('clarifai/mistralai.completion.mistral-small', messages)
clarifai/mistralai.completion.mixtral-8x7B-Instruct-v0_1completion('clarifai/mistralai.completion.mixtral-8x7B-Instruct-v0_1', messages)
clarifai/mistralai.completion.mistral-7B-OpenOrcacompletion('clarifai/mistralai.completion.mistral-7B-OpenOrca', messages)
clarifai/mistralai.completion.openHermes-2-mistral-7Bcompletion('clarifai/mistralai.completion.openHermes-2-mistral-7B', messages)

Jurassic LLMs​

Model NameFunction Call
clarifai/ai21.complete.Jurassic2-Grandecompletion('clarifai/ai21.complete.Jurassic2-Grande', messages)
clarifai/ai21.complete.Jurassic2-Grande-Instructcompletion('clarifai/ai21.complete.Jurassic2-Grande-Instruct', messages)
clarifai/ai21.complete.Jurassic2-Jumbo-Instructcompletion('clarifai/ai21.complete.Jurassic2-Jumbo-Instruct', messages)
clarifai/ai21.complete.Jurassic2-Jumbocompletion('clarifai/ai21.complete.Jurassic2-Jumbo', messages)
clarifai/ai21.complete.Jurassic2-Largecompletion('clarifai/ai21.complete.Jurassic2-Large', messages)

Wizard LLMs​

Model NameFunction Call
clarifai/wizardlm.generate.wizardCoder-Python-34Bcompletion('clarifai/wizardlm.generate.wizardCoder-Python-34B', messages)
clarifai/wizardlm.generate.wizardLM-70Bcompletion('clarifai/wizardlm.generate.wizardLM-70B', messages)
clarifai/wizardlm.generate.wizardLM-13Bcompletion('clarifai/wizardlm.generate.wizardLM-13B', messages)
clarifai/wizardlm.generate.wizardCoder-15Bcompletion('clarifai/wizardlm.generate.wizardCoder-15B', messages)

Anthropic models​

Model NameFunction Call
clarifai/anthropic.completion.claude-v1completion('clarifai/anthropic.completion.claude-v1', messages)
clarifai/anthropic.completion.claude-instant-1_2completion('clarifai/anthropic.completion.claude-instant-1_2', messages)
clarifai/anthropic.completion.claude-instantcompletion('clarifai/anthropic.completion.claude-instant', messages)
clarifai/anthropic.completion.claude-v2completion('clarifai/anthropic.completion.claude-v2', messages)
clarifai/anthropic.completion.claude-2_1completion('clarifai/anthropic.completion.claude-2_1', messages)
clarifai/anthropic.completion.claude-3-opuscompletion('clarifai/anthropic.completion.claude-3-opus', messages)
clarifai/anthropic.completion.claude-3-sonnetcompletion('clarifai/anthropic.completion.claude-3-sonnet', messages)

OpenAI GPT LLMs​

Model NameFunction Call
clarifai/openai.chat-completion.GPT-4completion('clarifai/openai.chat-completion.GPT-4', messages)
clarifai/openai.chat-completion.GPT-3_5-turbocompletion('clarifai/openai.chat-completion.GPT-3_5-turbo', messages)
clarifai/openai.chat-completion.gpt-4-turbocompletion('clarifai/openai.chat-completion.gpt-4-turbo', messages)
clarifai/openai.completion.gpt-3_5-turbo-instructcompletion('clarifai/openai.completion.gpt-3_5-turbo-instruct', messages)

GCP LLMs​

Model NameFunction Call
clarifai/gcp.generate.gemini-1_5-procompletion('clarifai/gcp.generate.gemini-1_5-pro', messages)
clarifai/gcp.generate.imagen-2completion('clarifai/gcp.generate.imagen-2', messages)
clarifai/gcp.generate.code-geckocompletion('clarifai/gcp.generate.code-gecko', messages)
clarifai/gcp.generate.code-bisoncompletion('clarifai/gcp.generate.code-bison', messages)
clarifai/gcp.generate.text-bisoncompletion('clarifai/gcp.generate.text-bison', messages)
clarifai/gcp.generate.gemma-2b-itcompletion('clarifai/gcp.generate.gemma-2b-it', messages)
clarifai/gcp.generate.gemma-7b-itcompletion('clarifai/gcp.generate.gemma-7b-it', messages)
clarifai/gcp.generate.gemini-procompletion('clarifai/gcp.generate.gemini-pro', messages)
clarifai/gcp.generate.gemma-1_1-7b-itcompletion('clarifai/gcp.generate.gemma-1_1-7b-it', messages)

Cohere LLMs​

Model NameFunction Call
clarifai/cohere.generate.cohere-generate-commandcompletion('clarifai/cohere.generate.cohere-generate-command', messages)
clarifai/cohere.generate.command-r-plus'completion('clarifai/clarifai/cohere.generate.command-r-plus', messages)

Databricks LLMs​

Model NameFunction Call
clarifai/databricks.drbx.dbrx-instructcompletion('clarifai/databricks.drbx.dbrx-instruct', messages)
clarifai/databricks.Dolly-v2.dolly-v2-12bcompletion('clarifai/databricks.Dolly-v2.dolly-v2-12b', messages)

Microsoft LLMs​

Model NameFunction Call
clarifai/microsoft.text-generation.phi-2completion('clarifai/microsoft.text-generation.phi-2', messages)
clarifai/microsoft.text-generation.phi-1_5completion('clarifai/microsoft.text-generation.phi-1_5', messages)

Salesforce models​

Model NameFunction Call
clarifai/salesforce.blip.general-english-image-caption-blip-2completion('clarifai/salesforce.blip.general-english-image-caption-blip-2', messages)
clarifai/salesforce.xgen.xgen-7b-8k-instructcompletion('clarifai/salesforce.xgen.xgen-7b-8k-instruct', messages)

Other Top performing LLMs​

Model NameFunction Call
clarifai/deci.decilm.deciLM-7B-instructcompletion('clarifai/deci.decilm.deciLM-7B-instruct', messages)
clarifai/upstage.solar.solar-10_7b-instructcompletion('clarifai/upstage.solar.solar-10_7b-instruct', messages)
clarifai/openchat.openchat.openchat-3_5-1210completion('clarifai/openchat.openchat.openchat-3_5-1210', messages)
clarifai/togethercomputer.stripedHyena.stripedHyena-Nous-7Bcompletion('clarifai/togethercomputer.stripedHyena.stripedHyena-Nous-7B', messages)
clarifai/fblgit.una-cybertron.una-cybertron-7b-v2completion('clarifai/fblgit.una-cybertron.una-cybertron-7b-v2', messages)
clarifai/tiiuae.falcon.falcon-40b-instructcompletion('clarifai/tiiuae.falcon.falcon-40b-instruct', messages)
clarifai/togethercomputer.RedPajama.RedPajama-INCITE-7B-Chatcompletion('clarifai/togethercomputer.RedPajama.RedPajama-INCITE-7B-Chat', messages)
clarifai/bigcode.code.StarCodercompletion('clarifai/bigcode.code.StarCoder', messages)
clarifai/mosaicml.mpt.mpt-7b-instructcompletion('clarifai/mosaicml.mpt.mpt-7b-instruct', messages)