Skip to content

feat: add analytics demo example#344

Open
AbhinRustagi wants to merge 7 commits intothesysdev:mainfrom
AbhinRustagi:feat/analytics-demo
Open

feat: add analytics demo example#344
AbhinRustagi wants to merge 7 commits intothesysdev:mainfrom
AbhinRustagi:feat/analytics-demo

Conversation

@AbhinRustagi
Copy link
Contributor

@AbhinRustagi AbhinRustagi commented Mar 16, 2026

Closes #300

Summary

  • Adds examples/analytics-demo, a conversational analytics chat app showcasing OpenUI's chart, table, and metric card components
  • Uses Google Gemini SDK (@google/genai) with streaming and manual tool-call loop
  • Includes 4 mock analytics tools (query_revenue, query_sales, query_metrics, query_customers) with built-in sample data — works out of the box with no external data source
  • Follows the same structure as examples/openui-chat

Test plan

  • Set GEMINI_API_KEY in .env.local and run pnpm dev from examples/analytics-demo
  • Verify conversation starters render and clicking them produces streamed analytics UI (charts, tables, metric cards)
  • Try multi-turn queries (e.g., "Show me revenue trends" → "Now compare by region")
  • Confirm pnpm -r run build passes for all workspace packages

🤖 Generated with Claude Code

Example Screenshot:

Screenshot 2026-03-16 at 14-40-49 Analytics Demo

AbhinRustagi and others added 2 commits March 16, 2026 14:38
Adds a conversational analytics chat app in examples/analytics-demo
that showcases OpenUI's chart, table, and metric card components.
Uses Google Gemini SDK with mock analytics tools (revenue, sales,
metrics, customers) and built-in sample data.

Closes thesysdev#300

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds documentation for the analytics-demo example to the OpenUI Lang
examples section, covering architecture, setup, key files, tools table,
and system prompt generation. Includes a video placeholder.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AbhinRustagi
Copy link
Contributor Author

@ankit-thesys, I haven't been able to test this; it is modeled on the openui-chat example. I don't yet have an API key for OpenAI. Will perhaps need your help, or if you can allow another day.

@zahlekhan
Copy link
Contributor

zahlekhan commented Mar 24, 2026

https://ai.google.dev/gemini-api/docs/openai
@AbhinRustagi you can use Gemini with OpenAI SDK

@AbhinRustagi
Copy link
Contributor Author

thanks @zahlekhan for this

@ankit-thesys
Copy link
Contributor

I will test it once i am little free 😄

@AbhinRustagi
Copy link
Contributor Author

AbhinRustagi commented Mar 25, 2026

Thank you @ankit-thesys

@zahlekhan I tried using Gemini with the OpenAI SDK, in my exploration, the tool calling does not work well yet with Gemini. Gemini's streaming endpoint sends the tool calling chunks as a single completed chunk, but OpenAI SDK runTools() expects a stream of chunks because of which the accumulator loses the tool calls. I was able to write a custom tool calling loop. Do you think adding that for this project would be overkill? But happy to push it to help add it and document it since it might help someone. Would also be happy to hear if you've any experience/inputs with that

@zahlekhan
Copy link
Contributor

Not needed, let ankit test it out this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analytics Demo

3 participants