docs:Fix Google GenAI Embedding params (#31188)

Extend Google parameters in the embeddings tab to include Google GenAI
(Gemini)

**Description:** Update embeddings tab to include example for Google
GenAI (Gemini)

**Issue:** N/A

**Dependencies:** N/A

**Twitter handle:** N/A


- [ ] **Add tests and docs**: If you're adding a new integration, please
include
1. a test for the integration, preferably unit tests that do not rely on
network access,
2. an example notebook showing its use. It lives in
`docs/docs/integrations` directory.


- [ ] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, eyurtsev, ccurme, vbarda, hwchase17.

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
Rares Vernica 2025-05-14 05:50:11 -07:00 committed by GitHub
parent ce0b1a9428
commit 4f41b54bcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,8 +9,10 @@ export default function EmbeddingTabs(props) {
hideOpenai,
azureOpenaiParams,
hideAzureOpenai,
googleParams,
hideGoogle,
googleGenAIParams,
hideGoogleGenAI,
googleVertexAIParams,
hideGoogleVertexAI,
awsParams,
hideAws,
huggingFaceParams,
@ -38,7 +40,8 @@ export default function EmbeddingTabs(props) {
const azureParamsOrDefault =
azureOpenaiParams ??
`\n azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],\n azure_deployment=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"],\n openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],\n`;
const googleParamsOrDefault = googleParams ?? `model="text-embedding-004"`;
const googleGenAIParamsOrDefault = googleGenAIParams ?? `model="models/embedding-001"`;
const googleVertexAIParamsOrDefault = googleVertexAIParams ?? `model="text-embedding-004"`;
const awsParamsOrDefault = awsParams ?? `model_id="amazon.titan-embed-text-v2:0"`;
const huggingFaceParamsOrDefault = huggingFaceParams ?? `model_name="sentence-transformers/all-mpnet-base-v2"`;
const ollamaParamsOrDefault = ollamaParams ?? `model="llama3"`;
@ -73,13 +76,22 @@ export default function EmbeddingTabs(props) {
shouldHide: hideAzureOpenai,
},
{
value: "Google",
label: "Google",
text: `from langchain_google_vertexai import VertexAIEmbeddings\n\n${embeddingVarName} = VertexAIEmbeddings(${googleParamsOrDefault})`,
value: "GoogleGenAI",
label: "Google Gemini",
text: `from langchain_google_genai import GoogleGenerativeAIEmbeddings\n\n${embeddingVarName} = GoogleGenerativeAIEmbeddings(${googleGenAIParamsOrDefault})`,
apiKeyName: "GOOGLE_API_KEY",
packageName: "langchain-google-genai",
default: false,
shouldHide: hideGoogleGenAI,
},
{
value: "GoogleVertexAI",
label: "Google Vertex",
text: `from langchain_google_vertexai import VertexAIEmbeddings\n\n${embeddingVarName} = VertexAIEmbeddings(${googleVertexAIParamsOrDefault})`,
apiKeyName: undefined,
packageName: "langchain-google-vertexai",
default: false,
shouldHide: hideGoogle,
shouldHide: hideGoogleVertexAI,
},
{
value: "AWS",