Giter VIP home page Giter VIP logo

llm-workflow-engine's Introduction

Test status CodeQL status

lwe-logo-small

LLM Workflow Engine

LLM Workflow Engine (LWE) is a Power CLI and Workflow manager for LLMs.

Welcome!

What would you like to do?

What happend to the original ChatGPT Wrapper project?

See CHATGPT_WRAPPER.md

ChatGPT Wrapper was an amazing tool for its time, thank you to its original creator mmabrouk for all your hard work, it lives on in a new form :)

Highlights

πŸ€– LWE lets you use the powerful ChatGPT/GPT4 bot from the command line.

πŸ’¬ Runs in Shell. You can call and interact with ChatGPT/GPT4 in the terminal.

πŸ’» Supports official ChatGPT API. Make API calls directly to the OpenAI ChatGPT endpoint (all supported models accessible by your OpenAI account)

πŸ”Œ Simple plugin architecture. Extend LWE with custom functionality

πŸ—£ Supports multiple LLM providers. Provider plugins allow interacting with other LLMs (GPT-3, Cohere, Hugginface, etc.)

πŸ”„Build workflows. Easily integrate calls to an LLM into larger workflows via Ansible Playbooks

𝑓(π‘₯) Execute functions. Support for OpenAI functions

🐳 Docker image. LWE is also available as a docker image. (experimental)

🐍Python API. LWE also has a Python library that lets you use ChatGPT/GPT4 in your Python scripts.

Projects built with the original ChatGPT Wrapper

Contributing

We welcome contributions to LWE! If you have an idea for a new feature or have found a bug, please open an issue on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • The original ChatGPT Wrapper project (which LWE grew from) was created and maintained by mmabrouk
  • The original ChatGPT Wrapper project is a modification from Taranjeet code which is a modification of Daniel Gross code.

Star History

Star History Chart

llm-workflow-engine's People

Contributors

1core2life avatar akummur avatar gyliu513 avatar hunaid2000 avatar idilsulo avatar just1z avatar lucky7xz avatar marcosfp97 avatar mindgitrwx avatar mmabrouk avatar natanel-shitrit avatar natlee avatar nfedyashev avatar schipsy avatar ss18 avatar standardgalactic avatar superkenvery avatar tavisrudd avatar tecuya avatar thehunmonkgroup avatar thisiskushagr avatar thomas-xin avatar wpendl99 avatar wxw-matt avatar yerodin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llm-workflow-engine's Issues

Error: It looks like you are using Playwright Sync API inside the asyncio loop.

Error message after running chatgpt install: Error: It looks like you are using Playwright Sync API inside the asyncio loop. I have currently logged into my openai account, but can't find where the cookies box is. Now if I run chatgpt directly, I will encounter the same problem as #9. If I use the async api, I get an immediate error: AttributeError: 'coroutine' object has no attribute 'chromium' sys:1: RuntimeWarning: coroutine 'PlaywrightContextManager.start' was never awaited. i'm not sure how to fix this.

Word-by-word generation

What would it take to receive the output word by word? It happens in the browser, so some cleverness with Playwright might make this work. The delay between responses is killer.

Replit

Does anyone know how I can install this in a replit repository?

Your ChatGPT session is not usable.

I tried to use chapt-wrapper in python like this, but I encountered this problem.
from chatgpt_wrapper import ChatGPT
bot = ChatGPT()

return the full result

response = bot.ask("what day is today")
print(response)

problem:
Your ChatGPT session is not usable.

  • Run this program with the install parameter and log in to ChatGPT.
  • If you think you are already logged in, try running the session command.

Error with playwright

Sometimes I receive the following error. I am using ask_stream.

Traceback (most recent call last):
  File "/Users/***/Documents/GitHub/***/main.py", line 120, in <module>
    generate_review_by_product_info(product_info)
  File "/Users/***/Documents/GitHub/***/main.py", line 100, in generate_review_by_product_info
    next_chapter = generate_text_with_pbar_stream(prompt)
  File "/Users/***/Documents/GitHub/***/main.py", line 39, in generate_text_with_pbar_stream
    for t in pbar:
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/tqdm/std.py", line 1195, in __iter__
    for obj in iterable:
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/chatgpt_wrapper/chatgpt.py", line 231, in ask_stream
    self._cleanup_divs()
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/chatgpt_wrapper/chatgpt.py", line 103, in _cleanup_divs
    self.page.evaluate(f"document.getElementById('{self.eof_div_id}').remove()")
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 7697, in evaluate
    self._sync(
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 104, in _sync
    return task.result()
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_page.py", line 407, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 277, in evaluate
    await self._channel.send(
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 44, in send
    return await self._connection.wrap_api_call(
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call
    return await cb()
  File "/opt/anaconda3/envs/mobileComputing/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 79, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: document.getElementById(...) is null
@debugger eval code line 191 > eval:1:10
evaluate@debugger eval code:191:30
@debugger eval code:1:44

Open previous session

With the introduction of chat history you can now resume an old session, are there any plans to add support for this?

Threading Error, Please Help

Starting a thread with bot.ask in it causes the script to crash with
greenlet.error: cannot switch to a different thread

import threading
import queue
from chatgpt_wrapper import ChatGPT
bot = ChatGPT()
running = True
text_input = ""
# Define a function for the AI processing
def run_ai_processing(response_queue, text_input):
    # Perform the AI processing using the text input
    response = bot.ask("Hello World!")

    # Put the response in the queue
    response_queue.put(response)

# Create a queue for the responses
response_queue = queue.Queue()

# Create a new thread for the AI processing, passing the text input as an argument
ai_thread = threading.Thread(target=run_ai_processing, args=(response_queue, text_input))

# Start the AI processing thread
ai_thread.start()

# Continue with your main game loop
while running:
    # Get the text input from the user
    text_input = input("Enter your text: ")

    # Start the AI processing thread with the new text input
    ai_thread = threading.Thread(target=run_ai_processing, args=(response_queue, text_input))
    ai_thread.start()

    # Check if there is a response in the queue
    if not response_queue.empty():
        # Get the response from the queue
        response = response_queue.get()
        pass
    response(print)
    # Your game code here
    pass

Heres the script in its entirety

Entire Thread Error
Enter your text: Exception in thread Thread-1 (run_ai_processing): Traceback (most recent call last): File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "C:\Users\Olive\Downloads\ThreadingError.py", line 10, in run_ai_processing response = bot.ask("Hello World!") ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\site-packages\chatgpt_wrapper\chatgpt.py", line 230, in ask response = list(self.ask_stream(message)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\site-packages\chatgpt_wrapper\chatgpt.py", line 95, in ask_stream self.refresh_session() File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\site-packages\chatgpt_wrapper\chatgpt.py", line 60, in refresh_session self.page.evaluate( File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\sync_api\_generated.py", line 8362, in evaluate self._sync( File "C:\Users\Olive\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\_impl\_sync_base.py", line 102, in _sync self._dispatcher_fiber.switch() greenlet.error: cannot switch to a different thread

Rate limiting

After only a few commands, i get the "Unusable response produced by ChatGPT, maybe its unavailable."

So then i try again but from the actual browser it says i can try again in 1 hour. Is there a way to bypass this ?
I want to use this as an API for my web app so anyone on there could try it and input a command but if its getting rate limited like this its not going to work,

Playwright sync vs Async Error

I'm getting the following error when I try to run

from chatgpt_wrapper import ChatGPT
chatbot = ChatGPT()

Starting ...
Output exceeds the size limit. Open the full output data in a text editor

Error Traceback (most recent call last)
Cell In [1], line 4
1 from chatgpt_wrapper import ChatGPT
2 import asyncio
----> 4 chatbot = ChatGPT()

File c:\Users<>\miniconda3\lib\site-packages\chatgpt-0.1.0-py3.9.egg\chatgpt_wrapper\chatgpt.py:30, in ChatGPT.init(self, headless, timeout)
28 self.timeout = timeout
29 self.last_msg = None
---> 30 self.play = sync_playwright().start()
31 self.browser = self.play.chromium.launch_persistent_context(
32 user_data_dir=f"/tmp/playwright",
33 headless=headless,
34 )
35 self.page = self.browser.new_page()

File c:\Users<>\miniconda3\lib\site-packages\playwright-1.28.0-py3.9-win-amd64.egg\playwright\sync_api_context_manager.py:95, in PlaywrightContextManager.start(self)
94 def start(self) -> SyncPlaywright:
---> 95 return self.enter()

File c:\Users<>\miniconda3\lib\site-packages\playwright-1.28.0-py3.9-win-amd64.egg\playwright\sync_api_context_manager.py:44, in PlaywrightContextManager.enter(self)
42 self._own_loop = True
43 if self._loop.is_running():
---> 44 raise Error(
...
56 and isinstance(asyncio.get_child_watcher(), asyncio.SafeChildWatcher)
57 ):

Error: It looks like you are using Playwright Sync API inside the asyncio loop.
Please use the Async API instead.

Ctrl + D (to exit) sends EOF char to ChatGPT

I tried using Ctrl + D to exit the REPL, and was surprised to see a description of the EOF character instead:

9> 
EOF stands for "end of file." It is a special character or sequence of characters that signifies the end of a file, input stream, or output stream. In programming, EOF is often used to indicate the end of a file when reading it, or the end of data when writing to a file. When an EOF character is encountered, the program may stop reading or writing, or it may take some other action, depending on how it is designed to handle EOF.

The REPL should exit when it receives EOF.

Issue with Installation Instructions

git clone https://github.com/mmabrouk/chatgpt-wrapper
Cloning into 'chatgpt-wrapper'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 18 (delta 4), reused 11 (delta 0), pack-reused 0
Receiving objects: 100% (18/18), 5.24 KiB | 2.62 MiB/s, done.
Resolving deltas: 100% (4/4), done.
user@pc:~/Downloads/openai$ sudo pip install chatgpt-wrapper
[sudo] password for user:
ERROR: Could not find a version that satisfies the requirement chatgpt-wrapper (from versions: none)
ERROR: No matching distribution found for chatgpt-wrapper

commands are too easy to use accidentally

If someone provides a prompt like:

new cars are safer than old cars right?

or

session tracking in php is easy, right?

It's going to accidentally be triggering the new command, and the session command.

But what's the solution? Do we make all commands require a fore slash or something? new becomes /new?

Does anyone have an opinion, is it worth changing?

Can't install due to playwright installation issue

When running pip install git+https://github.com/mmabrouk/chatgpt-wrapper, I get the following error:

ERROR: Could not find a version that satisfies the requirement playwright (from chatgpt) (from versions: none)
ERROR: No matching distribution found for playwright

I tried installing playwright directly via the instructions in their docs, but get the same error about not being able to find a distribution. I assume that this is a problem on playwright's end, but I wanted to ask it here because it seems like plenty of folks have gotten this installed and up and running.

Thanks!

program messes up terminal after exit

whenever i run the program it messes up my terminal after i exit, such that i have to use reset to fix it.

im not sure exactly whats causing it, i think maybe playwright is doing it somehow.. its been happening since i first used it

cannot switch to a different thread

Python 3.9.0
Win 10

Error:

Exception in callback SyncBase._sync.<locals>.<lambda>(<Task finishe...rget closed')>) at C:\Users\Homee\AppData\Local\Programs\Python\Python39\lib\site-packages\playwright-1.30.0-py3.9-win-amd64.egg\playwright\_impl\_sync_base.py:100
handle: <Handle SyncBase._sync.<locals>.<lambda>(<Task finishe...rget closed')>) at C:\Users\Homee\AppData\Local\Programs\Python\Python39\lib\site-packages\playwright-1.30.0-py3.9-win-amd64.egg\playwright\_impl\_sync_base.py:100>
Traceback (most recent call last):
  File "C:\Users\Homee\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Homee\AppData\Local\Programs\Python\Python39\lib\site-packages\playwright-1.30.0-py3.9-win-amd64.egg\playwright\_impl\_sync_base.py", line 100, in <lambda>
    task.add_done_callback(lambda _: g_self.switch())
greenlet.error: cannot switch to a different thread

My code:

from telebot import TeleBot
from chatgpt_wrapper import ChatGPT

chat = ChatGPT()
bot = TeleBot('My token')

@bot.message_handler(func=lambda message: True)
def message(message):
    bot.reply_to(message, chat.ask(message.text))
    
bot.polling()

Conversation is not continuous

When I send β€œcontinueβ€οΌŒI found the next response do not continuous to last message. After looking other project in GitHub,I found that the message_id to send is different to the id from response, so the solution is as follows:
image

How can I do multiline input?

As soon as I press enter or shift+enter for a newline, it submits the query immediately. How can I put in a multiline input?
This is probably a terminal limitation.

Installation problem

I think I did everything write but when I write "chatgpt install" it shows me:
Traceback (most recent call last):
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\Scripts\chatgpt-script.py", line 33, in
sys.exit(load_entry_point('chatGPT==0.3.6', 'console_scripts', 'chatgpt')())
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\Scripts\chatgpt-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\lib\importlib\metadata_init_.py", line 171, in load
module = import_module(match.group('module'))
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 992, in _find_and_load_unlocked
File "", line 241, in _call_with_frames_removed
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\lib\site-packages\chatgpt_wrapper_init
.py", line 1, in
from .chatgpt import ChatGPT
File "C:\Users\misam\AppData\Local\Programs\Python\Python310\lib\site-packages\chatgpt_wrapper\chatgpt.py", line 15, in
import pyreadline3 # noqa: F401
ModuleNotFoundError: No module named 'pyreadline3'

I think I am just dumb and did smth wrong idk.

Freezes at end of responses

Sometimes the Chatgpt program seemingly never gets the memo that ChatGPT has completed its response. If streaming is enabled, this results in the entire response being sent to the screen, but then no prompt for another input. If streaming is disabled, since the program never finds out the response is complete, it never prints it to the screen. In either case, if logging is enabled, the response never gets logged. The only thing you can do is to hit Ctrl+C to terminate the program. There should probably be a timeout similar to the "no response at all" timeout, triggered after a certain time with no data from ChatGPT after starting to receive a valid response. When this timeout triggers, the program should assume it's received all it's going to receive, and handle the situation as if it had received a complete response E.G. log it, render it if streaming is disabled, provide the next input prompt, etc.

installation problem

C:\WINDOWS\system32>chatgpt install
Install mode: Log in to ChatGPT in the browser that pops up, and click
through all the dialogs, etc. Once that is acheived, exit and restart
this program without the 'install' parameter.

Traceback (most recent call last):
File "C:\Python311\Scripts\chatgpt-script.py", line 33, in
sys.exit(load_entry_point('chatGPT==0.3.6', 'console_scripts', 'chatgpt')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\chatgpt_wrapper\chatgpt.py", line 495, in main
shell.cmdloop()
File "C:\Python311\Lib\cmd.py", line 108, in cmdloop
import readline
File "C:\Python311\Lib\site-packages\readline.py", line 34, in
rl = Readline()
^^^^^^^^^^
File "C:\Python311\Lib\site-packages\pyreadline\rlmain.py", line 422, in init
BaseReadline.init(self)
File "C:\Python311\Lib\site-packages\pyreadline\rlmain.py", line 62, in init
mode.init_editing_mode(None)
File "C:\Python311\Lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Python311\Lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'

The popup to log in does not appear

Hello !
After having made the command "pip install git+https://github.com/mmabrouk/chatgpt-wrapper" which seems to work, I make the command "chatgpt install".

Then, I have the following message:

Install mode: Log in to ChatGPT in the browser that pops up, and click
through all the dialogs, etc. Once that is acheived, exit and restart
this program without the 'install' parameter.

Traceback (most recent call last):
  File "/home/utilisateur/.local/bin/chatgpt", line 8, in <module>
    sys.exit(main())
  File "/home/utilisateur/.local/lib/python3.8/site-packages/chatgpt_wrapper/chatgpt.py", line 379, in main
    chatgpt = ChatGPT(headless=not install_mode)
  File "/home/utilisateur/.local/lib/python3.8/site-packages/chatgpt_wrapper/chatgpt.py", line 38, in __init__
    self.browser = self.play.firefox.launch_persistent_context(
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/sync_api/_generated.py", line 13091, in launch_persistent_context
    self._sync(
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/_impl/_sync_base.py", line 104, in _sync
    return task.result()
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/_impl/_browser_type.py", line 155, in launch_persistent_context
    from_channel(await self._channel.send("launchPersistentContext", params)),
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 44, in send
    return await self._connection.wrap_api_call(
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call
    return await cb()
  File "/home/utilisateur/.local/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 79, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: Executable doesn't exist at /home/utilisateur/.cache/ms-playwright/firefox-1364/firefox/firefox
╔════════════════════════════════════════════════════════════╗
β•‘ Looks like Playwright was just installed or updated.       β•‘
β•‘ Please run the following command to download new browsers: β•‘
β•‘                                                            β•‘
β•‘     playwright install                                     β•‘
β•‘                                                            β•‘
β•‘ <3 Playwright Team                                         β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Maybe the problem is that I am using a browser that is not chrome ?

Sorry, this may be a silly question, but if anyone could point me in the right direction ^^

Exception when using ChatGPT class

Followed the instructions, but running the example code gives this exception. I am able to use the chatgpt interactive shell though.

In [1]: from chatgpt_wrapper import ChatGPT

In [2]: bot = ChatGPT()
Starting ... Done

Traceback (most recent call last):
  File "/Users/delip/opt/anaconda3/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/IPython/__init__.py", line 123, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/ipapp.py", line 318, in start
    self.shell.mainloop()
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 680, in mainloop
    self.interact()
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 665, in interact
    code = self.prompt_for_code()
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/IPython/terminal/interactiveshell.py", line 604, in prompt_for_code
    text = self.pt_app.prompt(
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1020, in prompt
    return self.app.run(
  File "/Users/delip/opt/anaconda3/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 891, in run
    return loop.run_until_complete(
  File "/Users/delip/opt/anaconda3/lib/python3.9/asyncio/base_events.py", line 623, in run_until_complete
    self._check_running()
  File "/Users/delip/opt/anaconda3/lib/python3.9/asyncio/base_events.py", line 583, in _check_running
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

If you suspect this is an IPython 8.2.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

sys:1: RuntimeWarning: coroutine 'Application.run_async' was never awaited

Model arguments

Is there no way of passing arguments that configure the temperature, tokens, and even the model to be used?

unresponsive at prompt?

Discussed in #83

Originally posted by skytwosea February 2, 2023
Successfully installed last night. This afternoon, I have gone through the steps to activate the shell environment, but no response is delivered when submitting a prompt.

  1. activate my conda env & run chatgpt install
  2. sign in, click through prompts in browser, reach browser prompt. Browser prompt works.
  3. close browser window, !exit shell environment, restart shell env without install parameter. Program opens and sets a prompt: 1>
    .. but the prompt is unresponsive; nothing is returned when the prompt is submitted at enter.

I've restarted the shell, the conda environment, and my machine, and have updated the repo via git pull origin main, all to no avail; same problem, just completely unresponsive.

Any tips or suggestions? Any log files I can provide?
Kubuntu 5.15.0

ERROR: document.getElementById(...) is null

An unexpected error occurred while I sent some inputs

ERROR: document.getElementById(...) is null\\n@debugger eval code line 197 > eval:1:10\\nevaluate@debugger eval code:197:30\\n@debugger eval code:1:44\\n

nice to have feature: managing ChatGPT errors

Nice project! Thanks

It is a very useful workaround, until the ChatGPT will be available (now is not, using standard openai API).

BTW, maybe it could be useful to catch connection / load errors as tese in screenshot:

Cattura

thanks again
Giorgio

stuck with "Verify you are a human"

I keep getting this, even after clicking the blue button. I am guessing this is because Playwright opens this with the chromium window. How do I make this open with my usual Safari browser?

image

Immediate traceback after providing a prompt to ChatGPT after it hasn't been used in a while

I'm on Windows 10. After not having used the Chatgpt program for a while (several hours) when I first run it and provide a prompt, I get an immediate traceback, as follows:

Provide a prompt for ChatGPT, or type !help or ? to list commands.
1> What is a dog?
Traceback (most recent call last):
File "C:\python39\Scripts\chatgpt-script.py", line 33, in
sys.exit(load_entry_point('chatGPT==0.3.8', 'console_scripts', 'chatgpt')())
File "C:\python39\lib\site-packages\chatgpt-0.3.8-py3.9.egg\chatgpt_wrapper\chatgpt.py", line 570
, in main
File "C:\python39\lib\cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "C:\python39\lib\cmd.py", line 217, in onecmd
return func(arg)
File "C:\python39\lib\site-packages\chatgpt-0.3.8-py3.9.egg\chatgpt_wrapper\chatgpt.py", line 365
, in do_ask
File "C:\python39\lib\site-packages\chatgpt-0.3.8-py3.9.egg\chatgpt_wrapper\chatgpt.py", line 372
, in default
File "C:\python39\lib\site-packages\chatgpt-0.3.8-py3.9.egg\chatgpt_wrapper\chatgpt.py", line 107
, in ask_stream
File "C:\python39\lib\site-packages\chatgpt-0.3.8-py3.9.egg\chatgpt_wrapper\chatgpt.py", line 72,
in refresh_session
File "C:\python39\lib\site-packages\playwright\sync_api_generated.py", line 7697, in evaluate
self._sync(
File "C:\python39\lib\site-packages\playwright_impl_sync_base.py", line 104, in _sync
return task.result()
File "C:\python39\lib\site-packages\playwright_impl_page.py", line 407, in evaluate
return await self._main_frame.evaluate(expression, arg)
File "C:\python39\lib\site-packages\playwright_impl_frame.py", line 277, in evaluate
await self._channel.send(
File "C:\python39\lib\site-packages\playwright_impl_connection.py", line 44, in send
return await self._connection.wrap_api_call(
File "C:\python39\lib\site-packages\playwright_impl_connection.py", line 419, in wrap_api_call
return await cb()
File "C:\python39\lib\site-packages\playwright_impl_connection.py", line 79, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.Error: Execution context was destroyed, most likely because of a navigation

chatgpt install not working

When I run "chatgpt install" on Terminal (Mac) I get the following error:

zsh: command not found: chatgpt

BTW, I get the same error when I run "playwright install" and got around it by running "python3 -m playwright install"

Any help is appreciated!

zsh "no matches found" when `?` part of question

When running from zsh shell, chatgpt will not run if a question mark is part of the query.

chatgpt what is six times six?
zsh: no matches found: six?

My temp fix is setting alias chatgpt="noglob chatgpt" in my zshrc.

try/except on bad response

Hi! I saw that now wrapper response with message that it can't get response from ChatGPT. But now i wan't to handle this response, so something like:
try: bot.ask(text) except: bot = ChatGPT() ....
can you advice a way to handle this, because if i do so, i get async error.

Log is not properly written when the program tracebacks

I just had a situation where I sent a prompt, received a response, and probably when the response was complete, apparently ChatGPT failed to send whatever the program needs so it can know the response is complete. I was forced to terminate the process, resulting in a traceback. As a result, the log file was empty, this being my first prompt during the logged session. I don't know if this is possible, but it would be nice if the program handled these situations better, making sure anything it did receive before the traceback is properly logged.

Am logged in. Install not working. Session not working.

Am running chatgpt on exwm with gentoo. Chatgpt install brings up default playwright firefox nightly. Logged in. No menus or messages anything. Close up firefox. Rerun chatgpt. !session does not work. chatgpt does not work. Not sure how to debug this since my python experience is limited.

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

I installed it successfully, but 'chatgpt' command provided this error.

Traceback (most recent call last):
  File "~/Library/Python/3.9/bin/chatgpt", line 5, in <module>
    from chatgpt.cli import app
  File "~/Library/Python/3.9/lib/python/site-packages/chatgpt/__init__.py", line 1, in <module>
    from . import api
  File "~/Library/Python/3.9/lib/python/site-packages/chatgpt/api.py", line 11, in <module>
    from chatgpt import payloads
  File "~/Library/Python/3.9/lib/python/site-packages/chatgpt/payloads.py", line 5, in <module>
    message: str, id_: str, conv_id: str | None, parent_msg_id: str | None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

please log in to openai chat and accept the cookies box

~/dev/chatgpt-wrapper (main) $ chatGPT testing testing 123
Starting ... Please log in to OpenAI Chat and accept the cookies box
Press enter when you're done

not sure where the cookies box is.. so when i hit enter

Done
Asking...
Traceback (most recent call last):
  File "/usr/local/bin/chatGPT", line 33, in <module>
    sys.exit(load_entry_point('chatGPT==0.1.0', 'console_scripts', 'chatgpt')())
  File "/Users/user/dev/chatgpt-wrapper/chatgpt_wrapper/chatgpt.py", line 119, in main
    print(Fore.GREEN + chatbot.ask(" ".join(sys.argv[1:])))
  File "/Users/user/dev/chatgpt-wrapper/chatgpt_wrapper/chatgpt.py", line 95, in ask
    self.__send_message(message)
  File "/Users/user/dev/chatgpt-wrapper/chatgpt_wrapper/chatgpt.py", line 67, in __send_message
    box.click()
AttributeError: 'NoneType' object has no attribute 'click'

chatgpt install fails

I tried following the install instructions and when I say chatgpt install, a browser window appears for an instant and I get the following in the console:
playwright._impl._api_types.Error: SEC_ERROR_UNKNOWN_ISSUER
=========================== logs ===========================
navigating to "https://chat.openai.com/", waiting until "load"

Unusable responses after a session has expired

I just tried to use chatgpt this afternoon. Every time I'd send a prompt, I'd immediately get a message about the program receiving an unusable response from ChatGPT. Apparently at some point they'd expired my session, and even the Session command was unable to determine this, it kept saying the session appears to be usable. I had to do a chatgpt install and log in again, at which point it worked. Unfortunately I have no way of knowing just what response the program was receiving from ChatGPT, and since I've already logged in again, I can't debug this further.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.