Skip to content

Commit

Permalink
ora userid and session token for gpt-4
Browse files Browse the repository at this point in the history
  • Loading branch information
xtekky committed Apr 24, 2023
1 parent 2c35840 commit 78662c7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support!!
- [`/ora`](./ora/README.md)
- here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
- why ?, no streaming compared to poe.com but u can send more than 1 message
- update: you need to use session token now and there is a limit, accounts are only google so no creator for now

#### gpt-3.5
- [`/sqlchat`](./sqlchat/README.md)
Expand Down
5 changes: 5 additions & 0 deletions ora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
more gpt4 models in `/testing/ora_gpt4.py`

```python
# if using CompletionModel.load set these
ora.user_id = '...'
ora.session_token = '...'

# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
```
Expand All @@ -14,6 +18,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
# import ora
import ora


# create model
model = ora.CompletionModel.create(
system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
Expand Down
16 changes: 12 additions & 4 deletions ora/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
from time import time
from random import randint

user_id = None
session_token = None

class Completion:
def create(
model : CompletionModel,
prompt: str,
includeHistory: bool = True,
conversationId: str or None = None) -> OraResponse:

extra = {
'conversationId': conversationId} if conversationId else {}

response = post('https://ora.sh/api/conversation',
headers = {
cookies = {
"cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {}

response = post('https://ora.sh/api/conversation',
headers = cookies | {
"host" : "ora.sh",
"authorization" : f"Bearer AY0{randint(1111, 9999)}",
"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",
Expand All @@ -25,10 +30,13 @@ def create(
json = extra | {
'chatbotId': model.id,
'input' : prompt,
'userId' : model.createdBy,
'userId' : user_id if user_id else model.createdBy,
'model' : model.modelName,
'provider' : 'OPEN_AI',
'includeHistory': includeHistory}).json()

if response.get('error'):
raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error'])

return OraResponse({
'id' : response['conversationId'],
Expand Down
43 changes: 24 additions & 19 deletions testing/ora_gpt4.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
import ora

# 1 normal
# 2 solidity contract helper
# 3 swift project helper
# 4 developer gpt
# 5 lawsuit bot for spam call
# 6 p5.js code help bot
# 8 AI professor, for controversial topics
# 9 HustleGPT, your entrepreneurial AI
# 10 midjourney prompts bot
# 11 AI philosophy professor
# 12 TypeScript and JavaScript code review bot
# 13 credit card transaction details to merchant and location bot
# 15 Chemical Compound Similarity and Purchase Tool bot
# 16 expert full-stack developer AI
# 17 Solana development bot
# 18 price guessing game bot
# 19 AI Ethicist and Philosopher
ora.user_id = '...'
ora.session_token = '...'

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']
chatbot_id = gpt4_chatbot_ids[0]

model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
response = ora.Completion.create(model, 'hello')

print(response.completion.choices[0].text)
Expand All @@ -37,4 +22,24 @@
includeHistory = True, # remember history
conversationId = conversation_id)

print(response.completion.choices[0].text)
print(response.completion.choices[0].text)


# bots :
# 1 normal
# 2 solidity contract helper
# 3 swift project helper
# 4 developer gpt
# 5 lawsuit bot for spam call
# 6 p5.js code help bot
# 8 AI professor, for controversial topics
# 9 HustleGPT, your entrepreneurial AI
# 10 midjourney prompts bot
# 11 AI philosophy professor
# 12 TypeScript and JavaScript code review bot
# 13 credit card transaction details to merchant and location bot
# 15 Chemical Compound Similarity and Purchase Tool bot
# 16 expert full-stack developer AI
# 17 Solana development bot
# 18 price guessing game bot
# 19 AI Ethicist and Philosopher

0 comments on commit 78662c7

Please sign in to comment.