Together AI는 생성형 AI 모델을 구축하고 파인튜닝하는 플랫폼으로, 오픈 소스 LLM에 중점을 두고 고객이 자체 모델을 파인튜닝하고 호스팅할 수 있도록 지원합니다.
Weave의 together Python 패키지 전체 지원은 현재 개발 중입니다.
Weave의 together Python 패키지 전체 지원은 현재 개발 중이지만, Together는 OpenAI SDK 호환(docs)을 지원하며 Weave는 이를 자동으로 감지해 통합합니다.
Together API를 사용하려면 Together API 키로 API 키를 바꾸고, base_url을 https://api.together.xyz/v1로 설정한 다음, 모델을 제공되는 chat models 중 하나로 변경하면 됩니다.
import os
import openai
import weave
weave.init('together-weave')
system_content = "You are a travel agent. Be descriptive and helpful."
user_content = "Tell me about San Francisco"
client = openai.OpenAI(
api_key=os.environ.get("TOGETHER_API_KEY"),
base_url="https://api.together.xyz/v1",
)
chat_completion = client.chat.completions.create(
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
messages=[
{"role": "system", "content": system_content},
{"role": "user", "content": user_content},
],
temperature=0.7,
max_tokens=1024,
)
response = chat_completion.choices[0].message.content
print("Together response:\n", response)
이는 시작을 위한 단순한 예시이지만, 더 복잡한 사용 사례에서 직접 작성한 함수에 Weave를 통합하는 방법에 대한 자세한 내용은 OpenAI 가이드를 참조하세요.