Access Google AI’s `gemini` and `gemini-vision` models, as well as other generative models through `ChatGoogleGenerativeAI` class in the [langchain-google-genai](https://pypi.org/project/langchain-google-genai/) integration package.

```
In realms where data streams like fervent tides,Where algorithms dance and knowledge abides,A tale unfolds of LangChain, grand and bold,A ballad sung in bits and bytes untold.Amidst the codes and circuits' hum,A spark ignited, a vision would come.From minds of brilliance, a tapestry formed,A model to learn, to comprehend, to transform.In layers deep, its architecture wove,A neural network, ever-growing, in love.With language's essence, it sought to entwine,To unlock the secrets, each word's design.From texts vast and varied, it feasted and learned,Its grasp on meaning, swiftly discerned.Context and syntax, it embraced with grace,Unraveling stories, at an astonishing pace.Translations sprang forth, with seamless art,Bridging tongues and weaving hearts apart.From English to French, Chinese to Spanish, behold,LangChain's prowess, like a language untold.It summarized texts, with insights profound,Extracting knowledge, without a sound.Questions it answered, with eloquence rare,A digital sage, beyond compare.Yet, its journey faced trials and tribulations,Obstacles that tested its dedication.Biases and errors, it sought to transcend,For fairness and accuracy, it would contend.With every challenge, it emerged more strong,Adaptive and resilient, all along.For LangChain's purpose was etched in its core,To empower humans, forevermore.In classrooms and workplaces, it lent its hand,A tireless assistant, at every demand.It aided students, in their quests for knowledge,And professionals thrived, with its guidance and homage.As years unfurled, its fame grew wide,A testament to its unwavering stride.Researchers and scholars, they all took heed,Of LangChain's brilliance, a groundbreaking deed.And so, the ballad of LangChain resounds,A tribute to progress, where innovation abounds.In the annals of AI, its name shall be etched,A pioneer, forever in our hearts sketched.
```

Gemini doesn’t support `SystemMessage` at the moment, but it can be added to the first human message in the row. If you want such behavior, just set the `convert_system_message_to_human` to True:

`ChatGoogleGenerativeAI` natively supports streaming and batching. Below is an example.

```
There once was an AI named Bert,Whose language skills were quite expert.---With a vast dataset,It could chat, even bet,And write limericks, for what it's worth.---
```

To provide an image, pass a human message with contents of type `List[dict]`, where each dict contains either an image value (type of `image_url`) or a text (type of `text`) value. The value of `image_url` can be any of the following:

```
AIMessage(content=' The image contains a snow-capped mountain peak.')
```

As of the time this doc was written (2023/12/12), Gemini has some restrictions on the types and structure of prompts it accepts. Specifically:

Gemini models have default safety settings that can be overridden. If you are receiving lots of “Safety Warnings” from your models, you can try tweaking the `safety_settings` attribute of the model. For example, to turn off safety blocking for dangerous content, you can construct your LLM as follows:

For an enumeration of the categories and thresholds available, see Google’s [safety setting types](https://ai.google.dev/api/python/google/generativeai/types/SafetySettingDict).

You can pass the following parameters to ChatGoogleGenerativeAI in order to customize the SDK’s behavior: