From 4f41b54bcbeb2cbc336d857f64657172acaaac91 Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Wed, 14 May 2025 05:50:11 -0700 Subject: [PATCH] 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 --- docs/src/theme/EmbeddingTabs.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/src/theme/EmbeddingTabs.js b/docs/src/theme/EmbeddingTabs.js index b599f6654e9..96b874cbf1f 100644 --- a/docs/src/theme/EmbeddingTabs.js +++ b/docs/src/theme/EmbeddingTabs.js @@ -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",