A lightweight and efficient chatbot built in C, leveraging the power of the Gemini Pro API for natural language processing and conversational AI.
- Lightweight and Fast: Built in C for optimal performance.
- Gemini Pro API Integration: Leverages the Gemini Pro API for advanced conversational AI.
- Cross-Platform: Works on Linux, macOS, and Windows (with minor adjustments).
- Customizable: Easily modify the chatbot's behavior and responses.
- History Storage: Supports up to 40KB of conversation history.
- Simple Frontend: Includes a web interface for easy interaction.
- Runtime Settings: Configure model, temperature, top-p, top-k, max tokens, and system prompt via REST.
- Health & Maintenance: Health check and clear history endpoints.
To run this application, you'll need the following:
- C Compiler: GCC recommended.
- libcurl: For making HTTP requests to the Gemini Pro API.
- json-c: For parsing JSON responses from the API.
- Python 3: For running the frontend server (optional; you can also serve via the C server).
sudo apt-get update
sudo apt-get install gcc libcurl4-openssl-dev libjson-c-dev libmicrohttpd-dev python3sudo yum update
sudo yum install gcc libcurl-devel json-c-devel libmicrohttpd-devel python3- Set your Gemini API key as an environment variable before running the server:
export GEMINI_API_KEY="your_gemini_pro_api_key_here"
- Optional runtime settings can be adjusted via the
/configendpoint or the frontend Settings modal.
- Navigate to the
backenddirectory:cd backend - Build the application:
make
- Run the server:
./server
Open frontend/index.html directly or let the C server serve it at http://localhost:8080/.
POST /chat- Body:
{ "message": "..." } - Response:
{ "response": "..." }
- Body:
GET /config- Returns current runtime settings:
{ model, temperature, top_p, top_k, max_output_tokens, system_prompt }
- Returns current runtime settings:
POST /config- Body (any subset):
{ model, temperature, top_p, top_k, max_output_tokens, system_prompt } - Sets runtime settings.
- Body (any subset):
POST /clear- Clears chat history.
GET /health- Returns
{ "status": "ok" }.
- Returns
Contributions are welcome! Here's how you can help:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a detailed description of your changes.
Please ensure your code follows the existing style and includes appropriate documentation.
If you find this project useful, please consider giving it a ⭐️ on GitHub! For questions or feedback, open an issue or reach out to [your email or social media handle].
Visit the Gemini Pro website to sign up and obtain an API key.
Yes, but you may need to adjust the build process. Contributions for Windows support are welcome!
- Gemini Pro API for providing the conversational AI backend.
- libcurl and json-c for enabling HTTP requests and JSON parsing in C.
- libmicrohttpd for the embedded HTTP server.