needle简单试用
needle 核心是比较轻量,以下是一个简单尝试(注意目前needle 是不支持中文的)
参考代码
- 示例
import needle
import datetime
@needle.tool
def get_weather(city: str):
"Get the current weather for a city."
return {"city": city, "temp_c": 27, "sky": "clear"}
@needle.tool
def current_dates():
"Get the current date."
return {"date": datetime.datetime.now().strftime("%Y-%m-%d")}
if __name__ == "__main__":
agent = needle.Needle(tools=[get_weather, current_dates])
print(agent.run("get current date and beijing weather")["results"])
- 效果 速度还是比较快的

说明
needle 设计上是比较有意思的,但是就是不支持中文,但是架构设计上值得学习下
浙公网安备 33010602011771号