Skip to main content
GitHub

Together AI

Auto-instrument Together AI for open-source models.

Risicare automatically instruments the Together AI SDK for open-source model inference.

Installation

pip install risicare together

Auto-Instrumentation

import risicare
from together import Together
 
risicare.init()
 
client = Together()
 
# Automatically traced
response = client.chat.completions.create(
    model="meta-llama/Llama-3-70b-chat-hf",
    messages=[{"role": "user", "content": "Hello!"}]
)

Captured Attributes

AttributeDescription
gen_ai.systemtogether
gen_ai.request.modelRequested model name
gen_ai.response.modelModel name returned by API
gen_ai.response.idResponse ID
gen_ai.request.temperatureSampling temperature
gen_ai.request.max_tokensMax output tokens
gen_ai.request.streamWhether streaming was requested
gen_ai.request.has_toolsWhether tools were provided
gen_ai.usage.prompt_tokensInput tokens
gen_ai.usage.completion_tokensOutput tokens
gen_ai.usage.total_tokensTotal tokens
gen_ai.completion.tool_callsNumber of tool calls made
gen_ai.completion.finish_reasonStop reason
gen_ai.latency_msRequest latency in milliseconds

Streaming

stream = client.chat.completions.create(
    model="meta-llama/Llama-3-70b-chat-hf",
    messages=[{"role": "user", "content": "Write a story"}],
    stream=True
)
 
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")
ModelDescription
meta-llama/Llama-3-70b-chat-hfLlama 3 70B Chat
meta-llama/Llama-3-8b-chat-hfLlama 3 8B Chat
mistralai/Mixtral-8x7B-Instruct-v0.1Mixtral 8x7B
mistralai/Mistral-7B-Instruct-v0.2Mistral 7B
Qwen/Qwen2-72B-InstructQwen2 72B

Embeddings

response = client.embeddings.create(
    model="togethercomputer/m2-bert-80M-8k-retrieval",
    input=["Hello, world!"]
)

Instrumentation Scope

Only chat completions are instrumented by the Risicare Together provider patch. Embeddings are traced through the OpenAI-compatible host detection, not a dedicated Together embeddings patch.

Next Steps