Introduction

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
1from humanloop import Humanloop
2
3humanloop = Humanloop(
4 api_key="YOUR_API_KEY",
5 openai_api_key="YOUR_OPENAI_API_KEY",
6)
7
8chat_response = humanloop.chat(
9 project="sdk-example",
10 messages=[
11 {
12 "role": "user",
13 "content": "Explain asynchronous programming.",
14 }
15 ],
16 model_config={
17 "model": "gpt-3.5-turbo",
18 "max_tokens": -1,
19 "temperature": 0.7,
20 "chat_template": [
21 {
22 "role": "system",
23 "content": "You are a helpful assistant who replies in the style of {{persona}}.",
24 },
25 ],
26 },
27 inputs={
28 "persona": "Jeff Dean",
29 },
30 stream=False,
31)
32print(chat_response)