LangDB provides first class support for TogetherAI opensource hosted models.
You can use OpenAI SDK to run the models.
1
Install OpenAI
pip install openai
2
Add LangDB into your code
from openai import OpenAI
client = OpenAI(
base_url="https://api.us-east-1.langdb.ai" # LangDB API base URL,
api_key=api_key, # Replace with your LangDB token
)
# Make the API call to LangDB's Completions API
response = client.chat.completions.create(
model="Qwen2-72B-Instruct", # Use the model
messages=[{"role": "user", "content": "Hello!"}],
extra_headers={"x-project-id": "xxxxx"} # LangDB Project ID
)