IntelligenzaArtificiale / Free-Auto-GPT

Free Auto GPT with NO paids API is a repository that offers a simple version of Auto GPT, an autonomous AI agent capable of performing tasks independently. Unlike other versions, our implementation does not rely on any paid OpenAI API, making it accessible to anyone.
MIT License
2.43k stars 382 forks source link
ai auto-gpt autogpt autogpt-no-paid-api chatgpt chatgpt-api chatgpt-free democratize-ai free-autogpt gpt-4 gpt-4-api gpt4 open-source-auto-gpt open-source-gpt openai python reverse-engineering

USE AI AGENTs, like AUTO-GPT or BABYAGI, without paids API😤 TOTALLY FOR FREE🤑

Tired of paying for OPENAI, PINECONE, GOOGLESEARCH APIs to try out the latest developments in the AI field? Perfect, this is the repository for you! 🎁

For any problem open an ISSUE 🚬, the project is very simple so any help is welcome💸.

Are you bored reading😴? Do you want to try our project now⏳? Open the notebook on Colab everything is ready!

RUN NOW ON COLAB😮 Open in Colab ⚠️ Abusing this tool is at your own risk

intro

By the way, thank you so much for Stars and all the support!!

WHY THIS REPOSITORY ? 🤔

Hello everyone :smiling_face_with_three_hearts: ,

I wanted to start by talking about how important it is to democratize AI. Unfortunately, most new applications or discoveries in this field end up enriching some big companies, leaving behind small businesses or simple projects. One striking example of this is Autogpt, an autonomous AI agent capable of performing tasks.

Autogpt and similar projects like BabyAGI only work with paid APIs, which is not fair. That's why I tried to recreate a simpler but very interesting and, above all, open-source version of Autogpt that does not require any API and does not need any particular hardware.

I believe that by providing free and open-source AI tools, we can give small businesses and individuals the opportunity to create new and innovative projects without the need for significant financial investment. This will allow for more equitable and diverse access to AI technology, which is essential for advancing society as a whole.



## HOW TO GET Tokens & Cookies totally for FREE 🔑🔐
#### GET HUGGINGFACE TOKEN 🤗 - **HUGGINGFACE TOKEN** : Visit this simple [official guide](https://huggingface.co/docs/hub/security-tokens)
#### GET HUGGINGCHAT COOKIE🍪 - copy your email and password int .env file
#### GET CHATGPT COOKIE🍪 - **(OPTIONAL BUT BETTER RESULT) CHATGPT🖥** : 1. Go to https://chat.openai.com/chat and open the developer tools by `F12`. 2. Find the `__Secure-next-auth.session-token` cookie in `Application` > `Storage` > `Cookies` > `https://chat.openai.com`. 3. Copy the value in the `Cookie Value` field in `.env` file. 4. If you have Plus subscription you can use GPT4. Edit in `.env` file this line : `USE_GPT4 = True` ![image](https://user-images.githubusercontent.com/19218518/206170122-61fbe94f-4b0c-4782-a344-e26ac0d4e2a7.png)
#### GET GOOGLE BARD COOKIE🍪 - **(OPTIONAL) Google Bard🖥** : 1. Go toGo to https://bard.google.com/ and open the developer tools by `F12`. 2. Find the `__Secure-1PSID` cookie in `Application` > `Storage` > `Cookies` 3. Copy the value in the `Cookie Value` field in `.env` file. ![Cattura](https://user-images.githubusercontent.com/108482353/236518416-ba0fb89c-080d-4e5e-8514-4ed7ac897b55.PNG)
#### GET MICROSOFT BING COOKIE🍪 - **(OPTIONAL) Bing CHAT👨‍💻** : 1. Check if you have access to [Bing Chat](https://chrome.google.com/webstore/detail/bing-chat-for-all-browser/jofbglonpbndadajbafmmaklbfbkggpo) 2. Install the cookie editor extension for [Chrome](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-editor/) 3. Go to `bing.com` 4. Open the extension for cookie 5. Click "Export" on the bottom right, then "Export as JSON" (This saves your cookies to clipboard) 6. Paste your cookies into a file `cookiesBing.json` ![image](https://user-images.githubusercontent.com/108482353/236259872-faf7946c-5648-4733-8d66-978040eacd85.png)


## ⚠️ SETUP the .env FILE ⚠️ Open the file called `.env` . If you dont see the file, open your file manger and check for **`Show hidden file`** . Now add you Cookie and Token in `.env` file .


## Local using with Dev Container in VSCode by [@FlamingFury00](https://github.com/FlamingFury00)🚀 🚀Added the possibility to use Docker image using Dev Container in VSCode. How to run it : - Install [Docker Desktop](https://docs.docker.com/desktop/) - Install Visual Studio Code - Open Visual Studio and go to **Extensions -> search for Dev Container -> install it** - Restart Visual Studio - Go to the project folder, **right click** and **"Open in Visual Studio Code"** - It will ask you to reopen in a Docker Container - Click **"Reopen"** and wait for it to be complete **(you need to have Docker Desktop opened)**


## HOW TO RUN BABY AGI 👶 **RUN NOW ON COLAB😮** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14854fi6oO4lXqR3_mt6tc2Lr2IsA12oq?usp=sharing) ⚠️ Abusing this tool is at your own risk **Or use Locally :** - Dowload the repository [FREE AUTOGPT REPOSITORY](https://github.com/IntelligenzaArtificiale/Free-AUTOGPT-with-NO-API) - install using **Dev Container in VSCode** or `python3 -m pip install -r requirements.txt` - insert the **.env file** yours Token - if you dont see the **.env file** check "Show hidden file" in your file manger - Usage: **python BABYAGI.py** https://user-images.githubusercontent.com/108482353/234963635-004adace-36ab-46de-9022-61858cd3dca4.mp4


## HOW TO RUN AUTOGPT 🤖 **RUN NOW ON COLAB😮** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14854fi6oO4lXqR3_mt6tc2Lr2IsA12oq?usp=sharing) ⚠️ Abusing this tool is at your own risk **Or use Locally :** - Dowload the repository [FREE AUTOGPT REPOSITORY](https://github.com/IntelligenzaArtificiale/Free-AUTOGPT-with-NO-API) - install using **Dev Container in VSCode** or `python3 -m pip install -r requirements.txt` - insert the **.env file** yours Token - if you dont see the **.env file** check "Show hidden file" in your file manger - Usage: **python AUTOGPT.py** https://user-images.githubusercontent.com/108482353/234947600-1df35b1f-6505-40f9-be1d-3257a46eacf3.mp4


## HOW TO RUN Your CUSTOM AGENT 🤖 **RUN NOW ON COLAB😮** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14854fi6oO4lXqR3_mt6tc2Lr2IsA12oq?usp=sharing) ⚠️ Abusing this tool is at your own risk **Or use Locally :** - Dowload the repository [FREE AUTOGPT REPOSITORY](https://github.com/IntelligenzaArtificiale/Free-AUTOGPT-with-NO-API) - install using **Dev Container in VSCode** or `python3 -m pip install -r requirements.txt` - cd OtherAgent/ - Choose or develop your agent [ csvAgent.py ; pythonAgent.py ; customAgent.py ] - Usage: **python YourAgent.py** https://user-images.githubusercontent.com/108482353/235354639-998f0a40-3d2d-4f33-b187-17a3be8d7899.mp4


## HOW TO RUN CAMEL 🐫 **RUN NOW ON COLAB😮** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14854fi6oO4lXqR3_mt6tc2Lr2IsA12oq?usp=sharing) ⚠️ Abusing this tool is at your own risk **Or use Locally :** - Dowload the repository [FREE AUTOGPT REPOSITORY](https://github.com/IntelligenzaArtificiale/Free-AUTOGPT-with-NO-API) - `python3 -m pip install -r requirements.txt` - `streamlit run Camel.py` https://user-images.githubusercontent.com/108482353/235199747-c2dbdd27-80d6-4950-9cc6-7f140890f386.mp4


## HOW IT WORK ? 🔨🔩 To create an open-source version of Autogpt that does not require paid APIs or specific hardware, **we performed a reverse engineering process on ChatGPT**, a language model developed by OpenAI. By doing so, we were able to use the agents and new technologies of langchain for free. We then created a custom LLM wrapper with langchain, **which can be used as a plug-and-play solution with any langchain function or tool 💡**. ```python from FreeLLM import ChatGPTAPI # Instantiate a ChatGPT object with your token llm = ChatGPTAPI.ChatGPT((token="YOURTOKEN") #for start new chat # If you have a Plus subscription , you can use GPT4 model llm = ChatGPTAPI.ChatGPT((token="YOURTOKEN", model="gpt4") # REQUIRED CHATGPT PLUS subscription # or if if u would to start from an existing chat # llm = ChatGPTAPI.ChatGPT(token = "YOUR-TOKEN", conversation = "Add-XXXX-XXXX-Convesation-ID") # Generate a response based on the given prompt response = llm("Hello, how are you?") # Print the response print(response) ``` ![exixstingchat](https://user-images.githubusercontent.com/108482353/235359284-c908afe6-1f18-41ff-aa30-8216a1b9f19a.png) The code snippet provided above shows how to use our custom ChatGPT LLM class to interact with the language model. It requires a token from the ChatGPT API, which can be obtained from [https://chat.openai.com/api/auth/session](https://chat.openai.com/api/auth/session). Please note that there is a limit of 50 requests per hour for each account on the ChatGPT API 💣. Therefore, we implemented a call counter in our ChatGPT class to prevent exceeding this limit. ### Now support HuggingCHAT LLM ```python from FreeLLM import HuggingChatAPI # Instantiate a ChatGPT object with your token llm = HuggingChatAPI.HuggingChat() #for start new chat # Generate a response based on the given prompt response = llm("Hello, how are you?") # Print the response print(response) ``` ### Now support Bing CHAT LLM ```python from FreeLLM import BingChatAPI # Instantiate a Bing CHAT object with your cookie path llm=BingChatAPI.BingChat(cookiepath="cookie_path") #for start new chat # if you want set the type of conversation style #llm=BingChatAPI.BingChat(cookiepath=cookie_path, conversation_style="creative") #conversation_style must be precise, creative or balanced # if you want set Microsoft Bing internet Access #llm = =BingChatAPI.BingChat(cookiepath = "YOUR-COOKIE" , conversation_style = "precise" , search_result=True) #with web access # Generate a response based on the given prompt response = llm("Hello, how are you?") # Print the response print(response) ``` ### Now support Google BARD CHAT LLM ```python from FreeLLM import BardChatAPI # Instantiate a Bard CHAT object with your cookie path llm=BardChatAPI.BardChat(cookie="cookie") #for start new chat # Generate a response based on the given prompt response = llm("Hello, how are you?") # Print the response print(response) ``` We believe that our open-source version of Autogpt will promote equitable and diverse access to AI technology and empower individuals and small businesses to create innovative AI projects without significant financial investment. **This is an example of CUSTOM agent, in less of 60 line of code and totally for free, with:** - **Internet** access - Python **code execution** - **Wikipedia** knowledge ```python from langchain.agents import initialize_agent #use for create new agent from langchain.agents import Tool from langchain.tools import BaseTool, DuckDuckGoSearchRun from langchain.utilities import PythonREPL #tool for execute python script from langchain.utilities import WikipediaAPIWrapper #tool get wiki info from langchain.tools import DuckDuckGoSearchTool #tool get interet live info (langchain==0.0.150) from FreeLLM import ChatGPTAPI # FREE CHATGPT API #or from FreeLLM import HuggingChatAPI from FreeLLM import BingChatAPI from FreeLLM import BardChatAPI # Instantiate a ChatGPT object with your token llm = ChatGPTAPI.ChatGPT((token="YOURTOKEN") # or use Bing CHAT # llm = BingChatAPI.BingChat(cookiepath="cookie_path") # or use Google BArd CHAT # llm=BardChatAPI.BardChat(cookie="cookie") # or use HuggingChatAPI if u dont have CHATGPT, BING or Google account # llm = HuggingChatAPI.HuggingChat() # Define the tools wikipedia = WikipediaAPIWrapper() python_repl = PythonREPL() search = DuckDuckGoSearchTool() tools = [ Tool( name = "python repl", func=python_repl.run, description="useful for when you need to use python to answer a question. You should input python code" ) ] wikipedia_tool = Tool( name='wikipedia', func= wikipedia.run, description="Useful for when you need to look up a topic, country or person on wikipedia" ) duckduckgo_tool = Tool( name='DuckDuckGo Search', func= search.run, description="Useful for when you need to do a search on the internet to find information that another tool can't find. be specific with your input." ) tools.append(duckduckgo_tool) tools.append(wikipedia_tool) #Create the Agent iteration = (int(input("Enter the number of iterations: ")) if input("Do you want to set the number of iterations? (y/n): ") == "y" else 3) zero_shot_agent = initialize_agent( agent="zero-shot-react-description", tools=tools, llm=llm, verbose=True, max_iterations=iteration, ) # Start your Custom Agent in loop print(">> STRAT CUSTOM AGENT") print("> Digit 'exit' for exit or 'your task or question' for start\n\n") prompt = input("(Enter your task or question) >> ") while prompt.toLowerCase() != "exit": zero_shot_agent.run(prompt) prompt = input("(Enter your task or question) >> ") # SO ESASY :) ``` ![Schermata del 2023-04-30 16-25-11](https://user-images.githubusercontent.com/108482353/235358379-dfd7dbba-74ff-48a1-b23c-c51b63d4c181.png)


🤗 Democratize AI 🤗

Star History Chart

By the way, thank you so much for Stars and all the support!!



TODO , I NEED YOUR HELP 👥👨‍💻

We are hungry for PULL REQUEST 😋


#### Useful LINK 👥 - [VIDEO DEMO](https://watch.screencastify.com/v/vSDUBdhfvh9yEwclHUyw) - [FREE AUTOGPT REPOSITORY](https://github.com/IntelligenzaArtificiale/Free-AUTOGPT-with-NO-API) - [Camel project](https://www.camel-ai.org/) - [BABY AGI](https://python.langchain.com/en/latest/use_cases/agents/baby_agi_with_agent.html) - [AutoGPT](https://python.langchain.com/en/latest/use_cases/autonomous_agents/autogpt.html?highlight=autogpt#setup-model-and-autogpt) - [langchain for custom llm wrapper](https://python.langchain.com/en/latest/modules/models/llms/examples/custom_llm.html)

### Inspiration and Credits 🤗 - [https://github.com/hwchase17/langchain](https://github.com/hwchase17/langchain) - [https://github.com/terry3041/pyChatGPT](https://github.com/terry3041/pyChatGPT) - [https://github.com/Soulter/hugging-chat-api](https://github.com/Soulter/hugging-chat-api) - [https://github.com/Significant-Gravitas/Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT)
### Legal Notice 🧑‍⚖️ This repository is _not_ associated with or endorsed by providers of the APIs contained in this GitHub repository. This project is intended **for educational purposes only**. This is just a personal project. Please note the following: 1. **Disclaimer**: The APIs, services, and trademarks mentioned in this repository belong to their respective owners. This project is _not_ claiming any right over them nor is it affiliated with or endorsed by any of the providers mentioned. 2. **Responsibility**: The author of this repository is _not_ responsible for any consequences, damages, or losses arising from the use or misuse of this repository or the content provided by the third-party APIs. Users are solely responsible for their actions and any repercussions that may follow. We strongly recommend the users to follow the TOS of the each Website. 3. **Educational Purposes Only**: This repository and its content are provided strictly for educational purposes. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. 4. **Indemnification**: Users agree to indemnify, defend, and hold harmless the author of this repository from and against any and all claims, liabilities, damages, losses, or expenses, including legal fees and costs, arising out of or in any way connected with their use or misuse of this repository, its content, or related third-party APIs. 5. **Updates and Changes**: The author reserves the right to modify, update, or remove any content, information, or features in this repository at any time without prior notice. Users are responsible for regularly reviewing the content and any changes made to this repository. By using this repository or any code related to it, you agree to these terms. The author is not responsible for any copies, forks, or reuploads made by other users. This is the author's only account and repository. To prevent impersonation or irresponsible actions, you may comply with the MIT license this Repository uses.