vanna-ai / vanna

🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using RAG 🔄.
https://vanna.ai/docs/
MIT License
9.97k stars 737 forks source link

Adding Google Gemini Chat integration to Vanna #356

Closed vipgupta closed 3 months ago

vipgupta commented 3 months ago

As a frequent user of Vanna in my projects, I've successfully integrated Google Gemini Chat with Vanna. I believe this integration could be valuable to other users, so I've submitted this pull request to share my work with the community. This addition enables seamless integration of Google Gemini Chat with Vanna (both through API key and Vertex AI), potentially enhancing its functionality for users who require Gemini chat capabilities.

zainhoda commented 3 months ago

@vipgupta awesome! Thank you! I had started playing with Gemini but I couldn't find a good way to get the system prompt in there as it didn't seem like Gemini had an option to set the system prompt.

In this code, it seems like the messages are being flattened to strings and then the prompt is a list of strings without role? This is an interesting approach. I'll check it out. Did you find that it actually works?

vipgupta commented 3 months ago

@zainhoda Yes it works! Verified it both with Vertex AI and Google AI studio API key. Yes, Gemini doesn't have a differentiation between a system prompt and a user prompt, and this approach of flattening the messaged worked. We are using it in our project for SQL query generation :)

vipgupta commented 3 months ago

@zainhoda Can you review the PR? Also, here's a thread on people complaining about Gemini not having a system prompt and using the flattening out approach.

zainhoda commented 3 months ago

@vipgupta the code looks good. I’m just going to test it with my own account first and add this to the list of integration tests

vipgupta commented 3 months ago

Sounds good! Let me know if you need any help from my end.

On Tue, Apr 16, 2024, 7:28 PM Zain Hoda @.***> wrote:

@vipgupta https://github.com/vipgupta the code looks good. I’m just going to test it with my own account first and add this to the list of integration tests

— Reply to this email directly, view it on GitHub https://github.com/vanna-ai/vanna/pull/356#issuecomment-2059165689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIK7P2TL37ZUZSK6RJAD23Y5UVB5AVCNFSM6AAAAABGC4BG46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZGE3DKNRYHE . You are receiving this because you were mentioned.Message ID: @.***>