feat: sweet AI assistant in the Tools drawer#4
Merged
rich-iannone merged 20 commits intomainfrom Aug 10, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the Sweet AI Assistant, which allows you to discuss and transform your data interactively. The conversational AI capabilities complement Sweet's data manipulation workflow, integrating LLM-powered assistance directly into the terminal interface (in the Tools drawer). It's built on the
chatlaslibrary with automatic provider fallback (Anthropic Claude preferred, OpenAI GPT secondary), the assistant intelligently distinguishes between conversational data exploration queries and transformation requests using advanced code detection logic.When users ask exploratory questions like "describe this data" or "what patterns do you see?", the assistant provides immediate conversational insights without requiring approval. However, when users request actual data transformations like "add a calculated column" or "filter these rows", the assistant generates precise Polars code. We provide a fairly comprehensive API reference covering 200+ operations from Polars 1.32.0+ so that it won't have problems with delivery to the transformation approval workflow.
The system requires only a simple .env file with an API key (
ANTHROPIC_API_KEYorOPENAI_API_KEY) and automatically generates dataset context including column types, sample values, and statistics to provide the LLM with complete understanding of the user's current data. This creates a pretty good chat experience for data exploration while maintaining Sweet's preview-before-execute approach for all data modifications.