Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The following environment variables are required to run the application:
- azure: "text-embedding-3-small" (will be used as your Azure Deployment)
- huggingface: "sentence-transformers/all-MiniLM-L6-v2"
- huggingfacetei: "http://huggingfacetei:3000". Hugging Face TEI uses model defined on TEI service launch.
- vertexai: "text-embedding-004"
- vertexai: "text-embedding-005"
- ollama: "nomic-embed-text"
- bedrock: "amazon.titan-embed-text-v1"
- google_genai: "gemini-embedding-001"
Expand All @@ -91,6 +91,7 @@ The following environment variables are required to run the application:
- `GOOGLE_API_KEY`, `GOOGLE_KEY`, `RAG_GOOGLE_API_KEY`: (Optional) Google API key for Google GenAI embeddings. Priority order: RAG_GOOGLE_API_KEY > GOOGLE_KEY > GOOGLE_API_KEY
- `AWS_SESSION_TOKEN`: (Optional) may be needed for bedrock embeddings
- `GOOGLE_APPLICATION_CREDENTIALS`: (Optional) needed for Google VertexAI embeddings. This should be a path to a service account credential file in JSON format, as accepted by [langchain](https://python.langchain.com/api_reference/google_vertexai/index.html)
- `VERTEXAI_LOCATION`: (Optional) needed for Google VertexAI embeddings. Defaults to `us-central1`.
- `RAG_CHECK_EMBEDDING_CTX_LENGTH` (Optional) Default is true, disabling this will send raw input to the embedder, use this for custom embedding models.

Make sure to set these environment variables before running the application. You can set them in a `.env` file or as system environment variables.
Expand Down
5 changes: 3 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def init_embeddings(provider, model):
elif provider == EmbeddingsProvider.GOOGLE_VERTEXAI:
from langchain_google_vertexai import VertexAIEmbeddings

return VertexAIEmbeddings(model=model)
return VertexAIEmbeddings(model=model, location=VERTEXAI_LOCATION)
elif provider == EmbeddingsProvider.BEDROCK:
from langchain_aws import BedrockEmbeddings

Expand Down Expand Up @@ -289,7 +289,8 @@ def init_embeddings(provider, model):
"EMBEDDINGS_MODEL", "http://huggingfacetei:3000"
)
elif EMBEDDINGS_PROVIDER == EmbeddingsProvider.GOOGLE_VERTEXAI:
EMBEDDINGS_MODEL = get_env_variable("EMBEDDINGS_MODEL", "text-embedding-004")
EMBEDDINGS_MODEL = get_env_variable("EMBEDDINGS_MODEL", "text-embedding-005")
VERTEXAI_LOCATION = get_env_variable("VERTEXAI_LOCATION", "us-central1")
elif EMBEDDINGS_PROVIDER == EmbeddingsProvider.OLLAMA:
EMBEDDINGS_MODEL = get_env_variable("EMBEDDINGS_MODEL", "nomic-embed-text")
elif EMBEDDINGS_PROVIDER == EmbeddingsProvider.GOOGLE_GENAI:
Expand Down