forked from xtekky/gpt4free
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move documenation to individual folder
- Loading branch information
Showing
8 changed files
with
265 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
### Example: `ora` (use like openai pypi package) <a name="example-ora"></a> | ||
|
||
### load model (new) | ||
|
||
more gpt4 models in `/testing/ora_gpt4.py` | ||
|
||
```python | ||
# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf | ||
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5 | ||
``` | ||
|
||
#### create model / chatbot: | ||
```python | ||
# inport 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', | ||
description = 'ChatGPT Openai Language Model', | ||
name = 'gpt-3.5') | ||
|
||
# init conversation (will give you a conversationId) | ||
init = ora.Completion.create( | ||
model = model, | ||
prompt = 'hello world') | ||
|
||
print(init.completion.choices[0].text) | ||
|
||
while True: | ||
# pass in conversationId to continue conversation | ||
|
||
prompt = input('>>> ') | ||
response = ora.Completion.create( | ||
model = model, | ||
prompt = prompt, | ||
includeHistory = True, # remember history | ||
conversationId = init.id) | ||
|
||
print(response.completion.choices[0].text) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
### Example: `phind` (use like openai pypi package) <a name="example-phind"></a> | ||
|
||
```python | ||
import phind | ||
|
||
# set cf_clearance cookie | ||
phind.cf_clearance = 'xx.xx-1682166681-0-160' | ||
|
||
prompt = 'who won the quatar world cup' | ||
|
||
# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this | ||
# stream completion | ||
for result in phind.StreamingCompletion.create( | ||
model = 'gpt-4', | ||
prompt = prompt, | ||
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet) | ||
creative = False, | ||
detailed = False, | ||
codeContext = ''): # up to 3000 chars of code | ||
|
||
print(result.completion.choices[0].text, end='', flush=True) | ||
|
||
# normal completion | ||
result = phind.Completion.create( | ||
model = 'gpt-4', | ||
prompt = prompt, | ||
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet) | ||
creative = False, | ||
detailed = False, | ||
codeContext = '') # up to 3000 chars of code | ||
|
||
print(result.completion.choices[0].text) | ||
``` |
Oops, something went wrong.