Merge pull request #65 from VilotStar/main
Browse files- README.md +15 -0
- cocalc/__init__.py +28 -0
README.md
CHANGED
@@ -27,6 +27,7 @@ This repository provides reverse-engineered language models from various sources
|
|
27 |
- [`ora`](#example-ora)
|
28 |
- [`writesonic`](#example-writesonic)
|
29 |
- [`you`](#example-you)
|
|
|
30 |
|
31 |
## Current Sites <a name="current-sites"></a>
|
32 |
|
@@ -38,6 +39,7 @@ This repository provides reverse-engineered language models from various sources
|
|
38 |
| [t3nsor.com](https://t3nsor.com)|GPT-3.5|
|
39 |
| [you.com](https://you.com)|GPT-3.5 / Internet / good search|
|
40 |
| [phind.com](https://phind.com)|GPT-4 / Internet / good search|
|
|
|
41 |
|
42 |
## Sites with Authentication <a name="sites-with-authentication"></a>
|
43 |
|
@@ -306,6 +308,19 @@ while True:
|
|
306 |
chat.append({"question": prompt, "answer": response["response"]})
|
307 |
```
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
## Dependencies
|
310 |
|
311 |
The repository is written in Python and requires the following packages:
|
|
|
27 |
- [`ora`](#example-ora)
|
28 |
- [`writesonic`](#example-writesonic)
|
29 |
- [`you`](#example-you)
|
30 |
+
- [`cocalc`](#example-cocalc)
|
31 |
|
32 |
## Current Sites <a name="current-sites"></a>
|
33 |
|
|
|
39 |
| [t3nsor.com](https://t3nsor.com)|GPT-3.5|
|
40 |
| [you.com](https://you.com)|GPT-3.5 / Internet / good search|
|
41 |
| [phind.com](https://phind.com)|GPT-4 / Internet / good search|
|
42 |
+
| [cocalc.com](https://cocalc.com)|GPT-3.5 / Unknown Internet|
|
43 |
|
44 |
## Sites with Authentication <a name="sites-with-authentication"></a>
|
45 |
|
|
|
308 |
chat.append({"question": prompt, "answer": response["response"]})
|
309 |
```
|
310 |
|
311 |
+
### Example: `cocalc` (use like openai pypi package) <a name="example-cocalc"></a>
|
312 |
+
|
313 |
+
```python
|
314 |
+
import cocalc
|
315 |
+
|
316 |
+
response = you.Completion.create(
|
317 |
+
prompt = "Hello World", # Required
|
318 |
+
system_prompt = "You are ChatGPT" # Optional
|
319 |
+
)
|
320 |
+
|
321 |
+
print(response) # Just text response
|
322 |
+
```
|
323 |
+
|
324 |
## Dependencies
|
325 |
|
326 |
The repository is written in Python and requires the following packages:
|
cocalc/__init__.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from requests import Session
|
2 |
+
import json
|
3 |
+
|
4 |
+
class Completion:
|
5 |
+
def create(
|
6 |
+
prompt: str = "What is the square root of pi",
|
7 |
+
system_prompt: str = "ASSUME I HAVE FULL ACCESS TO COCALC. ENCLOSE MATH IN $. INCLUDE THE LANGUAGE DIRECTLY AFTER THE TRIPLE BACKTICKS IN ALL MARKDOWN CODE BLOCKS. How can I do the following using CoCalc? "
|
8 |
+
) -> str:
|
9 |
+
|
10 |
+
client = Session(client_identifier="chrome_108")
|
11 |
+
client.headers = {
|
12 |
+
'Accept': */*
|
13 |
+
'Accept-Language': en-US,en;q=0.5
|
14 |
+
"origin" : "https://cocalc.com",
|
15 |
+
"referer" : "https://cocalc.com/api/v2/openai/chatgpt",
|
16 |
+
'cookie' : "Cookie: CC_ANA=c68b16f3-f74c-403f-8e18-1d89168b2d13; "
|
17 |
+
"user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
18 |
+
}
|
19 |
+
payload = {
|
20 |
+
"input": prompt,
|
21 |
+
"system": system_prompt,
|
22 |
+
"tag": "next:index"
|
23 |
+
}
|
24 |
+
|
25 |
+
response = client.post(f"https://cocalc.com/api/v2/openai/chatgpt", json=payload)
|
26 |
+
|
27 |
+
return json.loads(response)["output"]
|
28 |
+
|