Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
11.86k stars 1.11k forks source link

Support for Gemini models via VertexAI? #1269

Open tytung2020 opened 4 days ago

tytung2020 commented 4 days ago

System Info

import os import pandas as pd from pandasai import Agent from pandasai.llm import GoogleVertexAI

🐛 Describe the bug

any update on this issue? I saw an earlier issue and it was closed, but after I tested it still not able to use Google VertexAI with these parameters:

llm = GoogleVertexAI(
    project_id="some_location", location="us-central1", model="gemini-1.5-flash"
)

with this error: ERROR:pandasai.helpers.logger:Pipeline failed on step 3: Unsupported model: The model 'gemini-1.5-flash' doesn't exist or is not supported yet. Unfortunately, I was not able to answer your question, because of the following error:

Unsupported model: The model 'gemini-1.5-flash' doesn't exist or is not supported yet.

dosubot[bot] commented 4 days ago

The GoogleVertexAI class in pandas-ai currently supports the "gemini-pro" model. The model "gemini-1.5-flash" is not listed as a supported model, which is why you are encountering the "Unsupported model" error.

Here is the relevant part of the code that lists the supported generative models:

_supported_generative_models = [
    "gemini-pro",
]

To resolve this issue, you should use the "gemini-pro" model instead of "gemini-1.5-flash":

llm = GoogleVertexAI(
    project_id="some_location", location="us-central1", model="gemini-pro"
)

For more details, you can refer to the GoogleVertexAI class implementation [1].

To continue talking to Dosu, mention @dosu.

tytung2020 commented 4 days ago

ok gemini-pro works, but I need it to based on the latest gemini-1.5-flash or gemini-1.5-pro. gemini-pro is based on a Nov 2023 version which is not that accurate.