Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xtekky authored May 2, 2023
2 parents 611a565 + 7aab310 commit 33fa009
Show file tree
Hide file tree
Showing 22 changed files with 166 additions and 117 deletions.
10 changes: 0 additions & 10 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# These are supported funding model platforms

github: [onlp]
patreon: xtekky
open_collective: # Replace with a single Open Collective username
ko_fi: xtekky
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: tekky
issuehunt: xtekky
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
60 changes: 33 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<img alt="gpt4free logo" src="https://user-images.githubusercontent.com/98614666/233799515-1a7cb6a3-b17f-42c4-956d-8d2a0664466f.png">

## Legal Notice <a name="legal-notice"></a>

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 little personal project. Sites may contact me to improve their security or request the removal of their site from this repository.

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.

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. **Copyright**: All content in this repository, including but not limited to code, images, and documentation, is the intellectual property of the repository author, unless otherwise stated. Unauthorized copying, distribution, or use of any content in this repository is strictly prohibited without the express written consent of the repository author.

5. **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.

6. **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 GNU GPL license this Repository uses.

<br>

<img src="https://media.giphy.com/media/LnQjpWaON8nhr21vNW/giphy.gif" width="100" align="left">
Just API's from some language model sites.
<p>Join our <a href="https://discord.com/invite/gpt4free">discord.gg/gpt4free<a> Discord community! <a href="https://discord.gg/gpt4free"><img align="center" alt="gpt4free Discord" width="22px" src="https://raw.githubusercontent.com/peterthehan/peterthehan/master/assets/discord.svg" /></a></p>
Expand Down Expand Up @@ -32,11 +55,11 @@ Just API's from some language model sites.
<td><a href="https://github.com/xtekky/chatgpt-clone/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41"/></a></td>
</tr>
<tr>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free"><b>ChatGpt Discord Bot</b></a></td>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Coding-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Coding-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/issues"><img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Coding-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Coding-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free"><b>ChatGpt Discord Bot</b></a></td>
<td><a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Discord-Chatbot-Gpt4Free/issues"><img alt="Issues" src="https://img.shields.io/github/issues/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
<td><a href="https://github.com/mishalhossin/Coding-Chatbot-Gpt4Free/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/mishalhossin/Discord-Chatbot-Gpt4Free?style=flat-square&labelColor=343b41"/></a></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -86,7 +109,6 @@ Just API's from some language model sites.
| [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 |
| [bard.google.com](https://bard.google.com) | custom / search |
| [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 |
| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 |
| [italygpt.it](https://italygpt.it) | GPT-3.5 |

## Best sites <a name="best-sites"></a>
Expand Down Expand Up @@ -120,45 +142,29 @@ then run:
Build

```
docker build -t gpt4free:latest -f Docker/Dockerfile .
docker build -t gpt4free:latest .
```

Run

```
docker run -p 8501:8501 gpt4free:latest
```
Another way - docker-compose (no docker build/run needed)
```
docker-compose up -d
```

## Deploy using docker-compose

Run the following:

```
docker-compose up -d
docker-compose up --build -d
```

## ChatGPT clone

> currently implementing new features and trying to scale it, please be patient it may be unstable
> https://chat.chatbot.sex/chat
> Currently implementing new features and trying to scale it, please be patient it may be unstable
> https://chat.g4f.ai/chat
> This site was developed by me and includes **gpt-4/3.5**, **internet access** and **gpt-jailbreak's** like DAN
> run locally here: https://github.com/xtekky/chatgpt-clone
## Legal Notice <a name="legal-notice"></a>

This repository uses third-party APIs and is _not_ associated with or endorsed by the API providers. This project is intended **for educational purposes only**. This is just a little personal project. Sites may contact me to improve their security.

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.

2. **Responsibility**: The author of this repository is _not_ responsible for any consequences arising from the use or misuse of this repository or the content provided by the third-party APIs and any damage or losses caused by users' actions.

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.
> Run locally here: https://github.com/xtekky/chatgpt-clone
## Copyright:

Expand Down
12 changes: 9 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ version: "3.9"

services:
gpt4free:
build:
context: .
build:
context: ./
dockerfile: Dockerfile
container_name: dc_gpt4free
# environment:
# - http_proxy=http://127.0.0.1:1080 # modify this for your proxy
# - https_proxy=http://127.0.0.1:1080 # modify this for your proxy
image: img_gpt4free
ports:
- "8501:8501"
- 8501:8501
restart: always
12 changes: 0 additions & 12 deletions docker-compose.yml

This file was deleted.

7 changes: 3 additions & 4 deletions gpt4free/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from gpt4free import forefront
from gpt4free import quora
from gpt4free import theb
from gpt4free import you
from gpt4free import usesless
from gpt4free import you


class Provider(Enum):
Expand All @@ -24,7 +24,6 @@ class Completion:

@staticmethod
def create(provider: Provider, prompt: str, **kwargs) -> str:

"""
Invokes the given provider with given prompt and addition arguments and returns the string response
Expand All @@ -47,10 +46,10 @@ def create(provider: Provider, prompt: str, **kwargs) -> str:
return Completion.__useless_service(prompt, **kwargs)
else:
raise Exception('Provider not exist, Please try again')

@staticmethod
def __useless_service(prompt: str, **kwargs) -> str:
return usesless.Completion.create(prompt = prompt, **kwargs)
return usesless.Completion.create(prompt=prompt, **kwargs)

@staticmethod
def __you_service(prompt: str, **kwargs) -> str:
Expand Down
9 changes: 6 additions & 3 deletions gpt4free/forefront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ from gpt4free import forefront
token = forefront.Account.create(logging=False)
print(token)
# get a response
for response in forefront.StreamingCompletion.create(token=token,
prompt='hello world', model='gpt-4'):
print(response.completion.choices[0].text, end='')
for response in forefront.StreamingCompletion.create(
token=token,
prompt='hello world',
model='gpt-4'
):
print(response.choices[0].text, end='')
print("")
```
16 changes: 6 additions & 10 deletions gpt4free/forefront/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from uuid import uuid4

from fake_useragent import UserAgent
from requests import post
from pymailtm import MailTm, Message
from requests import post
from tls_client import Session

from .typing import ForeFrontResponse
Expand Down Expand Up @@ -43,10 +43,7 @@ def create(proxy: Optional[str] = None, logging: bool = False):

response = client.post(
f'https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/prepare_verification?_clerk_js_version=4.38.4',
data={
'strategy': 'email_link',
'redirect_url': 'https://accounts.forefront.ai/sign-up/verify'
},
data={'strategy': 'email_link', 'redirect_url': 'https://accounts.forefront.ai/sign-up/verify'},
)

if logging:
Expand Down Expand Up @@ -93,14 +90,14 @@ def create(
action_type='new',
default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
model='gpt-4',
proxy=None
proxy=None,
) -> Generator[ForeFrontResponse, None, None]:
if not token:
raise Exception('Token is required!')
if not chat_id:
chat_id = str(uuid4())

proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else None
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else None

headers = {
'authority': 'chat-server.tenant-forefront-default.knative.chi.coreweave.com',
Expand Down Expand Up @@ -168,7 +165,7 @@ def create(
action_type='new',
default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default
model='gpt-4',
proxy=None
proxy=None,
) -> ForeFrontResponse:
text = ''
final_response = None
Expand All @@ -179,7 +176,7 @@ def create(
action_type=action_type,
default_persona=default_persona,
model=model,
proxy=proxy
proxy=proxy,
):
if response:
final_response = response
Expand All @@ -191,4 +188,3 @@ def create(
raise Exception('Unable to get the response, Please try again')

return final_response

3 changes: 2 additions & 1 deletion gpt4free/forefront/typing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, List

from pydantic import BaseModel


Expand All @@ -22,4 +23,4 @@ class ForeFrontResponse(BaseModel):
model: str
choices: List[Choice]
usage: Usage
text: str
text: str
9 changes: 9 additions & 0 deletions gpt4free/quora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ poe.chat('who won the football world cup most?')
# new bot creation
poe.create_bot('new_bot_name', prompt='You are new test bot', base_model='gpt-3.5-turbo')

# delete account
poe.delete_account()
```

### Deleting the Poe Account
```python
from gpt4free import quora

quora.Account.delete(token='')
```
23 changes: 12 additions & 11 deletions gpt4free/quora/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ def get(self):
cookies = open(Path(__file__).resolve().parent / 'cookies.txt', 'r').read().splitlines()
return choice(cookies)

@staticmethod
def delete(token: str, proxy: Optional[str] = None):
client = PoeClient(token, proxy=proxy)
client.delete_account()


class StreamingCompletion:
@staticmethod
Expand All @@ -293,11 +298,11 @@ def create(
custom_model: bool = None,
prompt: str = 'hello world',
token: str = '',
proxy: Optional[str] = None
proxy: Optional[str] = None,
) -> Generator[PoeResponse, None, None]:
_model = MODELS[model] if not custom_model else custom_model

proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else False
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
client = PoeClient(token)
client.proxy = proxies

Expand Down Expand Up @@ -333,7 +338,7 @@ def create(
custom_model: str = None,
prompt: str = 'hello world',
token: str = '',
proxy: Optional[str] = None
proxy: Optional[str] = None,
) -> PoeResponse:
_model = MODELS[model] if not custom_model else custom_model

Expand Down Expand Up @@ -454,14 +459,7 @@ def chat(self, message: str, model: Optional[str] = None) -> str:
response = chunk['text']
return response

def create_bot(
self,
name: str,
/,
prompt: str = '',
base_model: str = 'ChatGPT',
description: str = '',
) -> None:
def create_bot(self, name: str, /, prompt: str = '', base_model: str = 'ChatGPT', description: str = '') -> None:
if base_model not in MODELS:
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')

Expand All @@ -475,3 +473,6 @@ def create_bot(

def list_bots(self) -> list:
return list(self.client.bot_names.values())

def delete_account(self) -> None:
self.client.delete_account()
6 changes: 6 additions & 0 deletions gpt4free/quora/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,5 +541,11 @@ def edit_bot(
self.get_bots()
return data

def delete_account(self) -> None:
response = self.send_query('SettingsDeleteAccountButton_deleteAccountMutation_Mutation', {})
data = response['data']['deleteAccount']
if 'viewer' not in data:
raise RuntimeError(f'Error occurred while deleting the account, Please try again!')


load_queries()
Loading

0 comments on commit 33fa009

Please sign in to comment.