This example demonstrates how to initialize the AI21 Python SDK client and send a simple chat message using the jamba-mini model.
Copy
Ask AI
from ai21 import AI21Clientfrom ai21.models.chat import ChatMessageclient = AI21Client( # defaults to os.environ.get('AI21_API_KEY') api_key='my_api_key',)system = "You're a support engineer in a SaaS company"messages = [ ChatMessage(content=system, role="system"), ChatMessage(content="Hello, I need help with a signup process.", role="user"),]chat_completions = client.chat.completions.create( messages=messages, model="jamba-mini",)