Together AI は、生成 AI モデルの構築とファインチューニングのためのプラットフォームです。オープンソース LLM に注力しており、ユーザーは独自のモデルをファインチューニングしてホストできます。
Weave による together Python パッケージの完全サポートは現在開発中です
together Python パッケージに対する Weave の完全サポートは現在開発中ですが、Together は OpenAI SDK との互換性 (ドキュメント) をサポートしており、Weave はこれを自動的に検出して連携します。
Together API を使用するには、APIキーをお使いの Together API キーに、base_url を https://api.together.xyz/v1 に、モデルを チャットモデル のいずれかに変更するだけです。
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 ガイドを参照してください。