Satyajit Datta
Satyajit Datta

Reputation: 33

What are the different python libraries to access Google LLMs?

I have come across multiple different libraries for accessing Google LLMs. I am listing the ones I came across; but there may be more.

The libraries that I have seen so far:

# 1
from langchain_google_genai import ChatGoogleGenerativeAI, GoogleGenerativeAI

# 2
from langchain.chat_models import ChatVertexAI

#3 
from langchain_google_vertexai import ChatVertexAI, VertexAI, VertexAIEmbeddings

#4
import vertexai  
from vertexai.generative_models import GenerativeModel
from vertexai.language_models import TextGenerationModel

# 5
from google.generativeai import GenerativeModel

My questions:

  1. Are these distinct ways or do they give access to the same set of models?
  2. Which is the recommended way?

I have looked into Google Cloud Documentation, but did not come across any conclusive guide.

I have tried checking the Google Cloud Documentation, but did not come accross a conclusive guide.

Upvotes: 1

Views: 382

Answers (1)

Ark-kun
Ark-kun

Reputation: 6812

Google has 2 sets of APIs that support Gemini LLMs: "Google AI" (not part of Google Cloud) and "Google Cloud Vertex AI" (part of Google Cloud). The APIs are pretty much identical, although there are some features in "Google Cloud Vertex AI" that do not exist in "Google AI".

The official namespace of the Python SDK for Gemini in "Google AI" is google.generativeai.generative_models.

The official namespace of the Python SDK for Gemini in "Google Cloud Vertex AI" is vertexai.generative_models.

The LangChain libraries are wrappers of those Google libraries and APIs.

Upvotes: 3

Related Questions