Empower

Empower

LiteLLM은 Empower의 모든 모델을 지원해요.

출처: 문서

본문

API 키

import os

os.environ["EMPOWER_API_KEY"] = "your-api-key"

예시 사용법 (Example Usage)

from litellm import completion
import os

os.environ["EMPOWER_API_KEY"] = "your-api-key"
messages = [{"role": "user", "content": "Write me a poem about the blue sky"}]

response = completion(model="empower/empower-functions", messages=messages)
print(response)

예시 사용법 - 스트리밍 (Streaming)

from litellm import completion
import os

os.environ["EMPOWER_API_KEY"] = "your-api-key"
messages = [{"role": "user", "content": "Write me a poem about the blue sky"}]

response = completion(model="empower/empower-functions", messages=messages, streaming=True)

for chunk in response:
    print(chunk['choices'][0]['delta'])

예시 사용법 - 자동 Tool Calling

from litellm import completion
import os

os.environ["EMPOWER_API_KEY"] = "your-api-key"
messages = [{"role": "user", "content": "What's the weather like in San Francisco, Tokyo, and Paris?"}]

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather in a given location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city and state, e.g. San Francisco, CA",
                    },
                    "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
                },
                "required": ["location"],
            },
        },
    }
]

response = completion(
    model="empower/empower-functions-small",
    messages=messages,
    tools=tools,
    tool_choice="auto",  # auto is default, but we'll be explicit
)
print("\nLLM Response:\n", response)

Empower 모델

LiteLLM은 https://empower.dev/ 의 모든 모델에 비스트리밍 및 스트리밍 요청을 지원해요.

더 알아보기 (Learn more)