Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication via VertexAI #523

Open
BassCoder2808 opened this issue Jun 27, 2024 · 0 comments
Open

Authentication via VertexAI #523

BassCoder2808 opened this issue Jun 27, 2024 · 0 comments

Comments

@BassCoder2808
Copy link

Is your feature request related to a problem? Please describe.
When we try to use Gemini LLM we only have option to pass it as an API KEY, what if we have a json file through which we want to connect to our LLM Project?

Describe the solution you'd like
In gemini_chat.py inside the else part, we can have a solution of passing the path to the json file through which we will be connecting to the Gemini LLM project

The code for connection can look something like this

`
if "api_key" in config or os.getenv("GOOGLE_API_KEY"):
import google.generativeai as genai

        genai.configure(api_key=config["api_key"])
        self.chat_model = genai.GenerativeModel(model_name)
    else:
        # Authenticate using VertexAI
        import google.auth
        import vertexai
        from vertexai.generative_models import GenerativeModel, Part
        os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = PATH
        credentials, _ = google.auth.default()
        vertexai.init()
        self.chat_model = GenerativeModel("gemini-pro")

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant