This repository contains a simple chatbot app utilising the Google Live API via membrane_gemini_plugin. It's a TUI app built using Membrane for audio processing and Termite for the UI.
We recommend running the demo via livebook.
To run the native demo:
GEMINI_API_KEY="your API key" elixir native.exs
You can prompt Gemini via the text input field, or speak to it directly. Membrane will try using the default input device via membrane_portaudio_plugin. NOTE: since PortAudio doesn't provide echo cancellation, be sure to use headphones to avoid audio feedback and Gemini replying to itself.
The demo works around two processes - the Membrane pipeline and the Membrane.LLM.Demo.App GenServer. The latter receives events from the former and modifies the TUI appropriately.
Additional Membrane elements are provided to facilitate communication between the pipeline and TUI.
Membrane.LLM.Demo.TuiSink- Forwards audio samples, thinking prompts, transcripts, etc. fromMembrane.Gemini.Binto theAppGenServer. Useful reference for how events thatMembrane.Gemini.Binsends downstream can be handled for integration with modules outside the pipeline.Membrane.LLM.Demo.MuteFilter- Toggles between forwarding audio buffers arriving on its input pad and silence. The toggle is controlled by parent notifications. In the examples, these are triggered by the TUI when it receives a/mutecommand in the text input prompt.Membrane.LLM.Demo.TextSource- Similar toMembrane.LLM.Demo.MuteFilter, receives text via parent notification and forwards it on its output pad. In the example, it is linked to the:text_inputpad ofMembrane.Gemini.Bin, and the notifications are triggered by text input prompts from the TUI.