Files
Mutual_Fund/scripts/check_advisor_llm.py

36 lines
994 B
Python

"""Read-only smoke check for the configured LLM chat and embedding endpoints."""
from __future__ import annotations
import asyncio
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from tool.llm import llm
async def check() -> None:
try:
answer = await llm.chat(
[
{"role": "system", "content": "你是一个合规的基金投顾助手。"},
{"role": "user", "content": "只回复:连接正常"},
],
temperature=0,
max_tokens=16,
)
print("chat: ok", answer[:32])
except Exception as exc:
print(f"chat: {type(exc).__name__}: {exc}")
try:
vectors = await llm.embed(["投顾记忆联调"])
print("embedding: ok", len(vectors), len(vectors[0]) if vectors else 0)
except Exception as exc:
print(f"embedding: {type(exc).__name__}: {exc}")
if __name__ == "__main__":
asyncio.run(check())