diff --git a/README.md b/README.md
index 92866b41..0ec3deed 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Coming soon:
- [x] [PyPI package](https://pypi.org/project/textbase-client/)
- [x] Easy web deployment via [textbase deploy](/docs/deployment/deploy-from-cli)
- [ ] SMS integration
-- [ ] Native integration of other models (Claude, Llama, ...)
+- [X] Native integration of other models (Claude, Llama, ...), Bard AI added.

diff --git a/examples/bardAi-bot/README.md b/examples/bardAi-bot/README.md
new file mode 100644
index 00000000..c5b9fe54
--- /dev/null
+++ b/examples/bardAi-bot/README.md
@@ -0,0 +1,43 @@
+# Bard AI Bot
+
+A bot using bardAi developed using a textbase framework.
+
+
+
+## Installation
+---
+Make sure you have `python version >=3.9.0`, it's always good to follow the [docs](https://docs.textbase.ai/) 👈🏻
+### 1. Follow the installation steps in the [documentation of the textbase framework](https://docs.textbase.ai/get-started/installation)👈🏻
+
+### 2. After following the steps in the documentation and making sure that you are in the activated `virtualenv`, execute `pip install -r requirements.txt` in the activated virtual env to install Bard dependency.
+### 3. Then [run server](https://docs.textbase.ai/get-started/test-locally#if-you-have-cloned-the-repo) with this command and Give the `main.py` presenet in `examples/bardAi` while running the project.
+
+### 4. If you are using the `textbase-bot` repo for the front end make sure to replace the API URL as mentioned in the `textbase-bot` repository.
+
+
+
+## Usage
+---
+Make sure you have Bard AI opened in the browser
+### 1. BardAi doesn't provide API key publically i need to fetch it from developer tools of the cookie section of the browser.
+### 9. There is __Secure-1PSID under Bard cookies. need to delete cookies and relogin if the backend is giving errors just like we are having.
+
+
+Refer to this [video link](https://drive.google.com/file/d/1ZDqygsWxe2S_aA60u1ZrxIZhL09uGKjx/view?usp=sharing) for more ideas from configuring the API key to deploying the bot to textbase website I have recorded them all.
+
+
+There are known corrections and future modifications to this project feel free to contribute if you want to.
+- [X] Native integration of other models (BardAi)
+- [ ] Need to display the responses as Google Brad displays with images and links on images as well.
+
+
+
+## Demo
+---
+I'm sure this will not work because the API key must have expired when you are watching this repo but here is a link.
+https://bot.textbase.ai/pspofficial29/bardai
+
+
+### Note
+---
+I know that this api key regenerating is a tedioud task but what should we do? we can't control how third party works! Here is a hope https://www.googlecloudcommunity.com/gc/AI-ML/Google-Bard-API/m-p/538517.
\ No newline at end of file
diff --git a/examples/bardAi-bot/main.py b/examples/bardAi-bot/main.py
new file mode 100644
index 00000000..cbcebcd5
--- /dev/null
+++ b/examples/bardAi-bot/main.py
@@ -0,0 +1,31 @@
+from textbase import bot, Message
+from typing import List
+from textbase.models import BardAI
+
+@bot()
+def on_message(message_history: List[Message], state: dict = None):
+
+ bot_response = BardAI.generate(message_history=message_history)
+
+ response = {
+ "data": {
+ "messages": [
+ {
+ "data_type": "STRING",
+ "value": bot_response
+ }
+ ],
+ "state": state
+ },
+ "errors": [
+ {
+ "message": ""
+ }
+ ]
+ }
+
+
+ return {
+ "status_code": 200,
+ "response": response
+ }
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..2ed0f665
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+bardapi>=0.1.33
\ No newline at end of file
diff --git a/textbase/models.py b/textbase/models.py
index 814ed533..f86bc9e5 100644
--- a/textbase/models.py
+++ b/textbase/models.py
@@ -7,6 +7,8 @@
from textbase import Message
+import os
+from bardapi import Bard
# Return list of values of content.
def get_contents(message: Message, data_type: str):
return [
@@ -143,4 +145,24 @@ def generate(
data = json.loads(response.text) # parse the JSON data into a dictionary
message = data['message']
- return message
\ No newline at end of file
+ return message
+
+
+class BardAI:
+
+ # Search for __Secure-1PSID under the bard cookies make sure to copy the api key with the . at the end
+ api_key = "BARD_AI_API_KEY"
+
+ @classmethod
+ def generate(
+ cls,
+ message_history: list[Message]
+ ):
+ assert cls.api_key is not None, "BardAI API key is not set."
+ os.environ["_BARD_API_KEY"] = cls.api_key
+
+ most_recent_message = get_contents(message_history[-1], "STRING")
+
+ response = Bard().get_answer(str(most_recent_message))
+
+ return response["content"]
\ No newline at end of file