This is a collection of examples for the clarifai-python SDK and Integrations done with Clarifai SDK. Use these examples to learn Clarifai and build your own robust and scalable AI applications.
Experience the power of Clarifai in building Computer Vision , Natual Language processsing , Generative AI applications.
Website | Schedule Demo | Signup for a Free Account | API Docs | Clarifai Community | Python SDK Docs | Examples | Colab Notebooks | Discord
-
Sign up for a free account at clarifai and set your PAT key.
-
You can generate PAT key in the Personal settings -> Security section
-
Install the Clarifai python sdk.
-
Export your PAT as an environment variable.
export CLARIFAI_PAT={your personal access token}
-
Explore and run the examples in this repo.
The examples are organized into several folders based on their category. A quick example below,
from clarifai.client.dataset import Dataset
dataset = Dataset(user_id="user_id", app_id="app_id", dataset_id="dataset_id")
dataset.upload_dataset(task="text_clf", split="train", module_dir="path_to_imdb_reviews_module")
Function | Link | Description | Link to Docs |
---|---|---|---|
Basics | Basics | Basic Functionalities (create, list, patch, delete) of SDK App, Dataset, Input & Model Classes | |
Compute Orchestration | CRUD Operations | Basic Functionalities (create, list, get, delete) of Compute Orchestration Classes - ComputeCluster, Nodepool, Deployment | |
Model Predict | Predict | Call predict of any model in a Python native way with our SDK. See many more examples here | Docs for Python/Javascript |
Using OpenAI Client | Use the openAI client to call openAI-compatible models in Clarifai. See many more examples here. | Docs for Pyhon/Typescript | |
Using OpenAI Client on Node.js | Use the OpenAI node client to call OpenAI-compatible models in Clarifai. See many more examples here | Docs for Typescript | |
Using Vercel AI SDK on Node.js | Use the Vercel AI SDK with OpenAI provider to call OpenAI-compatible models in Clarifai. See many more examples here | Docs for Typescript | |
Using LiteLLM | Use Litellm to call openAI-compatible models in Clarifai. See many more examples here | ||
Legacy Models | Call predict of any model not uploaded to compute orchestration with our SDK | Docs | |
Model Upload | Model Upload | Upload custom models, MCP tools, or any python function you want. See our new runner examples repo for compute orchestration with many examples covered! | |
MCP Tools | MCP Tool Examples | Upload custom MCP tools and have them fully hosted in Clarifai to use with any MCP client. | |
Agent Toolkits | CrewAI Examples | Build agents with CrewAI toolkits on top of Clarifai LLMs and MCP tools. | Video |
Google ADK | Create agetns with Google ADK leveraging LLMs and tools powered by Clarifai | ||
LLM + MCP Examples | Simple python native examples of building agents covering function calls, JSON parsing and more |
Function | Notebook | Description | Open in Colab |
---|---|---|---|
Basics | Basics | Basic Functionalities (create, list, patch, delete) of SDK App, Dataset, Input & Model Classes | |
Compute Orchestration | CRUD Operations | Basic Functionalities (create, list, get, delete) of Compute Orchestration Classes - ComputeCluster, Nodepool, Deployment | |
Concepts | Concept Management | Basic Functionalities (add, search, delete) of Concept Relations | |
Datasets | Basics | Basic Functionalities of Dataset & Input Class in SDK | |
Input Upload | Upload Functionalities of SDK with different kinds of data (image, text, audio, video ) and annotations (classes, bbox, etc) using Input Class | ||
Dataset Upload | Upload Functionalities of SDK with different of dataset annotation formats (Clarifai, Cifar10, VOC, etc.) using Dataset Class | ||
Dataset Export | Export Functionalities of SDK to different of dataset annotation formats (Clarifai, Cifar10, VOC, etc.) using Dataset Class | ||
Model Predict | Model Predict | Prediction Functionalities of SDK Model Class for different type of input data | |
Workflows | Create Workflow | Different kinds of Workflow Creation examples using SDK | |
Patch Workflow | Modifying a workflow with patch operations using SDK Workflow Class | ||
Export Workflow | Exporting Workflow config and create a modified workflow using SDK Workflow Class | ||
Model Training | Image Classification Training | Model Train demo for Visual-Classifier model type with MMClassification_EfficientNet Template | |
Text Classification Training | Model Train demo for Text-Classifier model type with HF_GPTNeo_125m_lora template | ||
Image Detection Training | Model Train demo for Visual-Detector model type with MMDetection template | ||
Image Segmentation Training | Model Train demo for Visual-Segmenter model type with MMDetection template | ||
Transfer Learn Training | Model Train demo for Embedded-Classifier model type using Transfer-Learning | ||
Model Evaluation | Embedding Classifier | Model Eval demo for Embedded-Classifier model type using SDK | |
Text Classifier | Model Eval demo for Text-Classifier model type using SDK | ||
Visual Classifier | Model Eval demo for Visual-Classifier model type using SDK | ||
Visual Detector | Model Eval demo for Visual-Detector model type using SDK | ||
Search | Vector Search | Introductory guide to setting up a Cross-Modal Search system using SDK | |
RAG | RAG | RAG setup and chat with the RAG interface. |
Function | Notebook | Description | Open in Colab |
---|---|---|---|
Compute Orchestration | Compute Orchestration | Basic functionalities of Compute Orchestration using CLI | |
Model | Model Predict | Model Prediction using CLI |
Integration | Function | Notebook | Open in Colab |
---|---|---|---|
Langchain | Chains | Prompt Templates and Chains | |
Retrieval QA Chain | |||
Router Chain | |||
PostgreSQL LLM | |||
Agents | Conversational Agent | ||
ReAct Docstore Agent | |||
DeepEval | LLM Evaluation | LLM Evaluation | |
Unstructured.io | Github Data Ingestion | ||
S3 Data Ingestion | |||
DropBox Data Ingestion |
Data Util | Function | Notebook | Open in Colab |
---|---|---|---|
Image | Image Annotation | annotation loader | |
Multimodal | Data Ingestion | Ready to Use Pipelines | |
Data Ingestion | Multimodal Ingestion | ||
Data Ingestion | Advanced Multimodal Ingestion with summarizer |
Although these scripts are run on your local machine, they'll communicate with Clarifai and run in our cloud on demand.
Examples provide a guided tour through Clarifai's concepts and capabilities. contains uncategorized, miscellaneous examples.