refactor: Use REST API for Gemini SQL generation

- Modified the `_generate_sql_from_natural_language` helper function in `routes/sql_explorer.py` to use direct REST API calls via the `requests` library instead of the `google-generativeai` Python library.
- Added `requests` and `json` imports and removed the `google-generativeai` import.
- Updated error handling for API communication and response parsing.
- Updated the corresponding changelog entry.
This commit is contained in:
Peter Stockings
2025-04-05 21:17:56 +11:00
parent b875b49eca
commit bd8a3fcdb2
3 changed files with 142 additions and 24 deletions

View File

@@ -10,6 +10,15 @@
<div class="prose max-w-none">
<p>Updates and changes to the site will be documented here, with the most recent changes listed first.</p>
<!-- New Entry for SQL Generation -->
<hr class="my-6">
<h2 class="text-xl font-semibold mb-2">April 5, 2025</h2>
<ul class="list-disc pl-5 space-y-1">
<li>Added experimental feature to SQL Explorer to generate SQL queries from natural language using the
Gemini REST API. Requires `GEMINI_API_KEY` environment variable.</li>
</ul>
<!-- New Entry for Endpoints Refactoring -->
<hr class="my-6">
<h2 class="text-xl font-semibold mb-2">March 31, 2025</h2>