fix
This commit is contained in:
@ -66,11 +66,11 @@ async def entrypoint(ctx: JobContext) -> None:
|
||||
ASR_LANGUAGE = os.getenv("CUSTOM_ASR_LANGUAGE", "auto")
|
||||
ASR_OUTPUT_LANGUAGE = os.getenv("CUSTOM_ASR_OUTPUT_LANGUAGE", "zh")
|
||||
|
||||
MINIMAX_BASE_URL = os.getenv("MINIMAX_LLM_BASE_URL", "https://oai.bwgdi.com/v1")
|
||||
MINIMAX_MODEL = os.getenv("MINIMAX_LLM_MODEL", "qwen-max")
|
||||
MINIMAX_API_KEY = os.getenv("MINIMAX_API_KEY")
|
||||
if not MINIMAX_API_KEY:
|
||||
raise RuntimeError(f"MINIMAX_API_KEY is not set in {CUSTOM_ENV_PATH}")
|
||||
LLM_BASE_URL = os.getenv("CUSTOM_LLM_BASE_URL")
|
||||
LLM_MODEL = os.getenv("CUSTOM_LLM_MODEL", "qwen-max")
|
||||
LLM_API_KEY = os.getenv("CUSTOM_LLM_API_KEY")
|
||||
if not LLM_API_KEY:
|
||||
raise RuntimeError(f"CUSTOM_LLM_API_KEY is not set in {CUSTOM_ENV_PATH}")
|
||||
|
||||
TTS_URL = os.getenv("CUSTOM_TTS_URL") or os.getenv(
|
||||
"VOXCPM_TTS_URL", "http://localhost:5050/tts-blackbox"
|
||||
@ -94,22 +94,27 @@ async def entrypoint(ctx: JobContext) -> None:
|
||||
import httpx
|
||||
from openai import AsyncClient as OpenAIAsyncClient
|
||||
|
||||
# Create a custom HTTP client that disables SSL verification
|
||||
http_client = httpx.AsyncClient(verify=False)
|
||||
# OpenAI-compatible endpoints can be used by setting CUSTOM_LLM_BASE_URL.
|
||||
http_client = httpx.AsyncClient(verify=_env_bool("CUSTOM_LLM_VERIFY_SSL", False))
|
||||
|
||||
# Create the OpenAI AsyncClient with the custom HTTP client
|
||||
openai_client = OpenAIAsyncClient(
|
||||
api_key=MINIMAX_API_KEY,
|
||||
base_url=MINIMAX_BASE_URL,
|
||||
http_client=http_client,
|
||||
)
|
||||
if LLM_BASE_URL:
|
||||
openai_client = OpenAIAsyncClient(
|
||||
api_key=LLM_API_KEY,
|
||||
base_url=LLM_BASE_URL,
|
||||
http_client=http_client,
|
||||
)
|
||||
else:
|
||||
openai_client = OpenAIAsyncClient(
|
||||
api_key=LLM_API_KEY,
|
||||
http_client=http_client,
|
||||
)
|
||||
|
||||
session: AgentSession = AgentSession(
|
||||
# 1. Custom ASR blackbox with StreamAdapter
|
||||
stt=stt_stream,
|
||||
# 2. Minimax LLM - Using OpenAI plugin with local base_url
|
||||
# 2. OpenAI-compatible LLM, e.g. MiniMax, Qwen, or OpenAI.
|
||||
llm=openai.LLM(
|
||||
model=MINIMAX_MODEL,
|
||||
model=LLM_MODEL,
|
||||
client=openai_client,
|
||||
),
|
||||
# 3. TTS blackbox
|
||||
|
||||
Reference in New Issue
Block a user