SDKs

The Humanloop platform can be accessed through the API or through our Python and TypeScript SDKs.

Usage Examples

Installation
pip install humanloop
Example usage
from humanloop import Humanloop
humanloop = Humanloop(
api_key="YOUR_API_KEY",
openai_api_key="YOUR_OPENAI_API_KEY",
)
chat_response = humanloop.chat(
project="sdk-example",
messages=[
{
"role": "user",
"content": "Explain asynchronous programming.",
}
],
model_config={
"model": "gpt-3.5-turbo",
"max_tokens": -1,
"temperature": 0.7,
"chat_template": [
{
"role": "system",
"content": "You are a helpful assistant who replies in the style of {{persona}}.",
},
],
},
inputs={
"persona": "Jeff Dean",
},
stream=False,
)
print(chat_response)