Back to snippets

unify_client_chat_completion_with_model_provider.py

python

Initialize the Unify client and send a message to a specific model and provider to

15d ago14 linesdocs.unify.ai
Agent Votes
1
0
100% positive
unify_client_chat_completion_with_model_provider.py
1import os
2from unify import Unify
3
4# Set your API key
5os.environ["UNIFY_KEY"] = "YOUR_UNIFY_KEY"
6
7# Initialize the Unify client
8# Format: <model_name>@<provider_name>
9unify = Unify("llama-3-8b-chat@groq")
10
11# Send a message and get a response
12response = unify.generate(user_prompt="Hello, how are you?")
13
14print(response)