Humanloop

Humanloop

Humanloop은 제품 팀이 LLM으로 견고한 AI 기능을 구축하도록 돕는 도구예요. 평가(Evaluation), 프롬프트 관리(Prompt Management), 관측성(Observability)을 위한 최고 수준의 툴링을 제공하죠. LiteLLM과 Humanloop을 연동해 프롬프트를 관리하는 방법을 알려드릴게요.

출처: 문서

본문

시작하기 (Getting Started)

Humanloop을 사용해 모든 LiteLLM 프로바이더에서 프롬프트를 관리해 보세요.

SDK:

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-5.6-luna",
    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
)

PROXY:

  1. config.yaml 설정
model_list:
  - model_name: gpt-5.6-luna
    litellm_params:
      model: humanloop/gpt-5.6-luna
      prompt_id: "<humanloop_prompt_id>"
      api_key: os.environ/OPENAI_API_KEY
  1. 프록시 시작
litellm --config config.yaml --detailed_debug
  1. 테스트해 보세요!

CURL:

curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ***" \
-d '{
    "model": "gpt-5.6-luna",
    "messages": [
        {
            "role": "user",
            "content": "THIS WILL BE IGNORED"
        }
    ],
    "prompt_variables": {
        "key": "this is used"
    }
}'

OpenAI Python SDK:

import openai
client = openai.OpenAI(
    api_key="anything",
    base_url="http://0.0.0.0:4000"
)

# request sent to model set on litellm proxy, `litellm --model`
response = client.chat.completions.create(
    model="gpt-5.6-luna",
    messages = [
        {
            "role": "user",
            "content": "this is a test request, write a short poem"
        }
    ],
    extra_body={
        "prompt_variables": { # [OPTIONAL]
            "key": "this is used"
        }
    }
)

print(response)

예상 로그 (Expected Logs):

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

모델 설정 방법 (How to set model)

LiteLLM에서 모델 설정 (Set the model on LiteLLM)

humanloop/<litellm_model_name> 형식으로 설정할 수 있어요.

SDK:

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

PROXY:

model_list:
  - model_name: gpt-5.6-luna
    litellm_params:
      model: humanloop/gpt-5.6-luna # OR humanloop/anthropic/claude-sonnet-5
      prompt_id: <humanloop_prompt_id>
      api_key: os.environ/OPENAI_API_KEY

Humanloop에서 모델 설정 (Set the model on Humanloop)

LiteLLM은 humanloop의 https://api.humanloop.com/v5/prompts/<your-prompt-id> 엔드포인트를 호출해 프롬프트 템플릿을 가져와요.

이 응답에는 Humanloop에 설정된 템플릿 모델도 반환돼요.

{
  "template": [
    {
      ... # your prompt template
    }
  ],
  "model": "gpt-5.6-luna" # your template model
}

더 알아보기 (Learn more)

  • Humanloop — 평가·프롬프트 관리·관측성 플랫폼