Original blog article:
https://estuary.dev/gpt-real-time-pip...
Code repo:
https://github.com/jgraettinger/slack...
GPT Playlist:
• How ChatGPT Can Help Autistic People Under...
🏄🏻♂️ If you're interested in Surfshark, sign up via this link for an exclusive discount and free months:
https://get.surfshark.net/aff_c?offer...
🍺 If you've learned something new from this video, buy me a coffee to support this channel =)
https://bmc.link/jennyman
0:00 Intro
0:29 Blog
1:11 Demo
1:54 Context is everything
3:22 Solution
4:37 Slack Capture
5:45 Surfshark
6:59 Transformation
7:54 Properties of Derivation
8:55 Materialize
10:10 Other use cases
Much ink has been spilled about GPT’s impressive capabilities, generally framed around a problem definition, a toy static data set, and novel prompting techniques. This post is not that.
This post addresses how you can productionize a custom, always-on, GPT-enabled transformation pipeline with your actual data. As a demonstration, I’ll use Estuary’s Slack instance to:
1 Capture Slack conversations as they’re happening
2 Derive a continuous GPT summarization of each thread’s content thus far
3 Materialize evolving threads and summaries into Google Sheets
Context Is Everything
AI pipelines have a context problem.
A critical fact to understand about GPT (and all trained AI models, really), is that they’re pure functions of their training set – which in the case of ChatGPT cuts off after 2021 – and a current prompt. That’s it. It’s an intelligent, touchingly immature assistant that has great recall of its training set but starts every interaction with horrible amnesia.
Sizing the Problem
Conversations are happening all the time, and I’d like my spreadsheet to update along with them. I can tolerate some latency but I’d like it to be minimal.
I know I’ll need to perform a meaningful amount of transformation before I can hand off threads to GPT for summarization. I can smell a multiway SQL join.
At the same time, GPT has practical limitations: OpenAI offers an ergonomic REST API but it has fairly restrictive rate limits, which bound the overall API throughput I can utilize. It’s also far more expensive than your average API, so I only want to invoke it when a thread is changing due to new or edited messages, and perhaps only after first rolling up any closely-arriving messages.
At its core, this is a pipeline with distinct “capture,” “transform,” and “materialize” phases:
1 Capture incremental updates from Slack’s API.
2 Transform new Slack records into a full thread context and summarize with GPT.
3 Materialize thread summaries back out into a Google Sheet.
If I were to build this using other common tooling, I would probably use:
1 Capture: Fivetran is the dominant tool for extract & load into a warehouse (the “EL” of “ELT”).
2 Transform: A custom script, perhaps scheduled with Airflow, that looks for threads updated since the last invocation, assembles their full context via a SELECT, calls out to OpenAI’s API for completions, and then upserts rows into a summaries table. Or, dbt’s Python models could be an option, but beware of limitations.
3 Materialize: Hightouch is a common tool for reverse-ETL, which can sync my summaries table to a Google Sheet.
This stack could certainly work. It’s also (at least) three different tools, plus a warehouse and something to run my Python script. Everything is on its own periodic schedule, and I’ll need to be careful to minimize latency. It’s also incumbent upon me to make sure everything is properly incremental: if I accidentally do a full refresh, that could be an expensive OpenAI bill.
Derivations have a few properties that make them well-suited for this task:
They run continuously
They’re incremental.
They’re transactional and pipelined.
They reduce data volumes
They’re fully managed.
They’re composable.
I went with a deliberately basic GPT prompting technique for this post. Summarization, while useful, is barely scratching at the possible use cases of a pipeline like this. Other use cases include:
Tracking work streams discussed in a thread, with descriptions and owners.
Updating a CRM system with relevant customer discussions in Slack.
Materializing whole Slack threads into Pinecone with semantic embeddings. Then, build question-answering applications on top of your organization’s institutional knowledge.
Proactively identifying when a discussion in Slack can be informed from the existing body of institutional knowledge.
Monitoring for security or regulatory compliance.
#chatgpt #chatgpt4 #chatgptprompt #openai #datapipeline #ai #artificialintelligence