t.me/xtekky
commited on
Commit
•
789b209
1
Parent(s):
0ed7556
move documenation to individual folder
Browse files- README.md +11 -280
- ora/README.md +41 -0
- phind/README.md +33 -0
- quora/README.md +49 -0
- t3nsor/README.md +42 -0
- {quora → testing}/poe_account_create_test.py +0 -0
- writesonic/README.md +53 -0
- you/README.md +36 -0
README.md
CHANGED
@@ -43,292 +43,23 @@ These sites will be reverse engineered but need account access:
|
|
43 |
|
44 |
## Usage Examples <a name="usage-examples"></a>
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
```python
|
49 |
-
# quora model names: (use left key as argument)
|
50 |
-
models = {
|
51 |
-
'sage' : 'capybara',
|
52 |
-
'gpt-4' : 'beaver',
|
53 |
-
'claude-v1.2' : 'a2_2',
|
54 |
-
'claude-instant-v1.0' : 'a2',
|
55 |
-
'gpt-3.5-turbo' : 'chinchilla'
|
56 |
-
}
|
57 |
-
```
|
58 |
-
|
59 |
-
#### !! new: bot creation
|
60 |
-
|
61 |
-
```python
|
62 |
-
# import quora (poe) package
|
63 |
-
import quora
|
64 |
-
|
65 |
-
# create account
|
66 |
-
# make shure to set enable_bot_creation to True
|
67 |
-
token = quora.Account.create(logging = True, enable_bot_creation=True)
|
68 |
-
|
69 |
-
model = quora.Model.create(
|
70 |
-
token = token,
|
71 |
-
model = 'gpt-3.5-turbo', # or claude-instant-v1.0
|
72 |
-
system_prompt = 'you are ChatGPT a large language model ...'
|
73 |
-
)
|
74 |
-
|
75 |
-
print(model.name) # gptx....
|
76 |
-
|
77 |
-
# streaming response
|
78 |
-
for response in quora.StreamingCompletion.create(
|
79 |
-
custom_model = model.name,
|
80 |
-
prompt ='hello world',
|
81 |
-
token = token):
|
82 |
-
|
83 |
-
print(response.completion.choices[0].text)
|
84 |
-
```
|
85 |
-
|
86 |
-
#### Normal Response:
|
87 |
-
```python
|
88 |
-
|
89 |
-
response = quora.Completion.create(model = 'gpt-4',
|
90 |
-
prompt = 'hello world',
|
91 |
-
token = token)
|
92 |
-
|
93 |
-
print(response.completion.choices[0].text)
|
94 |
-
```
|
95 |
-
|
96 |
-
### Example: `phind` (use like openai pypi package) <a name="example-phind"></a>
|
97 |
-
|
98 |
-
```python
|
99 |
-
import phind
|
100 |
-
|
101 |
-
# set cf_clearance cookie
|
102 |
-
phind.cf_clearance = 'xx.xx-1682166681-0-160'
|
103 |
-
|
104 |
-
prompt = 'who won the quatar world cup'
|
105 |
-
|
106 |
-
# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this
|
107 |
-
# stream completion
|
108 |
-
for result in phind.StreamingCompletion.create(
|
109 |
-
model = 'gpt-4',
|
110 |
-
prompt = prompt,
|
111 |
-
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet)
|
112 |
-
creative = False,
|
113 |
-
detailed = False,
|
114 |
-
codeContext = ''): # up to 3000 chars of code
|
115 |
-
|
116 |
-
print(result.completion.choices[0].text, end='', flush=True)
|
117 |
-
|
118 |
-
# normal completion
|
119 |
-
result = phind.Completion.create(
|
120 |
-
model = 'gpt-4',
|
121 |
-
prompt = prompt,
|
122 |
-
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet)
|
123 |
-
creative = False,
|
124 |
-
detailed = False,
|
125 |
-
codeContext = '') # up to 3000 chars of code
|
126 |
-
|
127 |
-
print(result.completion.choices[0].text)
|
128 |
-
```
|
129 |
-
|
130 |
-
### Example: `t3nsor` (use like openai pypi package) <a name="example-t3nsor"></a>
|
131 |
-
|
132 |
-
```python
|
133 |
-
# Import t3nsor
|
134 |
-
import t3nsor
|
135 |
-
|
136 |
-
# t3nsor.Completion.create
|
137 |
-
# t3nsor.StreamCompletion.create
|
138 |
-
|
139 |
-
[...]
|
140 |
-
|
141 |
-
```
|
142 |
-
|
143 |
-
#### Example Chatbot
|
144 |
-
```python
|
145 |
-
messages = []
|
146 |
-
|
147 |
-
while True:
|
148 |
-
user = input('you: ')
|
149 |
-
|
150 |
-
t3nsor_cmpl = t3nsor.Completion.create(
|
151 |
-
prompt = user,
|
152 |
-
messages = messages
|
153 |
-
)
|
154 |
-
|
155 |
-
print('gpt:', t3nsor_cmpl.completion.choices[0].text)
|
156 |
-
|
157 |
-
messages.extend([
|
158 |
-
{'role': 'user', 'content': user },
|
159 |
-
{'role': 'assistant', 'content': t3nsor_cmpl.completion.choices[0].text}
|
160 |
-
])
|
161 |
-
```
|
162 |
-
|
163 |
-
#### Streaming Response:
|
164 |
-
|
165 |
-
```python
|
166 |
-
for response in t3nsor.StreamCompletion.create(
|
167 |
-
prompt = 'write python code to reverse a string',
|
168 |
-
messages = []):
|
169 |
-
|
170 |
-
print(response.completion.choices[0].text)
|
171 |
-
```
|
172 |
-
|
173 |
-
### Example: `ora` (use like openai pypi package) <a name="example-ora"></a>
|
174 |
-
|
175 |
-
### load model (new)
|
176 |
-
|
177 |
-
more gpt4 models in `/testing/ora_gpt4.py`
|
178 |
-
|
179 |
-
```python
|
180 |
-
# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
|
181 |
-
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
|
182 |
-
```
|
183 |
-
|
184 |
-
#### create model / chatbot:
|
185 |
-
```python
|
186 |
-
# inport ora
|
187 |
-
import ora
|
188 |
-
|
189 |
-
# create model
|
190 |
-
model = ora.CompletionModel.create(
|
191 |
-
system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
|
192 |
-
description = 'ChatGPT Openai Language Model',
|
193 |
-
name = 'gpt-3.5')
|
194 |
-
|
195 |
-
# init conversation (will give you a conversationId)
|
196 |
-
init = ora.Completion.create(
|
197 |
-
model = model,
|
198 |
-
prompt = 'hello world')
|
199 |
-
|
200 |
-
print(init.completion.choices[0].text)
|
201 |
-
|
202 |
-
while True:
|
203 |
-
# pass in conversationId to continue conversation
|
204 |
-
|
205 |
-
prompt = input('>>> ')
|
206 |
-
response = ora.Completion.create(
|
207 |
-
model = model,
|
208 |
-
prompt = prompt,
|
209 |
-
includeHistory = True, # remember history
|
210 |
-
conversationId = init.id)
|
211 |
-
|
212 |
-
print(response.completion.choices[0].text)
|
213 |
-
```
|
214 |
-
|
215 |
-
### Example: `writesonic` (use like openai pypi package) <a name="example-writesonic"></a>
|
216 |
-
|
217 |
-
```python
|
218 |
-
# import writesonic
|
219 |
-
import writesonic
|
220 |
-
|
221 |
-
# create account (3-4s)
|
222 |
-
account = writesonic.Account.create(logging = True)
|
223 |
-
|
224 |
-
# with loging:
|
225 |
-
# 2023-04-06 21:50:25 INFO __main__ -> register success : '{"id":"51aa0809-3053-44f7-922a...' (2s)
|
226 |
-
# 2023-04-06 21:50:25 INFO __main__ -> id : '51aa0809-3053-44f7-922a-2b85d8d07edf'
|
227 |
-
# 2023-04-06 21:50:25 INFO __main__ -> token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...'
|
228 |
-
# 2023-04-06 21:50:28 INFO __main__ -> got key : '194158c4-d249-4be0-82c6-5049e869533c' (2s)
|
229 |
-
|
230 |
-
# simple completion
|
231 |
-
response = writesonic.Completion.create(
|
232 |
-
api_key = account.key,
|
233 |
-
prompt = 'hello world'
|
234 |
-
)
|
235 |
-
|
236 |
-
print(response.completion.choices[0].text) # Hello! How may I assist you today?
|
237 |
-
|
238 |
-
# conversation
|
239 |
-
|
240 |
-
response = writesonic.Completion.create(
|
241 |
-
api_key = account.key,
|
242 |
-
prompt = 'what is my name ?',
|
243 |
-
enable_memory = True,
|
244 |
-
history_data = [
|
245 |
-
{
|
246 |
-
'is_sent': True,
|
247 |
-
'message': 'my name is Tekky'
|
248 |
-
},
|
249 |
-
{
|
250 |
-
'is_sent': False,
|
251 |
-
'message': 'hello Tekky'
|
252 |
-
}
|
253 |
-
]
|
254 |
-
)
|
255 |
-
|
256 |
-
print(response.completion.choices[0].text) # Your name is Tekky.
|
257 |
-
|
258 |
-
# enable internet
|
259 |
-
|
260 |
-
response = writesonic.Completion.create(
|
261 |
-
api_key = account.key,
|
262 |
-
prompt = 'who won the quatar world cup ?',
|
263 |
-
enable_google_results = True
|
264 |
-
)
|
265 |
-
|
266 |
-
print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
|
267 |
-
```
|
268 |
-
|
269 |
-
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
|
270 |
-
|
271 |
-
```python
|
272 |
-
import you
|
273 |
-
|
274 |
-
# simple request with links and details
|
275 |
-
response = you.Completion.create(
|
276 |
-
prompt = "hello world",
|
277 |
-
detailed = True,
|
278 |
-
includelinks = True,)
|
279 |
-
|
280 |
-
print(response)
|
281 |
-
|
282 |
-
# {
|
283 |
-
# "response": "...",
|
284 |
-
# "links": [...],
|
285 |
-
# "extra": {...},
|
286 |
-
# "slots": {...}
|
287 |
-
# }
|
288 |
-
# }
|
289 |
-
|
290 |
-
#chatbot
|
291 |
-
|
292 |
-
chat = []
|
293 |
-
|
294 |
-
while True:
|
295 |
-
prompt = input("You: ")
|
296 |
-
|
297 |
-
response = you.Completion.create(
|
298 |
-
prompt = prompt,
|
299 |
-
chat = chat)
|
300 |
-
|
301 |
-
print("Bot:", response["response"])
|
302 |
-
|
303 |
-
chat.append({"question": prompt, "answer": response["response"]})
|
304 |
-
```
|
305 |
|
306 |
## Dependencies
|
307 |
|
308 |
-
The repository is written in Python and requires the following packages:
|
309 |
-
|
310 |
* websocket-client
|
311 |
* requests
|
312 |
* tls-client
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
├── writesonic/
|
323 |
-
├── you/
|
324 |
-
├── README.md <-- this file.
|
325 |
-
└── requirements.txt
|
326 |
-
|
327 |
-
|
328 |
-
## Star History
|
329 |
-
|
330 |
-
[![Star History Chart](https://api.star-history.com/svg?repos=xtekky/openai-gpt4&type=Timeline)](https://star-history.com/#xtekky/openai-gpt4&Timeline)
|
331 |
-
|
332 |
|
333 |
## Copyright:
|
334 |
This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
43 |
|
44 |
## Usage Examples <a name="usage-examples"></a>
|
45 |
|
46 |
+
| NOTE: the instructions of each module has been moved in the folder of the module itsself|
|
47 |
+
| --- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
## Dependencies
|
50 |
|
|
|
|
|
51 |
* websocket-client
|
52 |
* requests
|
53 |
* tls-client
|
54 |
+
* pypasser
|
55 |
+
* names
|
56 |
+
* colorama
|
57 |
+
* curl_cffi
|
58 |
+
|
59 |
+
install with:
|
60 |
+
```sh
|
61 |
+
pip3 install -r requirements.txt
|
62 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
## Copyright:
|
65 |
This program is licensed under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.txt)
|
ora/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
```python
|
8 |
+
# normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
|
9 |
+
model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
|
10 |
+
```
|
11 |
+
|
12 |
+
#### create model / chatbot:
|
13 |
+
```python
|
14 |
+
# inport 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',
|
20 |
+
description = 'ChatGPT Openai Language Model',
|
21 |
+
name = 'gpt-3.5')
|
22 |
+
|
23 |
+
# init conversation (will give you a conversationId)
|
24 |
+
init = ora.Completion.create(
|
25 |
+
model = model,
|
26 |
+
prompt = 'hello world')
|
27 |
+
|
28 |
+
print(init.completion.choices[0].text)
|
29 |
+
|
30 |
+
while True:
|
31 |
+
# pass in conversationId to continue conversation
|
32 |
+
|
33 |
+
prompt = input('>>> ')
|
34 |
+
response = ora.Completion.create(
|
35 |
+
model = model,
|
36 |
+
prompt = prompt,
|
37 |
+
includeHistory = True, # remember history
|
38 |
+
conversationId = init.id)
|
39 |
+
|
40 |
+
print(response.completion.choices[0].text)
|
41 |
+
```
|
phind/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Example: `phind` (use like openai pypi package) <a name="example-phind"></a>
|
2 |
+
|
3 |
+
```python
|
4 |
+
import phind
|
5 |
+
|
6 |
+
# set cf_clearance cookie
|
7 |
+
phind.cf_clearance = 'xx.xx-1682166681-0-160'
|
8 |
+
|
9 |
+
prompt = 'who won the quatar world cup'
|
10 |
+
|
11 |
+
# help needed: not getting newlines from the stream, please submit a PR if you know how to fix this
|
12 |
+
# stream completion
|
13 |
+
for result in phind.StreamingCompletion.create(
|
14 |
+
model = 'gpt-4',
|
15 |
+
prompt = prompt,
|
16 |
+
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet)
|
17 |
+
creative = False,
|
18 |
+
detailed = False,
|
19 |
+
codeContext = ''): # up to 3000 chars of code
|
20 |
+
|
21 |
+
print(result.completion.choices[0].text, end='', flush=True)
|
22 |
+
|
23 |
+
# normal completion
|
24 |
+
result = phind.Completion.create(
|
25 |
+
model = 'gpt-4',
|
26 |
+
prompt = prompt,
|
27 |
+
results = phind.Search.create(prompt, actualSearch = True), # create search (set actualSearch to False to disable internet)
|
28 |
+
creative = False,
|
29 |
+
detailed = False,
|
30 |
+
codeContext = '') # up to 3000 chars of code
|
31 |
+
|
32 |
+
print(result.completion.choices[0].text)
|
33 |
+
```
|
quora/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Example: `quora (poe)` (use like openai pypi package) - GPT-4 <a name="example-poe"></a>
|
2 |
+
|
3 |
+
```python
|
4 |
+
# quora model names: (use left key as argument)
|
5 |
+
models = {
|
6 |
+
'sage' : 'capybara',
|
7 |
+
'gpt-4' : 'beaver',
|
8 |
+
'claude-v1.2' : 'a2_2',
|
9 |
+
'claude-instant-v1.0' : 'a2',
|
10 |
+
'gpt-3.5-turbo' : 'chinchilla'
|
11 |
+
}
|
12 |
+
```
|
13 |
+
|
14 |
+
#### !! new: bot creation
|
15 |
+
|
16 |
+
```python
|
17 |
+
# import quora (poe) package
|
18 |
+
import quora
|
19 |
+
|
20 |
+
# create account
|
21 |
+
# make shure to set enable_bot_creation to True
|
22 |
+
token = quora.Account.create(logging = True, enable_bot_creation=True)
|
23 |
+
|
24 |
+
model = quora.Model.create(
|
25 |
+
token = token,
|
26 |
+
model = 'gpt-3.5-turbo', # or claude-instant-v1.0
|
27 |
+
system_prompt = 'you are ChatGPT a large language model ...'
|
28 |
+
)
|
29 |
+
|
30 |
+
print(model.name) # gptx....
|
31 |
+
|
32 |
+
# streaming response
|
33 |
+
for response in quora.StreamingCompletion.create(
|
34 |
+
custom_model = model.name,
|
35 |
+
prompt ='hello world',
|
36 |
+
token = token):
|
37 |
+
|
38 |
+
print(response.completion.choices[0].text)
|
39 |
+
```
|
40 |
+
|
41 |
+
#### Normal Response:
|
42 |
+
```python
|
43 |
+
|
44 |
+
response = quora.Completion.create(model = 'gpt-4',
|
45 |
+
prompt = 'hello world',
|
46 |
+
token = token)
|
47 |
+
|
48 |
+
print(response.completion.choices[0].text)
|
49 |
+
```
|
t3nsor/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Example: `t3nsor` (use like openai pypi package) <a name="example-t3nsor"></a>
|
2 |
+
|
3 |
+
```python
|
4 |
+
# Import t3nsor
|
5 |
+
import t3nsor
|
6 |
+
|
7 |
+
# t3nsor.Completion.create
|
8 |
+
# t3nsor.StreamCompletion.create
|
9 |
+
|
10 |
+
[...]
|
11 |
+
|
12 |
+
```
|
13 |
+
|
14 |
+
#### Example Chatbot
|
15 |
+
```python
|
16 |
+
messages = []
|
17 |
+
|
18 |
+
while True:
|
19 |
+
user = input('you: ')
|
20 |
+
|
21 |
+
t3nsor_cmpl = t3nsor.Completion.create(
|
22 |
+
prompt = user,
|
23 |
+
messages = messages
|
24 |
+
)
|
25 |
+
|
26 |
+
print('gpt:', t3nsor_cmpl.completion.choices[0].text)
|
27 |
+
|
28 |
+
messages.extend([
|
29 |
+
{'role': 'user', 'content': user },
|
30 |
+
{'role': 'assistant', 'content': t3nsor_cmpl.completion.choices[0].text}
|
31 |
+
])
|
32 |
+
```
|
33 |
+
|
34 |
+
#### Streaming Response:
|
35 |
+
|
36 |
+
```python
|
37 |
+
for response in t3nsor.StreamCompletion.create(
|
38 |
+
prompt = 'write python code to reverse a string',
|
39 |
+
messages = []):
|
40 |
+
|
41 |
+
print(response.completion.choices[0].text)
|
42 |
+
```
|
{quora → testing}/poe_account_create_test.py
RENAMED
File without changes
|
writesonic/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Example: `writesonic` (use like openai pypi package) <a name="example-writesonic"></a>
|
2 |
+
|
3 |
+
```python
|
4 |
+
# import writesonic
|
5 |
+
import writesonic
|
6 |
+
|
7 |
+
# create account (3-4s)
|
8 |
+
account = writesonic.Account.create(logging = True)
|
9 |
+
|
10 |
+
# with loging:
|
11 |
+
# 2023-04-06 21:50:25 INFO __main__ -> register success : '{"id":"51aa0809-3053-44f7-922a...' (2s)
|
12 |
+
# 2023-04-06 21:50:25 INFO __main__ -> id : '51aa0809-3053-44f7-922a-2b85d8d07edf'
|
13 |
+
# 2023-04-06 21:50:25 INFO __main__ -> token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...'
|
14 |
+
# 2023-04-06 21:50:28 INFO __main__ -> got key : '194158c4-d249-4be0-82c6-5049e869533c' (2s)
|
15 |
+
|
16 |
+
# simple completion
|
17 |
+
response = writesonic.Completion.create(
|
18 |
+
api_key = account.key,
|
19 |
+
prompt = 'hello world'
|
20 |
+
)
|
21 |
+
|
22 |
+
print(response.completion.choices[0].text) # Hello! How may I assist you today?
|
23 |
+
|
24 |
+
# conversation
|
25 |
+
|
26 |
+
response = writesonic.Completion.create(
|
27 |
+
api_key = account.key,
|
28 |
+
prompt = 'what is my name ?',
|
29 |
+
enable_memory = True,
|
30 |
+
history_data = [
|
31 |
+
{
|
32 |
+
'is_sent': True,
|
33 |
+
'message': 'my name is Tekky'
|
34 |
+
},
|
35 |
+
{
|
36 |
+
'is_sent': False,
|
37 |
+
'message': 'hello Tekky'
|
38 |
+
}
|
39 |
+
]
|
40 |
+
)
|
41 |
+
|
42 |
+
print(response.completion.choices[0].text) # Your name is Tekky.
|
43 |
+
|
44 |
+
# enable internet
|
45 |
+
|
46 |
+
response = writesonic.Completion.create(
|
47 |
+
api_key = account.key,
|
48 |
+
prompt = 'who won the quatar world cup ?',
|
49 |
+
enable_google_results = True
|
50 |
+
)
|
51 |
+
|
52 |
+
print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
|
53 |
+
```
|
you/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Example: `you` (use like openai pypi package) <a name="example-you"></a>
|
2 |
+
|
3 |
+
```python
|
4 |
+
import you
|
5 |
+
|
6 |
+
# simple request with links and details
|
7 |
+
response = you.Completion.create(
|
8 |
+
prompt = "hello world",
|
9 |
+
detailed = True,
|
10 |
+
includelinks = True,)
|
11 |
+
|
12 |
+
print(response)
|
13 |
+
|
14 |
+
# {
|
15 |
+
# "response": "...",
|
16 |
+
# "links": [...],
|
17 |
+
# "extra": {...},
|
18 |
+
# "slots": {...}
|
19 |
+
# }
|
20 |
+
# }
|
21 |
+
|
22 |
+
#chatbot
|
23 |
+
|
24 |
+
chat = []
|
25 |
+
|
26 |
+
while True:
|
27 |
+
prompt = input("You: ")
|
28 |
+
|
29 |
+
response = you.Completion.create(
|
30 |
+
prompt = prompt,
|
31 |
+
chat = chat)
|
32 |
+
|
33 |
+
print("Bot:", response["response"])
|
34 |
+
|
35 |
+
chat.append({"question": prompt, "answer": response["response"]})
|
36 |
+
```
|