llama-stack-mirror/llama_stack/providers/remote/inference/portkey/config.py
siddharthsambharia-portkey 7ece0d4d8b portkey integration v1
2024-12-20 17:21:54 +05:30

32 lines
931 B
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import os
from typing import Any, Dict, Optional
from llama_models.schema_utils import json_schema_type
from pydantic import BaseModel, Field
DEFAULT_BASE_URL = "https://api.portkey.ai/v1"
@json_schema_type
class PortkeyImplConfig(BaseModel):
base_url: str = Field(
default=os.environ.get("PORTKEY_BASE_URL", DEFAULT_BASE_URL),
description="Base URL for the Portkey API",
)
api_key: Optional[str] = Field(
default=os.environ.get("PORTKEY_API_KEY"),
description="Portkey API Key",
)
@classmethod
def sample_run_config(cls, **kwargs) -> Dict[str, Any]:
return {
"base_url": DEFAULT_BASE_URL,
"api_key": "${env.PORTKEY_API_KEY}",
}