langchain_google_genai.chat_models.ChatGoogleGenerativeAI¶
class langchain_google_genai.chat_models.ChatGoogleGenerativeAI[source]¶
Bases: BaseChatModel
Google Generative AI Chat models API.
To use, you must have either:
The GOOGLE_API_KEY` environment variable set with your API key, or
Pass your API key using the google_api_key kwarg to the ChatGoogle
constructor.
Example
from langchain_google_genai import ChatGoogleGenerativeAI
chat = ChatGoogleGenerativeAI(model="gemini-pro")
chat.invoke("Write me a ballad about LangChain")
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 cache: Optional[bool] = None¶
Whether to cache the response.
param callback_manager: Optional[BaseCallbackManager] = None¶
Callback manager to add to the run trace.
param callbacks: Callbacks = None¶
Callbacks to add to the run trace.
param google_api_key: Optional[SecretStr] = None¶
Constraints
type = string
writeOnly = True
format = password
param max_output_tokens: int = None¶
Max output tokens
param metadata: Optional[Dict[str, Any]] = None¶
Metadata to add to the run trace.
param model: str [Required]¶
The name of the model to use.
Supported examples:
gemini-pro
param n: int = 1 (alias 'candidate_count')¶
Number of chat completions to generate for each prompt. Note that the API may
not return the full n completions if duplicates are generated.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param temperature: Optional[float] = None¶