litAI llm router 框架
litai 是Lightning-AI 团队提供的一个llm router 框架,支持通过openai 格式进行llm api 访问,比较适合构建agent 以及ai app, 同时还支持tools 调用
参考玩法
- tools 调用
from litai import LLM, tool
@tool
def get_weather(location: str):
return f"The weather in {location} is sunny"
llm = LLM(model="openai/gpt-5")
# OPTION A: automatic tool call
result = llm.chat("What's the weather in Tokyo?", tools=[get_weather], auto_call_tools=True)
# The weather in Tokyo is sunny
# OPTION B: manually call tools for more control
chosen_tool = llm.chat("What's the weather in Tokyo?", tools=[get_weather])
result = llm.call_tool(chosen_tool, tools=[get_weather])
# The weather in London is sunny
参考资料
实际上类似的工具还是不少的,比如litellm, litai 目前star 并不是很多,但是值得尝试下,比较轻量
浙公网安备 33010602011771号