diff --git a/README.md b/README.md index 0db3ec6..99d2a34 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,52 @@ api.clear_conversations() # clear all conversations api.refresh_chat_page() # refresh the chat page ``` + +#### Summarization using ChatGPT + +```python +from pyChatGPT import ChatGPT + +session_token = 'abc123' # `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat +api = ChatGPT(session_token) # auth with session token +api = ChatGPT(session_token, conversation_id='some-random-uuid') # specify conversation id +api = ChatGPT(session_token, proxy='https://proxy.example.com:8080') # specify proxy +api = ChatGPT(session_token, chrome_args=['--window-size=1920,768']) # specify chrome args +api = ChatGPT(session_token, moderation=False) # disable moderation +api = ChatGPT(session_token, verbose=True) # verbose mode (print debug messages) + +# auth with google login +api = ChatGPT(auth_type='google', email='example@gmail.com', password='password') +# auth with microsoft login +api = ChatGPT(auth_type='microsoft', email='example@gmail.com', password='password') +# auth with openai login (captcha solving using speech-to-text engine) +api = ChatGPT(auth_type='openai', email='example@gmail.com', password='password') +# auth with openai login (manual captcha solving) +api = ChatGPT( + auth_type='openai', captcha_solver=None, + email='example@gmail.com', password='password' +) +# auth with openai login (2captcha for captcha solving) +api = ChatGPT( + auth_type='openai', captcha_solver='2captcha', solver_apikey='abc', + email='example@gmail.com', password='password' +) +# reuse cookies generated by successful login before login, +# if `login_cookies_path` does not exist, it will process logining with `auth_type`, and save cookies to `login_cookies_path` +# only works when `auth_type` is `openai` or `google` +api = ChatGPT(auth_type='openai', email='example@xxx.com', password='password', + login_cookies_path='your_cookies_path', +) + +resp = api.send_message("summarize text into 50 words: Alzheimer's disease (AD) is a neurodegenerative disease that usually starts slowly and progressively worsens.[2] It is the cause of 60–70% of cases of dementia.[2][11] The most common early symptom is difficulty in remembering recent events.[1] As the disease advances, symptoms can include problems with language, disorientation (including easily getting lost), mood swings, loss of motivation, self-neglect, and behavioral issues.[2] As a person's condition declines, they often withdraw from family and society.[12] Gradually, bodily functions are lost, ultimately leading to death.[13] Although the speed of progression can vary, the typical life expectancy following diagnosis is three to nine years.") + +print(resp['message']) + +api.reset_conversation() # reset the conversation +api.clear_conversations() # clear all conversations +api.refresh_chat_page() # refresh the chat page +``` + ## Frequently Asked Questions ### How do I get it to work on headless linux server?