Anyscale

Anyscale

LiteLLM에서 Anyscale 프로바이더를 사용하는 방법을 소개할게요.

출처: 문서

본문

API 키 (API Key)

# env variable
os.environ['ANYSCALE_API_KEY']

샘플 사용법 (Sample Usage)

from litellm import completion
import os

os.environ['ANYSCALE_API_KEY'] = ""
response = completion(
    model="anyscale/mistralai/Mistral-7B-Instruct-v0.1",
    messages=messages
)
print(response)

샘플 사용법 - 스트리밍 (Streaming)

from litellm import completion
import os

os.environ['ANYSCALE_API_KEY'] = ""
response = completion(
    model="anyscale/mistralai/Mistral-7B-Instruct-v0.1",
    messages=messages,
    stream=True
)

for chunk in response:
    print(chunk)

지원 모델 (Supported Models)

https://app.endpoints.anyscale.com/에 나열된 모든 모델이 지원돼요. 모델 목록, 가격, 토큰 창 등은 여기에서 적극적으로 관리하고 있어요.

모델 이름 함수 호출
llama2-7b-chat completion(model="anyscale/meta-llama/Llama-2-7b-chat-hf", messages)
llama-2-13b-chat completion(model="anyscale/meta-llama/Llama-2-13b-chat-hf", messages)
llama-2-70b-chat completion(model="anyscale/meta-llama/Llama-2-70b-chat-hf", messages)
mistral-7b-instruct completion(model="anyscale/mistralai/Mistral-7B-Instruct-v0.1", messages)
CodeLlama-34b-Instruct completion(model="anyscale/codellama/CodeLlama-34b-Instruct-hf", messages)

더 알아보기 (Learn more)