以前说过基于结构化数据配置进行函数调用的,以下是直接使用llama-cpp-agent 自带的StructuredOutputAgent
环境准备
需要安装llama-cpp-agent 以及启动一个llama-server
- 安装
- 服务启动
Linux 环境自己编译的llama-server
llama-cpp-agent 代码调用
- demo3.py
说明
llama-cpp-agent 基于grammars 以及json schema 的结构化数据还是比较稳定的,项目中值得试用下
参考资料
https://llama-cpp-agent.readthedocs.io/en/latest/get-started/#create-agent