SUTRA-V2 English Notebook

This notebook demonstrates how to use SUTRA-V2 in English to create multilingual AI applications. SUTRA-V2, developed by TWO AI, supports over 50 languages, including English, for chat and instruction tasks via an OpenAI-compatible API.

🔧 Prerequisites

  • Obtain your SUTRA API key from https://developer.two.ai.
  • Store the API key securely (e.g., in Google Colab secrets or environment variables).

📦 Step 1: Install Dependencies

!pip install -qU openai

🔐 Step 2: Initialize SUTRA Client

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_SUTRA_API_KEY",
    base_url="https://api.two.ai/v2"
)

💬 Step 3: Basic Chat Completion

response = client.chat.completions.create(
    model="sutra-v2",
    messages=[
        {"role": "system", "content": "You are a helpful AI that answers concisely."},
        {"role": "user", "content": "What is artificial intelligence? Explain in three sentences."}
    ],
    max_tokens=1024,
    temperature=0.7
)
print(response.choices[0].message.content)

🛠 Troubleshooting

📎 Resources