langchain.embeddings.vertexai.VertexAIEmbeddings¶
- class langchain.embeddings.vertexai.VertexAIEmbeddings(*, client: '_LanguageModel' = None, model_name: str = 'textembedding-gecko', temperature: float = 0.0, max_output_tokens: int = 128, top_p: float = 0.95, top_k: int = 40, stop: Optional[List[str]] = None, project: Optional[str] = None, location: str = 'us-central1', credentials: Any = None, request_parallelism: int = 5, max_retries: int = 6)[source]¶
Bases:
_VertexAICommon,EmbeddingsGoogle Cloud VertexAI embedding models.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param credentials: Any = None¶
The default custom credentials (google.auth.credentials.Credentials) to use
- param location: str = 'us-central1'¶
The default location to use when making API calls.
- param max_output_tokens: int = 128¶
Token limit determines the maximum amount of text output from one prompt.
- param max_retries: int = 6¶
The maximum number of retries to make when generating.
- param model_name: str = 'textembedding-gecko'¶
Model name to use.
- param project: Optional[str] = None¶
The default GCP project to use when making Vertex API calls.
- param request_parallelism: int = 5¶
The amount of parallelism allowed for requests issued to VertexAI models.
- param stop: Optional[List[str]] = None¶
Optional list of stop words to use when generating.
- param temperature: float = 0.0¶
Sampling temperature, it controls the degree of randomness in token selection.
- param top_k: int = 40¶
How the model selects tokens for output, the next token is selected from
- param top_p: float = 0.95¶
Tokens are selected from most probable to least until the sum of their
- embed_documents(texts: List[str], batch_size: int = 5) List[List[float]][source]¶
Embed a list of strings. Vertex AI currently sets a max batch size of 5 strings.
- Parameters
texts – List[str] The list of strings to embed.
batch_size – [int] The batch size of embeddings to send to the model
- Returns
List of embeddings, one for each text.
- embed_query(text: str) List[float][source]¶
Embed a text.
- Parameters
text – The text to embed.
- Returns
Embedding for the text.
- validator validate_environment » all fields[source]¶
Validates that the python package exists in environment.
- property is_codey_model: bool¶
- task_executor: ClassVar[Optional[Executor]] = None¶