t.me/xtekky commited on
Commit
78662c7
1 Parent(s): 2c35840

ora userid and session token for gpt-4

Browse files
Files changed (4) hide show
  1. README.md +1 -0
  2. ora/README.md +5 -0
  3. ora/__init__.py +12 -4
  4. testing/ora_gpt4.py +24 -19
README.md CHANGED
@@ -58,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support!!
58
  - [`/ora`](./ora/README.md)
59
  - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
60
  - why ?, no streaming compared to poe.com but u can send more than 1 message
 
61
 
62
  #### gpt-3.5
63
  - [`/sqlchat`](./sqlchat/README.md)
 
58
  - [`/ora`](./ora/README.md)
59
  - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
60
  - why ?, no streaming compared to poe.com but u can send more than 1 message
61
+ - update: you need to use session token now and there is a limit, accounts are only google so no creator for now
62
 
63
  #### gpt-3.5
64
  - [`/sqlchat`](./sqlchat/README.md)
ora/README.md CHANGED
@@ -5,6 +5,10 @@
5
  more gpt4 models in `/testing/ora_gpt4.py`
6
 
7
  ```python
 
 
 
 
8
  # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
9
  model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
10
  ```
@@ -14,6 +18,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
14
  # import ora
15
  import ora
16
 
 
17
  # create model
18
  model = ora.CompletionModel.create(
19
  system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
 
5
  more gpt4 models in `/testing/ora_gpt4.py`
6
 
7
  ```python
8
+ # if using CompletionModel.load set these
9
+ ora.user_id = '...'
10
+ ora.session_token = '...'
11
+
12
  # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
13
  model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
14
  ```
 
18
  # import ora
19
  import ora
20
 
21
+
22
  # create model
23
  model = ora.CompletionModel.create(
24
  system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
ora/__init__.py CHANGED
@@ -4,18 +4,23 @@ from requests import post
4
  from time import time
5
  from random import randint
6
 
 
 
 
7
  class Completion:
8
  def create(
9
  model : CompletionModel,
10
  prompt: str,
11
  includeHistory: bool = True,
12
  conversationId: str or None = None) -> OraResponse:
13
-
14
  extra = {
15
  'conversationId': conversationId} if conversationId else {}
16
 
17
- response = post('https://ora.sh/api/conversation',
18
- headers = {
 
 
 
19
  "host" : "ora.sh",
20
  "authorization" : f"Bearer AY0{randint(1111, 9999)}",
21
  "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",
@@ -25,10 +30,13 @@ class Completion:
25
  json = extra | {
26
  'chatbotId': model.id,
27
  'input' : prompt,
28
- 'userId' : model.createdBy,
29
  'model' : model.modelName,
30
  'provider' : 'OPEN_AI',
31
  'includeHistory': includeHistory}).json()
 
 
 
32
 
33
  return OraResponse({
34
  'id' : response['conversationId'],
 
4
  from time import time
5
  from random import randint
6
 
7
+ user_id = None
8
+ session_token = None
9
+
10
  class Completion:
11
  def create(
12
  model : CompletionModel,
13
  prompt: str,
14
  includeHistory: bool = True,
15
  conversationId: str or None = None) -> OraResponse:
 
16
  extra = {
17
  'conversationId': conversationId} if conversationId else {}
18
 
19
+ cookies = {
20
+ "cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {}
21
+
22
+ response = post('https://ora.sh/api/conversation',
23
+ headers = cookies | {
24
  "host" : "ora.sh",
25
  "authorization" : f"Bearer AY0{randint(1111, 9999)}",
26
  "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",
 
30
  json = extra | {
31
  'chatbotId': model.id,
32
  'input' : prompt,
33
+ 'userId' : user_id if user_id else model.createdBy,
34
  'model' : model.modelName,
35
  'provider' : 'OPEN_AI',
36
  'includeHistory': includeHistory}).json()
37
+
38
+ if response.get('error'):
39
+ raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error'])
40
 
41
  return OraResponse({
42
  'id' : response['conversationId'],
testing/ora_gpt4.py CHANGED
@@ -1,27 +1,12 @@
1
  import ora
2
 
3
- # 1 normal
4
- # 2 solidity contract helper
5
- # 3 swift project helper
6
- # 4 developer gpt
7
- # 5 lawsuit bot for spam call
8
- # 6 p5.js code help bot
9
- # 8 AI professor, for controversial topics
10
- # 9 HustleGPT, your entrepreneurial AI
11
- # 10 midjourney prompts bot
12
- # 11 AI philosophy professor
13
- # 12 TypeScript and JavaScript code review bot
14
- # 13 credit card transaction details to merchant and location bot
15
- # 15 Chemical Compound Similarity and Purchase Tool bot
16
- # 16 expert full-stack developer AI
17
- # 17 Solana development bot
18
- # 18 price guessing game bot
19
- # 19 AI Ethicist and Philosopher
20
 
21
  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']
22
  chatbot_id = gpt4_chatbot_ids[0]
23
 
24
- model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
25
  response = ora.Completion.create(model, 'hello')
26
 
27
  print(response.completion.choices[0].text)
@@ -37,4 +22,24 @@ while True:
37
  includeHistory = True, # remember history
38
  conversationId = conversation_id)
39
 
40
- print(response.completion.choices[0].text)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)
 
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