mirror of https://github.com/xtekky/gpt4free.git
ora.sh
This commit is contained in:
parent
fa113e6fa7
commit
fce0656ab1
11
ora/model.py
11
ora/model.py
|
@ -8,6 +8,7 @@ class CompletionModel:
|
||||||
createdAt = None
|
createdAt = None
|
||||||
slug = None
|
slug = None
|
||||||
id = None
|
id = None
|
||||||
|
modelName = None
|
||||||
model = 'gpt-3.5-turbo'
|
model = 'gpt-3.5-turbo'
|
||||||
|
|
||||||
def create(
|
def create(
|
||||||
|
@ -19,13 +20,21 @@ class CompletionModel:
|
||||||
CompletionModel.description = description
|
CompletionModel.description = description
|
||||||
CompletionModel.slug = name
|
CompletionModel.slug = name
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'Origin' : 'https://ora.sh',
|
||||||
|
'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',
|
||||||
|
'Referer' : 'https://ora.sh/',
|
||||||
|
'Host' : 'ora.sh',
|
||||||
|
}
|
||||||
|
|
||||||
response = post('https://ora.sh/api/assistant', json = {
|
response = post('https://ora.sh/api/assistant', headers = headers, json = {
|
||||||
'prompt' : system_prompt,
|
'prompt' : system_prompt,
|
||||||
'userId' : f'auto:{uuid4()}',
|
'userId' : f'auto:{uuid4()}',
|
||||||
'name' : name,
|
'name' : name,
|
||||||
'description': description})
|
'description': description})
|
||||||
|
|
||||||
|
print(response.json())
|
||||||
|
|
||||||
CompletionModel.id = response.json()['id']
|
CompletionModel.id = response.json()['id']
|
||||||
CompletionModel.createdBy = response.json()['createdBy']
|
CompletionModel.createdBy = response.json()['createdBy']
|
||||||
CompletionModel.createdAt = response.json()['createdAt']
|
CompletionModel.createdAt = response.json()['createdAt']
|
||||||
|
|
|
@ -24,4 +24,4 @@ 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')
|
response = ora.Completion.create(model, 'hello')
|
||||||
|
|
||||||
print(response)
|
print(response.completion.choices[0].text)
|
||||||
|
|
Loading…
Reference in New Issue