Skip to main content

Humanloop

Humanloop enables product teams to build robust AI features with LLMs, using best-in-class tooling for Evaluation, Prompt Management, and Observability.

Getting Started​

Use Humanloop to manage prompts across all LiteLLM Providers.

import os 
import litellm

os.environ["HUMANLOOP_API_KEY"] = "" # [OPTIONAL] set here or in `.completion`

litellm.set_verbose = True # see raw request to provider

resp = litellm.completion(
model="humanloop/gpt-3.5-turbo",
prompt_id="test-chat-prompt",
prompt_variables={"user_message": "this is used"}, # [OPTIONAL]
messages=[{"role": "user", "content": "<IGNORED>"}],
# humanloop_api_key="..." ## alternative to setting env var
)

Expected Logs:

POST Request Sent from LiteLLM:
curl -X POST \
https://api.openai.com/v1/ \
-d '{'model': 'gpt-3.5-turbo', 'messages': <YOUR HUMANLOOP PROMPT TEMPLATE>}'

How to set model​

How to set model​

Set the model on LiteLLM​

You can do humanloop/<litellm_model_name>

litellm.completion(
model="humanloop/gpt-3.5-turbo", # or `humanloop/anthropic/claude-3-5-sonnet`
...
)

Set the model on Humanloop​

LiteLLM will call humanloop's https://api.humanloop.com/v5/prompts/<your-prompt-id> endpoint, to get the prompt template.

This also returns the template model set on Humanloop.

{
"template": [
{
... # your prompt template
}
],
"model": "gpt-3.5-turbo" # your template model
}