Beancount 是一个复式记账工具,我用了它记账两三个月了,关于bencount本身如果有兴趣的可以这个系列文章。它有一个 query 的功能,可以用类似 SQL 的语法来查询数据。最近两天花时间写了个工具使用 OpenAI 提供的接口写自然语言生成 Beancount query language 语句。


基本达到了我想要的效果,但还有提升的空间。边用边改进咒语 🏃♂️
Repo: https://github.com/fengkx/beancount-smart-query
Usage:
╰─❯ bean-sq query --help                                         
Query beancount in human language with the help of AI
USAGE
  [imath:0] bean-sq query FILE QUERY [--learning] [-v]
FLAGS
  -v, --verbose  detail log
  --learning     whether AI will teaching you how to query
DESCRIPTION
  Query beancount in human language with the help of AI
EXAMPLES
  [/imath:0] bean-sq query main.bean 'List all my traffic cost in last month'  
  [imath:0] bean-sq query main.bean '列出近一周 CMB 银行卡的账单 按时间先后顺序输出'  
  [/imath:0] bean-sq query main.bean '上个月花了多少钱在娱乐上'