For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inBook a demo
DocsReferenceChangelog
DocsReferenceChangelog
  • Introduction
    • SDKs
    • Errors
  • Humanloop API
LogoLogo
Sign inBook a demo
On this page
  • Usage Examples
Introduction

SDKs

Was this page helpful?

Errors

In the event an issue occurs with our system, or with one of the model providers we integrate with, our API will raise a predictable and interpretable error.
Next
Built with

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

Python ↗
Node/TypeScript ↗

Usage Examples

Python SDK
TypeScript SDK
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)