-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bard AI native integration with textbase. #118
Open
Psp29onetwo
wants to merge
7
commits into
cofactoryai:main
Choose a base branch
from
Psp29onetwo:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b4729b8
Bard AI added natively.
Psp29onetwo a7fe873
api key changes
Psp29onetwo 58c77d3
changes
Psp29onetwo 66071e3
readme updated.
Psp29onetwo 2c1f17e
requirements changes
Psp29onetwo 020ec5e
requirements.txt changes and installation steps changes.
Psp29onetwo 81c79b2
read me changes
Psp29onetwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Bard AI Bot | ||
|
||
A bot using bardAi developed using a textbase framework. | ||
|
||
<br /> | ||
|
||
## 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](https://docs.textbase.ai/get-started/installation)👈🏻 or alternatively just 1pip install -r requirements.txt` but make sure you get your virtual env running before installing from the file. | ||
|
||
### 2. Give the `main.py` of this bardAi while running the project. | ||
|
||
### 3. 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. | ||
|
||
<br /> | ||
|
||
## 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. | ||
|
||
<br /> | ||
|
||
## 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
aiohttp==3.8.5 | ||
aiosignal==1.3.1 | ||
altair==5.1.1 | ||
annotated-types==0.5.0 | ||
anyio==4.0.0 | ||
async-timeout==4.0.3 | ||
attrs==23.1.0 | ||
bardapi==0.1.33 | ||
beautifulsoup4==4.12.2 | ||
blinker==1.6.2 | ||
browser-cookie3==0.19.1 | ||
cachetools==5.3.1 | ||
certifi==2023.7.22 | ||
charset-normalizer==3.2.0 | ||
click==8.1.7 | ||
cloudevents==1.9.0 | ||
colorama==0.4.6 | ||
deep-translator==1.11.4 | ||
deprecation==2.1.0 | ||
EasyProcess==1.1 | ||
entrypoint2==1.1 | ||
Flask==2.3.3 | ||
frozenlist==1.4.0 | ||
functions-framework==3.4.0 | ||
gitdb==4.0.10 | ||
GitPython==3.1.34 | ||
google-api-core==2.11.1 | ||
google-auth==2.22.0 | ||
google-cloud-core==2.3.3 | ||
google-cloud-translate==3.12.0 | ||
googleapis-common-protos==1.60.0 | ||
grpcio==1.57.0 | ||
grpcio-status==1.57.0 | ||
h11==0.14.0 | ||
h2==4.1.0 | ||
hpack==4.0.0 | ||
httpcore==0.17.3 | ||
httpx==0.24.1 | ||
hyperframe==6.0.1 | ||
idna==3.4 | ||
importlib-metadata==6.8.0 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.2 | ||
jsonschema==4.19.0 | ||
jsonschema-specifications==2023.7.1 | ||
langdetect==1.0.9 | ||
lz4==4.3.2 | ||
markdown-it-py==3.0.0 | ||
MarkupSafe==2.1.3 | ||
mdurl==0.1.2 | ||
MouseInfo==0.1.3 | ||
mss==9.0.1 | ||
multidict==6.0.4 | ||
numpy==1.25.2 | ||
openai==0.27.10 | ||
packaging==23.1 | ||
pandas==2.1.0 | ||
Pillow==9.5.0 | ||
proto-plus==1.22.3 | ||
protobuf==4.24.2 | ||
pyarrow==13.0.0 | ||
pyasn1==0.5.0 | ||
pyasn1-modules==0.3.0 | ||
PyAutoGUI==0.9.54 | ||
pycryptodomex==3.18.0 | ||
pydantic==2.3.0 | ||
pydantic_core==2.6.3 | ||
pydeck==0.8.0 | ||
PyGetWindow==0.0.9 | ||
Pygments==2.16.1 | ||
Pympler==1.0.1 | ||
PyMsgBox==1.0.9 | ||
pyperclip==1.8.2 | ||
PyRect==0.2.0 | ||
pyscreenshot==3.1 | ||
PyScreeze==0.1.29 | ||
python-dateutil==2.8.2 | ||
python-dotenv==1.0.0 | ||
pytweening==1.0.7 | ||
pytz==2023.3 | ||
pytz-deprecation-shim==0.1.0.post0 | ||
referencing==0.30.2 | ||
requests==2.31.0 | ||
rich==13.5.2 | ||
rpds-py==0.10.0 | ||
rsa==4.9 | ||
six==1.16.0 | ||
smmap==5.0.0 | ||
sniffio==1.3.0 | ||
soupsieve==2.5 | ||
tabulate==0.9.0 | ||
tenacity==8.2.3 | ||
termcolor==2.3.0 | ||
toml==0.10.2 | ||
toolz==0.12.0 | ||
tornado==6.3.3 | ||
tqdm==4.66.1 | ||
typing_extensions==4.7.1 | ||
tzdata==2023.3 | ||
tzlocal==4.3.1 | ||
urllib3==1.26.16 | ||
validators==0.22.0 | ||
watchdog==3.0.0 | ||
Werkzeug==2.3.7 | ||
wikipedia==1.4.0 | ||
yarl==1.9.2 | ||
yaspin==3.0.0 | ||
zipp==3.16.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all these packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just auto generated the requirements.txt should i only keep the required ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok letme correct this