SDK 클라이언트
SDK 클라이언트 (SDK Clients)
SDK 클라이언트를 사용하면 여러분이 선호하는 프로그래밍 언어로 Mistral AI의 API를 사용할 수 있어요. 각 SDK는 우리 API 엔드포인트와 서비스에 깔끔하고 간단한 인터페이스를 제공합니다.
API와 연동할 때는 공식 SDK 사용을 강력히 권장해요.
출처: 문서
본문
SDKs
Python과 TypeScript용 공식 SDK 클라이언트를 제공하며, 다른 언어의 서드파티 비공식 SDK도 찾아볼 수 있어요.
Python SDKTypescript SDKThird-party SDKs
Python Client를 설치하려면 다음을 실행하세요:
Bash
pip install mistralai
설치가 끝나면 예를 들어 다음과 같이 채팅 완성(chat completion)을 실행할 수 있어요.
pythonOutputV2V1
import os
from mistralai.client import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "mistral-medium-latest"
client = Mistral(api_key=api_key)
chat_response = client.chat.complete(
model = model,
messages = [
{
"role": "user",
"content": "What is the best French cheese?",
},
]
)
더 많은 예시는 여기에서 확인하세요.