plano/model_server/app/commons/globals.py

39 lines
1.1 KiB
Python
Raw Permalink Normal View History

import app.commons.utilities as utils
from openai import OpenAI
2024-12-04 16:41:30 -08:00
from app.commons.constants import *
from app.model_handler.function_calling import ArchIntentHandler, ArchFunctionHandler
from app.model_handler.guardrails import get_guardrail_handler
2024-12-04 16:41:30 -08:00
logger = utils.get_model_server_logger()
# Define the client
2024-12-05 15:19:41 -08:00
ARCH_ENDPOINT = "https://api.fc.archgw.com/v1"
ARCH_API_KEY = "EMPTY"
ARCH_CLIENT = OpenAI(base_url=ARCH_ENDPOINT, api_key=ARCH_API_KEY)
2024-12-04 16:41:30 -08:00
# Define model handlers
handler_map = {
"Arch-Intent": ArchIntentHandler(
ARCH_CLIENT,
ARCH_INTENT_MODEL_ALIAS,
ARCH_INTENT_TASK_PROMPT,
2024-12-05 15:19:41 -08:00
ARCH_INTENT_TOOL_PROMPT_TEMPLATE,
2024-12-04 16:41:30 -08:00
ARCH_INTENT_FORMAT_PROMPT,
ARCH_INTENT_INSTRUCTION,
**ARCH_INTENT_GENERATION_CONFIG,
),
"Arch-Function": ArchFunctionHandler(
ARCH_CLIENT,
ARCH_FUNCTION_MODEL_ALIAS,
ARCH_FUNCTION_TASK_PROMPT,
2024-12-05 15:19:41 -08:00
ARCH_FUNCTION_TOOL_PROMPT_TEMPLATE,
2024-12-04 16:41:30 -08:00
ARCH_FUNCTION_FORMAT_PROMPT,
**ARCH_FUNCTION_GENERATION_CONFIG,
),
"Arch-Guard": get_guardrail_handler(),
}