返回提交历史
Modified
README.md
+1
-4
Deleted
ora/README.md
+0
-49
Deleted
ora/__init__.py
+0
-62
Deleted
ora/_jwt.py
+0
-75
Deleted
ora/model.py
+0
-57
Deleted
ora/typing.py
+0
-39
Deleted
ora_test.py
+0
-15
Deleted
testing/ora_gpt4.py
+0
-45
Deleted
testing/ora_gpt4_proof.py
+0
-24
Renamed
unfinished/t3nsor/README.md
+0
-0
Renamed
unfinished/t3nsor/__init__.py
+0
-0
Renamed
unfinished/writesonic/README.md
+0
-0
Renamed
unfinished/writesonic/__init__.py
+0
-0
Added
v2.py
+0
-0
Renamed
you_test.py
+1
-1
XFEstudio/gpt4free
discontinue ora.sh api
e341c75e
代码差异
15 个文件
+2
-371
@@ -23,7 +23,6 @@ By the way, thank you so much for `2k` stars and all the support!!
23
23
- [`quora (poe)`](./quora/README.md)
24
24
- [`phind`](./phind/README.md)
25
25
- [`t3nsor`](./t3nsor/README.md)
26
- [`ora`](./ora/README.md)
27
26
- [`writesonic`](./writesonic/README.md)
28
27
- [`you`](./you/README.md)
29
28
- [`sqlchat`](./sqlchat/README.md)
@@ -44,7 +43,6 @@ By the way, thank you so much for `2k` stars and all the support!!
44
43
45
44
| Website | Model(s) |
46
45
| ---------------------------------------------------- | ------------------------------- |
47
| [ora.sh](https://ora.sh) | GPT-3.5 / 4 |
48
46
| [poe.com](https://poe.com) | GPT-4/3.5 |
49
47
| [writesonic.com](https://writesonic.com) | GPT-3.5 / Internet |
50
48
| [t3nsor.com](https://t3nsor.com) | GPT-3.5 |
@@ -64,8 +62,7 @@ By the way, thank you so much for `2k` stars and all the support!!
64
62
- why not `ora` anymore ? gpt-4 requires login + limited
65
63
66
64
#### gpt-3.5
67
- [`/ora`](./ora/README.md)
68
- only stable api at the moment ( for gpt-3.5, gpt-4 is dead)
65
- looking for a stable api at the moment
69
66
70
67
## Install <a name="install"></a>
71
68
download or clone this GitHub repo
@@ -1,49 +0,0 @@
1
### Example: `ora` (use like openai pypi package) <a name="example-ora"></a>
2
3
### load model (new)
4
5
more gpt4 models in `/testing/ora_gpt4.py`
6
7
find the userid by visiting https://ora.sh/api/auth/session ( must be logged in on the site )
8
and session_token in the cookies, it should be: __Secure-next-auth.session-token
9
10
```python
11
# if using CompletionModel.load set these
12
ora.user_id = '...'
13
ora.session_token = '...'
14
15
# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
16
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
17
```
18
19
#### create model / chatbot:
20
```python
21
# import ora
22
import ora
23
24
25
# create model
26
model = ora.CompletionModel.create(
27
system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
28
description = 'ChatGPT Openai Language Model',
29
name = 'gpt-3.5')
30
31
# init conversation (will give you a conversationId)
32
init = ora.Completion.create(
33
model = model,
34
prompt = 'hello world')
35
36
print(init.completion.choices[0].text)
37
38
while True:
39
# pass in conversationId to continue conversation
40
41
prompt = input('>>> ')
42
response = ora.Completion.create(
43
model = model,
44
prompt = prompt,
45
includeHistory = True, # remember history
46
conversationId = init.id)
47
48
print(response.completion.choices[0].text)
49
```
@@ -1,62 +0,0 @@
1
from ora.model import CompletionModel
2
from ora.typing import OraResponse
3
from requests import post
4
from time import time
5
from random import randint
6
from ora._jwt import do_jwt
7
8
user_id = None
9
session_token = None
10
11
class Completion:
12
def create(
13
model : CompletionModel,
14
prompt: str,
15
includeHistory: bool = True,
16
conversationId: str or None = None) -> OraResponse:
17
extra = {
18
'conversationId': conversationId} if conversationId else {}
19
20
cookies = {
21
"cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {}
22
23
json_data = extra | {
24
'chatbotId': model.id,
25
'input' : prompt,
26
'userId' : user_id if user_id else model.createdBy,
27
'model' : model.modelName,
28
'provider' : 'OPEN_AI',
29
'includeHistory': includeHistory}
30
31
32
response = post('https://ora.sh/api/conversation',
33
headers = cookies | {
34
"host" : "ora.sh",
35
"authorization" : f"Bearer AY0{randint(1111, 9999)}",
36
"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",
37
"origin" : "https://ora.sh",
38
"referer" : "https://ora.sh/chat/",
39
"x-signed-token": do_jwt(json_data)
40
},
41
json = json_data).json()
42
43
if response.get('error'):
44
raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error'])
45
46
return OraResponse({
47
'id' : response['conversationId'],
48
'object' : 'text_completion',
49
'created': int(time()),
50
'model' : model.slug,
51
'choices': [{
52
'text' : response['response'],
53
'index' : 0,
54
'logprobs' : None,
55
'finish_reason' : 'stop'
56
}],
57
'usage': {
58
'prompt_tokens' : len(prompt),
59
'completion_tokens' : len(response['response']),
60
'total_tokens' : len(prompt) + len(response['response'])
61
}
62
})
@@ -1,75 +0,0 @@
1
import jwt
2
from datetime import datetime, timedelta
3
# from cryptography.hazmat.primitives import serialization
4
# from cryptography.hazmat.primitives.serialization import load_pem_private_key
5
# from cryptography.hazmat.backends import default_backend
6
7
8
def do_jwt(json_data: dict):
9
10
private_key = b'''-----BEGIN RSA PRIVATE KEY-----
11
MIIJKAIBAAKCAgEAxv9TLZP2TnsR512LqzT52N6Z9ixKmUA11jy0IXH0dEbdbfBw
12
eeWrXoTuIYcY8Dkg/+q33ppfujYfb0z22bs/CZ63+jBL2UmxG/0XIzmsQlHSgJd/
13
rnbERwIt7/ZjOHAcNrAzI0N11AI8AT0+M3XFOGRoIKzoc3Juxl7eyyPPEkNZMkEv
14
lYfDN5AMD/+4pZ+7SCEzUCyGtBejW2P+NwTvjBxhLjIoG+m7yh81RoIBnO+Z1o5X
15
ZtospuWZe1L6GNh+zezeHIyBGYgGgYbPboQ8QeHhoh+n0PuZB0GQqorqfxHjB38t
16
yB4qsRGi10UNcohvFhglZk8kdMYBTd0M5ik5t4sx/ujjF57gX7dCKipHimDy7McY
17
ElVLTDoSkwD/Lg3tV0utky42dL/iIMePlHfMrw/m2oAm33/dCaiAW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wGB6wy120iMVa30eg2QPohS7AC3N0bYuCEnpmFKc1RC26E6cI9TEfyFEl/T5RDU8
51
6JVTlmD7dWTZ2ILlGmWtyCJKOIK3ZJu7/vjU4QsRJkxwiexbiDKAe5vcfAFhXwgO
52
xKe3Mc/ao1dJEWN/FRDAmeg6nEOuG+G/voC3d4YO5HPTf6/Uj5GS6CQfYtUR12A3
53
8fZ90f4Jer6+9ePEXWTftiqoDL9T8qPzLU+kMuRF8VzZcS472Ix3h1iWCoZjBJv/
54
zQZHbgEcTtXHbfrvxkjSRopDTprljCi5AoIBAGc6M8/FH1pLgxOgS6oEGJAtErxv
55
EnmELzKvfwBryphx8f0S5sHoiqli+5dqFtw5h5yy/pXrNzLi0LfpmFzxbChfO8ai
56
omC/oqxU0FKqY2msFYdnfwM3PZeZ3c7LALLhWG56/fIYMtV78+cfqkRPM8nRJXaF
57
Aza2YTTZGfh3x10KnSLWUmhIWUEj8VzCNW7SR0Ecqa+ordAYio4wBsq7sO3sCw8G
58
Oi0/98ondhGJWL3M6FDGai8dXewt+8o0dlq95mHkNNopCWbPI71pM7u4ABPL50Yd
59
spd4eADxTm2m0GR7bhVEIbYfc0aAzIoWDpVs4V3vmx+bdRbppFxV1aS/r0g=
60
61
header = {
62
'alg': 'RS256',
63
'typ': 'JWT',
64
'kid': '1c8a5da7-527e-4bee-aa8d-aabda16c59ce'
65
}
66
67
payload = {
68
**json_data,
69
'iat': int(datetime.now().timestamp()),
70
'exp': int((datetime.now() + timedelta(minutes=10)).timestamp()),
71
'iss': 'https://rick.roll'
72
}
73
74
return jwt.encode(payload, private_key, algorithm='RS256', headers=header)
@@ -1,57 +0,0 @@
1
from uuid import uuid4
2
from requests import post
3
4
class CompletionModel:
5
system_prompt = None
6
description = None
7
createdBy = None
8
createdAt = None
9
slug = None
10
id = None
11
modelName = None
12
model = 'gpt-3.5-turbo'
13
14
def create(
15
system_prompt: str = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
16
description : str = 'ChatGPT Openai Language Model',
17
name : str = 'gpt-3.5'):
18
19
CompletionModel.system_prompt = system_prompt
20
CompletionModel.description = description
21
CompletionModel.slug = name
22
23
json_data = {
24
'prompt' : system_prompt,
25
'userId' : f'auto:{uuid4()}',
26
'name' : name,
27
'description': description}
28
29
headers = {
30
'Origin' : 'https://ora.sh',
31
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15',
32
'Referer' : 'https://ora.sh/',
33
'Host' : 'ora.sh',
34
}
35
36
response = post('https://ora.sh/api/assistant', headers = headers, json = json_data)
37
38
print(response.json())
39
40
CompletionModel.id = response.json()['id']
41
CompletionModel.createdBy = response.json()['createdBy']
42
CompletionModel.createdAt = response.json()['createdAt']
43
44
return CompletionModel
45
46
def load(chatbotId: str, modelName: str = 'gpt-3.5-turbo', userId: str = None):
47
if userId is None: userId = f'{uuid4()}'
48
49
CompletionModel.system_prompt = None
50
CompletionModel.description = None
51
CompletionModel.slug = None
52
CompletionModel.id = chatbotId
53
CompletionModel.createdBy = userId
54
CompletionModel.createdAt = None
55
CompletionModel.modelName = modelName
56
57
return CompletionModel
@@ -1,39 +0,0 @@
1
class OraResponse:
2
3
class Completion:
4
5
class Choices:
6
def __init__(self, choice: dict) -> None:
7
self.text = choice['text']
8
self.content = self.text.encode()
9
self.index = choice['index']
10
self.logprobs = choice['logprobs']
11
self.finish_reason = choice['finish_reason']
12
13
def __repr__(self) -> str:
14
return f'''<__main__.APIResponse.Completion.Choices(\n text = {self.text.encode()},\n index = {self.index},\n logprobs = {self.logprobs},\n finish_reason = {self.finish_reason})object at 0x1337>'''
15
16
def __init__(self, choices: dict) -> None:
17
self.choices = [self.Choices(choice) for choice in choices]
18
19
class Usage:
20
def __init__(self, usage_dict: dict) -> None:
21
self.prompt_tokens = usage_dict['prompt_tokens']
22
self.completion_tokens = usage_dict['completion_tokens']
23
self.total_tokens = usage_dict['total_tokens']
24
25
def __repr__(self):
26
return f'''<__main__.APIResponse.Usage(\n prompt_tokens = {self.prompt_tokens},\n completion_tokens = {self.completion_tokens},\n total_tokens = {self.total_tokens})object at 0x1337>'''
27
28
def __init__(self, response_dict: dict) -> None:
29
30
self.response_dict = response_dict
31
self.id = response_dict['id']
32
self.object = response_dict['object']
33
self.created = response_dict['created']
34
self.model = response_dict['model']
35
self.completion = self.Completion(response_dict['choices'])
36
self.usage = self.Usage(response_dict['usage'])
37
38
def json(self) -> dict:
39
return self.response_dict
@@ -1,15 +0,0 @@
1
import ora
2
3
4
# create model
5
model = ora.CompletionModel.create(
6
system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
7
description = 'ChatGPT Openai Language Model',
8
name = 'gpt-3.5')
9
10
# init conversation (will give you a conversationId)
11
init = ora.Completion.create(
12
model = model,
13
prompt = 'hello world')
14
15
print(init.completion.choices[0].text)
@@ -1,45 +0,0 @@
1
import ora
2
3
ora.user_id = '...'
4
ora.session_token = '...'
5
6
gpt4_chatbot_ids = ['b8b12eaa-5d47-44d3-92a6-4d706f2bcacf', 'fbe53266-673c-4b70-9d2d-d247785ccd91', 'bd5781cf-727a-45e9-80fd-a3cfce1350c6', '993a0102-d397-47f6-98c3-2587f2c9ec3a', 'ae5c524e-d025-478b-ad46-8843a5745261', 'cc510743-e4ab-485e-9191-76960ecb6040', 'a5cd2481-8e24-4938-aa25-8e26d6233390', '6bca5930-2aa1-4bf4-96a7-bea4d32dcdac', '884a5f2b-47a2-47a5-9e0f-851bbe76b57c', 'd5f3c491-0e74-4ef7-bdca-b7d27c59e6b3', 'd72e83f6-ef4e-4702-844f-cf4bd432eef7', '6e80b170-11ed-4f1a-b992-fd04d7a9e78c', '8ef52d68-1b01-466f-bfbf-f25c13ff4a72', 'd0674e11-f22e-406b-98bc-c1ba8564f749', 'a051381d-6530-463f-be68-020afddf6a8f', '99c0afa1-9e32-4566-8909-f4ef9ac06226', '1be65282-9c59-4a96-99f8-d225059d9001', 'dba16bd8-5785-4248-a8e9-b5d1ecbfdd60', '1731450d-3226-42d0-b41c-4129fe009524', '8e74635d-000e-4819-ab2c-4e986b7a0f48', 'afe7ed01-c1ac-4129-9c71-2ca7f3800b30', 'e374c37a-8c44-4f0e-9e9f-1ad4609f24f5']
7
chatbot_id = gpt4_chatbot_ids[0]
8
9
model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
10
response = ora.Completion.create(model, 'hello')
11
12
print(response.completion.choices[0].text)
13
conversation_id = response.id
14
15
while True:
16
# pass in conversationId to continue conversation
17
18
prompt = input('>>> ')
19
response = ora.Completion.create(
20
model = model,
21
prompt = prompt,
22
includeHistory = True, # remember history
23
conversationId = conversation_id)
24
25
print(response.completion.choices[0].text)
26
27
28
# bots :
29
# 1 normal
30
# 2 solidity contract helper
31
# 3 swift project helper
32
# 4 developer gpt
33
# 5 lawsuit bot for spam call
34
# 6 p5.js code help bot
35
# 8 AI professor, for controversial topics
36
# 9 HustleGPT, your entrepreneurial AI
37
# 10 midjourney prompts bot
38
# 11 AI philosophy professor
39
# 12 TypeScript and JavaScript code review bot
40
# 13 credit card transaction details to merchant and location bot
41
# 15 Chemical Compound Similarity and Purchase Tool bot
42
# 16 expert full-stack developer AI
43
# 17 Solana development bot
44
# 18 price guessing game bot
45
# 19 AI Ethicist and Philosopher
@@ -1,24 +0,0 @@
1
import ora
2
3
complex_question = '''
4
James is talking to two people, his father, and his friend.
5
6
Douglas asks him, "What did you do today James?"
7
James replies, "I went on a fishing trip."
8
Josh then asks, "Did you catch anything?"
9
James replies, "Yes, I caught a couple of nice rainbow trout. It was a lot of fun."
10
Josh replies, "Good job son, tell your mother we should eat them tonight, she'll be very happy."
11
Douglas then says, "I wish my family would eat fish tonight, my father is making pancakes."
12
13
Question: Who is James' father?
14
'''
15
16
# right answer is josh
17
18
model = ora.CompletionModel.load('b8b12eaa-5d47-44d3-92a6-4d706f2bcacf', 'gpt-4')
19
# init conversation (will give you a conversationId)
20
init = ora.Completion.create(
21
model = model,
22
prompt = complex_question)
23
24
print(init.completion.choices[0].text) # James' father is Josh.
此文件没有可显示的逐行差异。
此文件没有可显示的逐行差异。
此文件没有可显示的逐行差异。