diff options
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | gpt4free/italygpt/README.md | 18 | ||||
-rw-r--r-- | gpt4free/italygpt/__init__.py | 28 | ||||
-rw-r--r-- | gpt4free/quora/__init__.py | 4 | ||||
-rw-r--r-- | gpt4free/theb/__init__.py | 2 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | unfinished/test.py | 8 | ||||
-rw-r--r-- | unfinished/vercelai/__init__.py | 41 | ||||
-rw-r--r-- | unfinished/vercelai/test.js | 33 | ||||
-rw-r--r-- | unfinished/vercelai/test.py | 67 | ||||
-rw-r--r-- | unfinished/vercelai/token.py | 0 | ||||
-rw-r--r-- | unfinished/vercelai/vercelai_test.py | 5 |
12 files changed, 11 insertions, 204 deletions
@@ -52,6 +52,13 @@ Just API's from some language model sites. <td><a href="https://github.com/xtekky/gpt4free/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xtekky/gpt4free?style=flat-square&labelColor=343b41"/></a></td> </tr> <tr> + <td><a href="https://github.com/xiangsx/gpt4free-ts"><b>gpt4free-ts</b></a></td> + <td><a href="https://github.com/xiangsx/gpt4free-ts/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41"/></a></td> + <td><a href="https://github.com/xiangsx/gpt4free-ts/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41"/></a></td> + <td><a href="https://github.com/xiangsx/gpt4free-ts/issues"><img alt="Issues" src="https://img.shields.io/github/issues/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41"/></a></td> + <td><a href="https://github.com/xiangsx/gpt4free-ts/pulls"><img alt="Pull Requests" src="https://img.shields.io/github/issues-pr/xiangsx/gpt4free-ts?style=flat-square&labelColor=343b41"/></a></td> + </tr> + <tr> <td><a href="https://github.com/xtekky/chatgpt-clone"><b>ChatGPT-Clone</b></a></td> <td><a href="https://github.com/xtekky/chatgpt-clone/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41"/></a></td> <td><a href="https://github.com/xtekky/chatgpt-clone/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/xtekky/chatgpt-clone?style=flat-square&labelColor=343b41"/></a></td> diff --git a/gpt4free/italygpt/README.md b/gpt4free/italygpt/README.md deleted file mode 100644 index 984eff3a..00000000 --- a/gpt4free/italygpt/README.md +++ /dev/null @@ -1,18 +0,0 @@ -### Example: `italygpt`
-
-```python
-# create an instance
-from gpt4free import italygpt
-italygpt = italygpt.Completion()
-
-# initialize api
-italygpt.init()
-
-# get an answer
-italygpt.create(prompt="What is the meaning of life?")
-print(italygpt.answer) # html formatted
-
-# keep the old conversation
-italygpt.create(prompt="Are you a human?", messages=italygpt.messages)
-print(italygpt.answer)
-```
\ No newline at end of file diff --git a/gpt4free/italygpt/__init__.py b/gpt4free/italygpt/__init__.py deleted file mode 100644 index 27a965f1..00000000 --- a/gpt4free/italygpt/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -import requests, time, ast, json
-from bs4 import BeautifulSoup
-from hashlib import sha256
-
-class Completion:
- # answer is returned with html formatting
- next_id = None
- messages = []
- answer = None
-
- def init(self):
- r = requests.get("https://italygpt.it")
- soup = BeautifulSoup(r.text, "html.parser")
- self.next_id = soup.find("input", {"name": "next_id"})["value"]
-
- def create(self, prompt: str, messages: list = []):
- try:
- r = requests.get("https://italygpt.it/question", params={"hash": sha256(self.next_id.encode()).hexdigest(), "prompt": prompt, "raw_messages": json.dumps(messages)}).json()
- except:
- r = requests.get("https://italygpt.it/question", params={"hash": sha256(self.next_id.encode()).hexdigest(), "prompt": prompt, "raw_messages": json.dumps(messages)}).text
- if "too many requests" in r.lower():
- # rate limit is 17 requests per 1 minute
- time.sleep(20)
- return self.create(prompt, messages)
- self.next_id = r["next_id"]
- self.messages = ast.literal_eval(r["raw_messages"])
- self.answer = r["response"]
- return self
\ No newline at end of file diff --git a/gpt4free/quora/__init__.py b/gpt4free/quora/__init__.py index bc17ea5d..5d9e80c1 100644 --- a/gpt4free/quora/__init__.py +++ b/gpt4free/quora/__init__.py @@ -104,8 +104,8 @@ class Model: def create( token: str, model: str = 'gpt-3.5-turbo', # claude-instant - system_prompt: str = 'You are ChatGPT a large language model developed by Openai. Answer as consisely as possible', - description: str = 'gpt-3.5 language model from openai, skidded by poe.com', + system_prompt: str = 'You are ChatGPT a large language model. Answer as consisely as possible', + description: str = 'gpt-3.5 language model', handle: str = None, ) -> ModelResponse: if not handle: diff --git a/gpt4free/theb/__init__.py b/gpt4free/theb/__init__.py index b162811e..852fe17b 100644 --- a/gpt4free/theb/__init__.py +++ b/gpt4free/theb/__init__.py @@ -65,4 +65,4 @@ class Completion: @staticmethod def handle_stream_response(response): - Completion.message_queue.put(response.decode()) + Completion.message_queue.put(response.decode(errors='replace')) diff --git a/pyproject.toml b/pyproject.toml index 83df5dc5..37ec92d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "openai-rev" +name = "gpt4free" version = "0.1.0" description = "" authors = [] diff --git a/unfinished/test.py b/unfinished/test.py deleted file mode 100644 index a5f038c5..00000000 --- a/unfinished/test.py +++ /dev/null @@ -1,8 +0,0 @@ -# asyncio.run(gptbz.test()) - -import requests - -image = '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAoALQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBka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xeG9RS7ltVQ25ytwzbCCQBkJ82MkD5eeah0G7tYLi/sZJrKO4fUbjy4oncM/SQ5D9Ww4J25Xniiis2/eO2FNOhf1/CxmamsEGp2+nzx2CwxajYyWKN9o3KdpX+Ebd2I2287ePm973i3UdMg0W+0y4mtUkNqJPKuBJ5ewuEBYx8gbiBxz+FFFS3ZM1p01OdNN/wBaFfVtU0qHxHplx9qsSkEl2853SvIjxwjdtCZXIX7wbt05q7YJdS6nc6vYxWEtpfi2KS+bKsjQhCSWBBG4bhtAAyCcmiinF3k0RWgqdKMl1VvxZfM2s+VkWFh5nl5x9tfG/djGfK6bec468Y/irN1CeUCeHXbrTItPc3O6GN5PNltxHx0I+YKXLYB42455ooqpaIwo2lO1rE1rZjUYrcCO2Giw/Zp7BYzKrkKu4bh8oAB2EA56HIz0u3uxL+1kbygQpQFt2fmki4GOOuOvfHbNFFPpcTu6nKFpsTU75V8oNJKXIXduOI4hk54zjHTjGO+a0KKKaM59PQxLqNNBMuoQpDFYJEfPQLISp8zcWAXIxh5CcLnOMnHQaFNKkkvtOFoli0k9xqP32Zn24LIFyM7kwRg98c5yUVL3No6xTfV2/IrxyW0vh21kQ2phaexKn97s5aErj+LPTbnj7u7+KujoopxZNZW+9/oQXdpBfWk1rcxiSGVGjdSSMhgQeRyOCRxWOtvbXU0Ol6mIHksJbea0IMoJYISGy3U5ST+JuB83uUUMVJuz121JnaL/AITOBSYPOGnyEA7/ADdvmJnH8G3IHX5s4xxmtmiihdRVFZR9AoooqjI//9k=' - -response = requests.get('https://ocr.holey.cc/ncku?base64_str=%s' % image) # .split('base64,')[1]) -print(response.content) diff --git a/unfinished/vercelai/__init__.py b/unfinished/vercelai/__init__.py deleted file mode 100644 index 1dcb5b39..00000000 --- a/unfinished/vercelai/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -import requests - -class Completion: - def create(prompt: str, - model: str = 'openai:gpt-3.5-turbo', - temperature: float = 0.7, - max_tokens: int = 200, - top_p: float = 1, - top_k: int = 1, - frequency_penalty: float = 1, - presence_penalty: float = 1, - stopSequences: list = []): - - token = requests.get('https://play.vercel.ai/openai.jpeg', headers={ - 'authority': 'play.vercel.ai', - 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3', - 'referer': 'https://play.vercel.ai/', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}).text.replace('=','') - - print(token) - - headers = { - 'authority': 'play.vercel.ai', - 'custom-encoding': token, - 'origin': 'https://play.vercel.ai', - 'referer': 'https://play.vercel.ai/', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' - } - - for chunk in requests.post('https://play.vercel.ai/api/generate', headers=headers, stream=True, json={ - 'prompt': prompt, - 'model': model, - 'temperature': temperature, - 'maxTokens': max_tokens, - 'topK': top_p, - 'topP': top_k, - 'frequencyPenalty': frequency_penalty, - 'presencePenalty': presence_penalty, - 'stopSequences': stopSequences}).iter_lines(): - - yield (chunk)
\ No newline at end of file diff --git a/unfinished/vercelai/test.js b/unfinished/vercelai/test.js deleted file mode 100644 index 0f822cfd..00000000 --- a/unfinished/vercelai/test.js +++ /dev/null @@ -1,33 +0,0 @@ -(async () => { - - let response = await fetch("https://play.vercel.ai/openai.jpeg", { - "headers": { - "accept": "*/*", - "accept-language": "en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3", - "sec-ch-ua": "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\"", - "sec-ch-ua-mobile": "?0", - "sec-ch-ua-platform": "\"macOS\"", - "sec-fetch-dest": "empty", - "sec-fetch-mode": "cors", - "sec-fetch-site": "same-origin" - }, - "referrer": "https://play.vercel.ai/", - "referrerPolicy": "strict-origin-when-cross-origin", - "body": null, - "method": "GET", - "mode": "cors", - "credentials": "omit" - }); - - - let data = JSON.parse(atob(await response.text())) - let ret = eval("(".concat(data.c, ")(data.a)")); - - botPreventionToken = btoa(JSON.stringify({ - r: ret, - t: data.t - })) - - console.log(botPreventionToken); - -})()
\ No newline at end of file diff --git a/unfinished/vercelai/test.py b/unfinished/vercelai/test.py deleted file mode 100644 index 318e71c3..00000000 --- a/unfinished/vercelai/test.py +++ /dev/null @@ -1,67 +0,0 @@ -import requests -from base64 import b64decode, b64encode -from json import loads -from json import dumps - -headers = { - 'Accept': '*/*', - 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', - 'Connection': 'keep-alive', - 'Referer': 'https://play.vercel.ai/', - 'Sec-Fetch-Dest': 'empty', - 'Sec-Fetch-Mode': 'cors', - 'Sec-Fetch-Site': 'same-origin', - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36', - 'sec-ch-ua': '"Chromium";v="110", "Google Chrome";v="110", "Not:A-Brand";v="99"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', -} - -response = requests.get('https://play.vercel.ai/openai.jpeg', headers=headers) - -token_data = loads(b64decode(response.text)) -print(token_data) - -raw_token = { - 'a': token_data['a'] * .1 * .2, - 't': token_data['t'] -} - -print(raw_token) - -new_token = b64encode(dumps(raw_token, separators=(',', ':')).encode()).decode() -print(new_token) - -import requests - -headers = { - 'authority': 'play.vercel.ai', - 'accept': '*/*', - 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3', - 'content-type': 'application/json', - 'custom-encoding': new_token, - 'origin': 'https://play.vercel.ai', - 'referer': 'https://play.vercel.ai/', - 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', - 'sec-fetch-dest': 'empty', - 'sec-fetch-mode': 'cors', - 'sec-fetch-site': 'same-origin', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36', -} - -json_data = { - 'prompt': 'hello\n', - 'model': 'openai:gpt-3.5-turbo', - 'temperature': 0.7, - 'maxTokens': 200, - 'topK': 1, - 'topP': 1, - 'frequencyPenalty': 1, - 'presencePenalty': 1, - 'stopSequences': [], -} - -response = requests.post('https://play.vercel.ai/api/generate', headers=headers, json=json_data) -print(response.text)
\ No newline at end of file diff --git a/unfinished/vercelai/token.py b/unfinished/vercelai/token.py deleted file mode 100644 index e69de29b..00000000 --- a/unfinished/vercelai/token.py +++ /dev/null diff --git a/unfinished/vercelai/vercelai_test.py b/unfinished/vercelai/vercelai_test.py deleted file mode 100644 index 24cbe0bc..00000000 --- a/unfinished/vercelai/vercelai_test.py +++ /dev/null @@ -1,5 +0,0 @@ -import vercelai - -for token in vercelai.Completion.create('summarize the gnu gpl 1.0'): - print(token, end='', flush=True) - |