05. Google Generative AI
Google AI chat models (gemini-pro)
Google AI gemini Wow gemini-vision To access other generation models as well as models langchain-google-genai Integrated package ChatGoogleGenerativeAI If you use a class, you can.
Copy
# !pip install -qU langchain-google-genaiAPI KEY issued
link Get API KEY from.
Environment variable the user's Google API key
GOOGLE_API_KEYSet to.
Copy
from dotenv import load_dotenv
load_dotenv()Copy
TrueCopy
# LangSmith Set up tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging
from langchain_teddynote.messages import stream_response
# Enter a project name.
logging.langsmith("CH04-Models")Copy
Get the ChatGoogleGenerativeAI class from the langchain_google_genai package.
The ChatGoogleGenerativeAI class is used to implement an interactive AI system using Google's Generative AI model.
This class allows users to interact with Google's interactive AI model.
The conversation with the model takes place in the form of a chat, and the model generates an appropriate response based on the user's input.
The ChatGoogleGenerativeAI class is integrated with the LangChain framework, which can be used with other LangChain components.
Supported model information: https://ai.google.dev/gemini-api/docs/models/gemini?hl=ko
Copy
Copy
Copy
Copy
Safety Settings
Gemini models have basic safety settings (Satety Settings), but you can override them.
If you're getting a lot of "Safety Warnings" from the model, safety_settings You can adjust the properties.
Google's Safety Setting Types Documentation provides enumerated information about available categories and thresholds.
This document defines various categories and corresponding thresholds related to content filtering and safety settings, helping developers to select and apply appropriate safety settings when utilizing a generated AI model.
This allows developers to ensure the safety and adequacy of the content generated by the model, and to prevent harmful or inappropriate content from being exposed to users.
Copy
Run Batch units
Copy
Copy
Multimodal model
langchain-teddynote On the multi-modal model implemented in gemini-1.5-pro Images can be converted to text using the model.
Copy
Copy
Copy
Last updated