Hierarchical categorization of substack comments
Demo of using OpenAI embeddings and ChatGPT API to organize content, and my ever-growing amazement with AI-augmented programming tools.
Interactive demo: matthagy.github.io/sb_comment_category_hierarchy
OpenAI’s embeddings are a powerful tool for comparing and organizing text by semantic content. I’ve previously experimented with using them to group Slow Boring comments into categories. This project expands on those methods using hierarchical categorization, meaning categories can contain subcategories, which in turn can have their own subcategories, and so on. You can explore the resulting fractal structure of these categories in an online interactive demo.
Further, each group of comments is summarized and given a title using the OpenAI Chat Completion API (gpt-3.5-turbo
). While the summaries are generally quite impressive, the titles can be inconsistent. To address this, five titles are requested and displayed in the UI, allowing users to get a sense of the general themes within the comment group.
To better explain the hierarchical categorization methods in detail, I’m currently working on a comparable project using just my own substack comments. That will allow me to share fully working code and data to demonstrate the methods. Check back soon for that post. (Update: See Hierarchical categorization using OpenAI: Methods exposition.)
AI-augmented coding tools
In addition to the OpenAI APIs, I was particularly struck by how AI-enhanced coding tools enabled me, a programmer without professional web development experience, to create this interactive demo in roughly four hours. This process involved utilizing GitHub Copilot to offer code suggestions directly within my IDE as I built the site. It's truly delightful to have this AI-powered autocomplete system intuit my intentions and propose relevant lines of code accordingly.
Furthermore, ChatGPT was invaluable for teaching me the basics of TypeScript, D3.js, webpack, and so much more. For each new technology, I started by asking ChatGPT for an overview, and then proceeded to ask a series of progressively more specific questions.
ChatGPT was able to provide highly specific examples to demonstrate concepts that I needed.
When things didn't work as I anticipated, I was generally able to describe the issue to ChatGPT, and it would help me correct the code. On one occasion, I was tempted to search Google for insights into a particularly challenging problem related to TypeScript generics. However, I quickly became frustrated with the quality of Stack Overflow posts and returned to ChatGPT. After a little prompt experimentation, I had the solution.
I am now more certain than ever that AI programming tools will not only greatly enhance productivity, but also bring about huge disruptions for software engineering.