Building a bot in a single prompt using Google Gemini.
I still find this mad – I have a one prompt wonder on my hands, thanks to Google Gemini.
The Project
My first experiments in prompt engineering delivered real results. Just one day after sharing the output from those efforts, I discovered there’s actually a name for what I’d been doing: context engineering. (Credit to Dharmesh Shah’s blog for the term!).
It turns out the combination of:
- Pre-aggregated data
- Metadata that defines context
- Prompts engineered for both the user query and the model’s output
…is incredibly powerful. The insights generated are not only novel, but repeatable, professional, and robust.
But something critical was missing — charts. A core part of our world (and my blogs!).

Are All LLMs created equal?
Until now, all of my blogs have relied on ChatGPT. Why?
- I’ve been a user since July 2023 – for both business and personal projects.
- I have recently adopted the mindset: if the LLM can’t do it, get the LLM to write the code.
- I replaced Google searches with ChatGPT – it became my primary research funnel.
- Most importantly, I believed that our shared history was producing a genuinely personalized experience.
However, I’m in full research mode (as these blogs hopefully show). After seven weeks working exclusively with ChatGPT, I decided to switch to Google’s Gemini for the next seven weeks – purely in the name of experimentation.
Mind: BLOWN!
I am using my repo dashboard again. It is simple data, and I have repeatedly developed the interactions between AI and the data. This week, I am aiming for JARVIS-types of ability.

The dataset is relatively simple and, by this stage, well-understood. I fired up the Gemini 2.5 Pro model and sent this prompt:
+ Repo_Dashboard.py
+ metadata.csv
This is an app I have so far, which is working well. I want to code an AI agent that will go off and create a chart as well as provide LLM-generated summary text
Gemini instantly raised the bar. How?
- Code awareness: It didn’t just spit out code – it understood the app’s structure and the scope of what I was trying to do.
- Preservation: It built on the existing app, rather than overwriting it. That wasn’t a given and really matters.
- Vibe-coding friendly: The instructions it gave (e.g. TOML files, CLI commands) would have scared me off 7 weeks ago – but this time, I appreciated how well explained they were.
- Unexpected clarity: It articulated what the new features did and why. I hadn’t asked for this, but now that I’ve seen it, I can’t go without it. Who knew?!
The App
This is what Gemini went away and built;
Key Changes and How the Agent Works
LangChain Agent: We replaced the direct OpenAI call with create_pandas_dataframe_agent. This is a specialized agent that is pre-configured to understand and query pandas DataFrames.
The filtered_df is Key: The agent is created after you've applied your sidebar filters. This means it only ever has access to the slice of data you're currently interested in, making it fast and relevant.
Interactive Chat: The app now has a chat input where you can ask questions in plain English.
Prompt Engineering: The magic is in the AGENT_PROMPT_PREFIX. This is a detailed set of instructions we give to the AI. We tell it what its persona is ("financial market structure analyst") and, most importantly, demand that it creates an Altair chart in its response.
Code Extraction and Execution: When the agent responds, the Python code:
Uses a regular expression (re.search) to find the Python code block for the chart.
Executes this code using exec(). This is what actually creates the chart object in Python.
Renders the chart using st.altair_chart().
Displays the text part of the agent's answer.
Stateful Conversation: By using st.session_state, your conversation with the agent (including the charts it generates) will remain on the screen as you continue to ask more questions.
And you know what? It worked!
I am taking some of the credit here – I think I might be getting good at this vibe coding malarky!
After a bit of experimentation, I noticed that it had somehow dropped the metadata (so demerits on (2) preservation), but that was an easy fix.
So I am only stretching the story-telling truth slightly when I say I have a one prompt wonder on my hands.
One prompt. One app. Fully working. Watch the video below:
What is it doing?
Helpfully, even the command line tells a story: the agent is working behind the scenes, generating visual and textual insights in real-time.

Best of all? I love how the LLM identifies what is valuable in Clearing:
- Transparency
- Financial stability
- Counterparty risk
- Market efficiency
The LLM didn’t get THAT from the data or prompt alone. It came from good metadata and strong context engineering combining to create meaningful, human-level understanding.
In Summary
- One Prompt, One Bot: Using Google Gemini and a single prompt, I built a fully functioning AI agent that reads filtered data, generates charts, and writes financial analysis.
- Context Engineering = Magic: Combining structured data, rich metadata, and purpose-built prompts led to repeatable, professional insights – not just code, but real context-aware analysis.
- LLM Showdown Begins: After seven weeks with ChatGPT, I switched to Gemini. The result? A bot that preserved my app, enhanced it, and delivered human-like performance. 1-0 Gemini.


Leave a Reply