With tools like LangChain <https://github.com/hwchase17/langchain> and the 
ChatGPT 
Retrieval Plugin <https://github.com/openai/chatgpt-retrieval-plugin> it 
should be possible to build a smarter importer that understands beancount 
files and extracts transactions from any document, categorizing and 
matching them. Look at the number of document loaders 
<https://python.langchain.com/en/latest/modules/indexes/document_loaders.html>. 
It'll take work to setup (I'm currently trying to pick a vectorstore 
<https://python.langchain.com/en/latest/modules/indexes/vectorstores.html>) 
but it should save a lot of work in the long run.

On Saturday, April 1, 2023 at 10:58:02 AM UTC-4 bl...@furius.ca wrote:

> Mind blown *poofff*
>
> On Sat, Apr 1, 2023 at 10:51 AM Reed Law <ree...@gmail.com> wrote:
>
>> I used a command-line tool, aichat <https://github.com/sigoden/aichat>, 
>> to pipe transactions to GPT-4 and categorize expenses. I gave it the 
>> following input (generated according to Booking Amazon Purchases 
>> <https://reds-rants.netlify.app/personal-finance/booking-amazon-purchases/>
>> ):
>>
>> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional 
>> Sketchbook"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>>
>> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3 
>> Ring Binder, 8.5 x 11 Inch, 200-Pack"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>>
>> 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429 
>> <(339)%20701-1429> Original Equipment Replacement- 12\" (Pack of 1)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -11.6 USD
>>
>> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop, 
>> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control, 
>> Portable Infrared Burner with T"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -69.43 USD
>>
>> 2023-01-26 * "Amazon.com" "PILOT Parallel Caligraphy Pens, Assorted Point 
>> Sizes and Colors, 6 Count (12722)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -32.44 USD
>>
>> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer 
>> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible 
>> with MacBook Air Pro, HP, Lenovo, D"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -14.29 USD
>>
>> Using the following prompt and command:
>>
>> cat amz.beancount | aichat add categorized expense postings to balance 
>> each of the following transactions, preserving the included zero sum 
>> posting. do not use spaces in account names > out.beancount
>>
>> I got these results:
>>
>> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional 
>> Sketchbook"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>>   Expenses:Art:Instructional-Sketchbook
>>
>> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3 
>> Ring Binder, 8.5 x 11 Inch, 200-Pack"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>>   Expenses:Office-Supplies:Sheet-Protectors
>>
>> 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429 
>> <(339)%20701-1429> Original Equipment Replacement- 12\" (Pack of 1)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -11.6 USD
>>   Expenses:Car:Maintenance
>>
>> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop, 
>> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control, 
>> Portable Infrared Burner with T"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -69.43 USD
>>   Expenses:Kitchen:Appliances
>>
>> 2023-01-26 * "Amazon.com" "PILOT Parallel Caligraphy Pens, Assorted Point 
>> Sizes and Colors, 6 Count (12722)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -32.44 USD
>>   Expenses:Art:Calligraphy-Pens
>>
>> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer 
>> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible 
>> with MacBook Air Pro, HP, Lenovo, D"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -14.29 USD
>>   Expenses:Office-Supplies:Laptop-Stand
>>
>> There was some trial and error that resulted in the final prompt. At 
>> first, it removed the zero-sum postings and only output expenses. The 
>> expense accounts had spaces in their names (e.g. "Expenses:Office 
>> Supplies:Laptop Stand"). There is still room for improvement (I don't 
>> really care to have an account for laptop stands). Overall, it looks very 
>> helpful. Perhaps a good workflow is to use GPT to categorize a small batch 
>> of expenses, manually correct them, and then use smart_importer 
>> <https://github.com/beancount/smart_importer> to handle the rest.
>>
>> If anyone else has tips please share!
>>
>>
>> On Saturday, April 1, 2023 at 1:53:46 AM UTC-4 Red S wrote:
>>
>>> Great idea. Talk about drudgery!
>>>
>>> On Friday, March 31, 2023 at 12:35:09 AM UTC-7 bl...@furius.ca wrote:
>>>
>>> I haven't tried yet but my hope is that gpt would be great at writing 
>>> test code. Can you imagine?
>>>
>>> On Fri, Mar 31, 2023, 01:03 Red S <redst...@gmail.com> wrote:
>>>
>>> Fantastic! Hooray for reducing drudgery!
>>>
>>> It's apparently quite effective at using code from existing github 
>>> projects. I love the code explanations in natural language.
>>>
>>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to beancount+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/beancount/38f90ec4-fea3-4794-98de-4d90f28c960dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/beancount/38f90ec4-fea3-4794-98de-4d90f28c960dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/f4eb8365-7b38-4acb-a8fc-d3cc1b6e8fdbn%40googlegroups.com.

Reply via email to