GithubHelp home page GithubHelp logo

ibm / clai Goto Github PK

View Code? Open in Web Editor NEW
477.0 23.0 73.0 131.85 MB

Command Line Artificial Intelligence or CLAI is an open-sourced project from IBM Research aimed to bring the power of AI to the command line interface.

Home Page: https://clai-home.mybluemix.net/

License: MIT License

Shell 9.02% Python 88.63% Dockerfile 1.74% Makefile 0.20% Gnuplot 0.40%
bash command-line artificial-intelligence machine-learning ibm-research ai ml

clai's Introduction

CLAI Logo

Command Line Artificial Intelligence CLAI is an open-sourced project aimed to bring the power of AI to the command line. Using CLAI, users of Bash can access a wide range of skills that will enhance their command line experience. This repository contains the source code and documentation to get you started.

Getting Started

Home See some examples of CLAI in action without installing locally. A great way to try out CLAI as a first step!

More A quick overview about the project.

Blog The public release about this project.

CLAI API Developer API for CLAI skills.

Community Join our online Slack community by clicking here!

FAQs Frequently Asked Questions (including those about security, contributing, and other common topics).

Feedback Link to a survey to help us improve our project going forward.

Whitepaper A paper describing how this all works.

News Latest news about the project.

Prerequisites

Installing CLAI Natively

  1. Open a Bash emulator or console.
  2. In the console navigate to the location of the CLAI project source code.
  3. Execute the necessary commands found in the preferred option below. You can specify the port with --port, the default is 8010

System Wide

$ sudo ./install.sh

In Fedora, Debian and Ubuntu, you need to install with this extra parameter:

$ sudo env "HOME=$HOME" ./install.sh

User Install

$ ./install.sh --user

In Fedora, Debian and Ubuntu, you need to install with this extra parameter:

$ env "HOME=$HOME" ./install.sh --user

In z/OS, you need to update your .bashrc, .profile, and .bash_profile.

After the installation is complete, you will be prompted to restart the shell before CLAI becomes active.

Uninstalling CLAI Natively

System Wide

To uninstall CLAI, execute the following command from the directory hosting the CLAI source code:

$ sudo ./uninstall.sh

In Fedora, Debian and Ubuntu, you need to uninstall with this extra parameter:

$ sudo env "HOME=$HOME" ./uninstall.sh

User Install

To uninstall CLAI, execute the following command from the directory hosting the CLAI source code:

$ ./uninstall.sh --user

In Fedora, Debian and Ubuntu, you need to uninstall with this extra parameter:

$ env "HOME=$HOME" ./uninstall.sh --user

As before, during installation, you will have to restart the shell for the changes to take effect.

Bringing up CLAI in a container

Follow these steps to try out CLAI inside a containerized environment. This may be useful while you are developing bots for CLAI or if you want to try out CLAI without affecting your host system. Start by building the Docker container as follows:

Mac OS

$ ./BuildDockerImage.sh

Fedora and Ubuntu

$ sudo ./BuildDockerImage.sh

Control flags: Note that you may have to run BuildDockerImage.sh without the --no-cache flag for kernel version below 4.4.0-173-generic (Trusty Tahr/ Ubuntu 14.04 LTS).

The end of a successful build process (this can take a while) should resemble the following output:

CLAI has been installed correctly, you need restart your shell.
Removing intermediate container 1644ed9c1046
 ---> b653fa2f2114
Successfully built b653fa2f2114
Successfully tagged claiplayground:latest

real	4m4.184s
user	0m0.309s
sys	0m0.271s

Once you have built the Docker image, you can run it locally or on a remote server with a copy of the docker image, by executing the following launch script. This script starts the CLAI-enabled container and sets up SSH forwarding from the physical host to the container.

Mac OS

$ ./RunDockerImage.sh
f61ce8a1c049f54d3a7fb8df5d00612d5c86f8c164049d0819c5fefea4142c7e

Fedora and Ubuntu

$ sudo ./RunDockerImage.sh
f61ce8a1c049f54d3a7fb8df5d00612d5c86f8c164049d0819c5fefea4142c7e

You can determine what port your docker container is using (numbers marked between asterisks) for the SSH server as follows. Note that the port is assigned automatically and will be distinct for each docker instance you are testing.

Mac OS

$ docker ps -a
CONTAINER ID   IMAGE               COMMAND            CREATED   STATUS   PORTS              NAMES
f61ce8a1c049   claiplayground   "/usr/sbin/init"   ---       ---      0.0.0.0:*32782*-   trusting_blackburn

Fedora and Ubuntu

$ sudo docker ps -a
CONTAINER ID   IMAGE               COMMAND            CREATED   STATUS   PORTS              NAMES
f61ce8a1c049   claiplayground   "/usr/sbin/init"   ---       ---      0.0.0.0:*32782*-   trusting_blackburn

Now you are ready to ssh into the docker container.

$ ssh root@localhost -p *32782* <--- replace by port number from above
The authenticity of host '[localhost]:32782 ([::1]:32782)' can't be established.
ECDSA key fingerprint is SHA256:dGxCC2kikyWVoRk9RHXgVvJUZoMHiFM8AQfF4wjhd38.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:32782' (ECDSA) to the list of known hosts.
root@localhost's password:
...
Research Docker Build.
nohup: appending output to 'nohup.out'
[root@f61ce8a1c049 ~]#

Interacting with CLAI

If you are not already in Bash, go into Bash by typing >> bash. You can continue interacting with a CLAI-enabled Bash as you would normally with Bash. At the core of CLAI is a set of skills that will show up in your interactions with the terminal if they are confident that they can improve your command line experience.

At any time, you can list the active skills by typing:

$ clai skills

You can activate (and install) a skill specifically by invoking:

$ clai activate <skill-name>

Or remove (and uninstall) a skill specifically by invoking:

$ clai deactivate <skill-name>

You can also start or stop the CLAI support as follows:

$ clai stop
$ clai start

Warning: If you attempt to stop CLAI and start it again too rapidly, it is possible that you have to wait several seconds for internal process cleanup (socket closing and recycling) before the CLAI process will start completely.

Configuring CLAI

If you want to allow CLAI to automatically execute commands without your explicit authorization and interaction, you can use the auto directive. Issuing the command again will toggle the auto-user mode on and off.

$ clai auto

If you wish to set which plugins are activated by default, you can set them in configPluging.json as follows:

{ ..., "default": ["skill_name_1", "skill_name_2", "skill_name_3"], ...}

You will need to reinstall CLAI and restart your shell for the changes to take effect.

Interaction Patterns

Your life on the terminal remains largely unaffected unless required by you or in reponsed to an error. Specifically, there are three ways in which CLAI skills may be invoked.

  • $ command This is usual life on Bash. A skill may or may not show up in the standard interaction depending on their self-determined confidence of their usefulness in the context of that interaction.
  • $ clai command This will invoke the CLAI skill with the highest confidence regardless of their confidence. Use this if you want to force CLAI to respond.
  • $ clai "skill-name" command This will invoke the given skill name regardless of its own confidence and the confidences of the other active skills. Use this if you want to force a particular skill in CLAI to respond.

In all three cases, the Bash will behave as normal if CLAI has nothing to respond. Generally, there are two ways in which a skill will come alive, as we describe next.

Response to Commands

A skill can respond to your command directly:

  • This could be an answer or command in response to something you typed into the terminal in natural language.
  • This could be an augmenation or fix to your command to make it work as intended.

Without the auto option (see above), a CLAI skill will always ask for your permission before executing an action on its own on your terminal.

Response to Execution

A skill can also respond the execution of your command:

  • This could be an addition to the stdout to provide you useful information about your task.
  • This could be a response to an stderr with a suggestion to fix the error or with useful troubleshooting information.

As before, CLAI skill will not execute without your permission unless auto mode is on.

🤖 Want to build your own skills?

fixit   nlc2cmd   helpme   howdoi   man page explorer   ibmcloud   tellina   dataxplore   gitbot   voice   gpt3

Project CLAI is intended to rekindle the spirit of AI softbots by providing a plug-and-play framework and simple interface abstractions to the Bash and its underlying operating system. Developers can access the command line through a simple sense-act API for rapid prototyping of newer and more complex AI capabilities.

Want to build your own skills? Get started with the CLAI API now!


The CLAI logo is available under the Free Art License. It has been adopted and modified from the Bash logo.

The fine people who developed and contributed to CLAI are listed on our authors page.

clai's People

Contributors

aboqasem avatar andrewcmhicks avatar dependabot[bot] avatar djfitzgerald avatar dowem avatar emishulovin avatar flipper83 avatar gildmi avatar imgbot[bot] avatar kpfadnis avatar ktalamad avatar madhavanpallan avatar mayankagarwal avatar stevemar avatar tathagatachakraborti avatar twinstar26 avatar wlei27 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

clai's Issues

Basic usage

I believe I installed it correctly but it doesn’t return a red “try:” message when I type in natural language.

I have done clai activate gpt3 and clai start but I still can’t figure out how to actually use it.

Could someone please help me?

Thanks

extending the State object

Crucial to the sense-act architecture for an AI agent is the State object that it can sense from the "environment" (in our case, the Bash). Depending on the requirements or most popular requests from the community, we will be extending the State object.

This thread is meant to track pending feature requests on this subject.

Screen Shot 2020-03-05 at 5 32 42 PM

The keyring library issue while installing in ubuntu 18.04

Issue:-
While locally installing clai the keyring library which forms one of the requirements
for some library gives the following error.

keyring_issue
Error:-
ModuleNotFoundError: No module named "keyring.util.escape"
Screenshot: - https://user-images.githubusercontent.com/9550258/73778696-9a9f1600-4759-11ea-9aec-42add7ffe7fb.png

Solution:- As after keyring version 15.0.0 they removed keyring.util.escape.
It can be solved running "pip3 install --upgrade keyring.alt"
Reference:- https://bugs.launchpad.net/usd-importer/+bug/1794041\

non-blocking call to Rasa server

Feature description
Currently, gitbot requires launching the Rasa server seperately.

Solution 1: Be able to do something like rasa_nlu but I could not replicate the classification result with the old models.

Solution 2: Make a non-blocking call to the Rasa server in the install script -- not ideal coz this will keep the server up for eternity even if the skill is not active (we can make a kill call in the destruction code for the Agent class though).

Acceptance criteria
The user should not need to manually launch a different script.

CLAI removes single quotes from command

Describe the bug
When calling a command with single quotes, those single quotes are removed when inserted back into the history. For example:

echo 'hello world'

enters the history as:

echo hello world

I strongly suspect this is linked to Issue #60.

To Reproduce
Steps to reproduce the behavior:

  1. Execute the command echo 'hello world'
  2. Use your up arrow to see the last command entered
  3. That command will be echo hello world

Expected behavior
Instead, the last command executed should be echo 'hello world'

Screenshots
If applicable, add screenshots to help explain your problem.

Log file
If you found an error or an unexpected behaviour. It's useful for us the server log. You can find it in /var/tmp/app.log please attach it to the issue or copy and paste last lines.

shell and OS (please complete the following information):

  • OS: z/OS
  • Shell bash
  • Version 4.3.48(2)

Additional context
I've done some debugging on the problem, and it looks like bash-preexec.sh is getting this line as:

__bp_in_prompt_command 'echo '\''hello world'\'''

when it really should be:

__bp_in_prompt_command 'echo \'hello world\''

bash-preexec.sh is getting this from the shell variable $BASH_COMMAND, so maybe bash itself is causing the problem.

Design parsing module

It would be beneficial if clai has a parsing module which will effectively parse input as well as output and will perform following operations:-

  • Will try and hide as much user sensitive data as possible by replacing data with an anonymous token.
  • Will also solve #3 .
  • Might be useful in orchestration layer.

So I have prepared an example in short period of time of how this will work over here (latest commit).

Suggestions/Feedback/Discussions are welcome!!

Zsh support?

Feature description
I am a zsh user. I'd like to be able to use CLAI without switching my shell

Acceptance criteria

  1. Works with zsh

If you had any direction into how to make this happen, I could try a pull request but I'm not the most experienced CLI developer.

Thanks!

Latency / Throughput Problems + Terminal Issues

Describe the bug
I am currently using the x-terminal for Ubuntu Linux on an Acer Chromebook 14, model CB3-431. I am currently using the nlc2cmd skill.

When I open a new terminal window on the terminal emulator, everything works fine occasionally, but then commands stop functioning. Sometimes it does not work at all when I run a query.

I also have problems with the throughput of client-server access/response time. Although I do not run a test of the elapsed time for this, I know this could be Watson taking longer than usual. Does CLAI use a centralized REST protocol or decentralized (i.e., storage of cache packets is permissible to reduce latency)?

To Reproduce
Steps to reproduce the behavior:

  1. Go to new terminal window
  2. Run a query, like "how do I compress a directory into a bz2 file"
  3. Reproducible error: "bash: how: command not found

Expected behavior
Expecting to see a usage statement. I have the auto mode enabled, as can be seen in screenshot.

Screenshots
link to screenshot

shell and OS (please complete the following information):

  • OS: Ubuntu 20.04
  • Shell bash
  • Version 4.4.20(1)-release

Error with 'Try without installation.'

Describe the bug
The Try without installation. at https://clai-home.mybluemix.net/ never resolves.

image

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://clai-home.mybluemix.net/'
  2. Click on 'Try without installation' terminal located to the right of the screen.
  3. Enter 'clai skills'
  4. The web terminal never responds.

Expected behavior

Andrews-MBP-3:clai achicks$ clai skills
Available Skills:
◻ fixit (Not Installed)
◻ helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
◻ nlc2cmd (Installed)
◻ onboarding (Not Installed)

Screenshots
image

Log file
N/A

shell and OS (please complete the following information):

  • OS: [Brave Web Browser (Chrome variant)]
  • Shell [N/a]
  • Version [N/A]

Additional context
N/A

Command crash when have parentheses

Describe the bug
We have a bug when the command has parentheses. The problem is that we need to split the command by pipes to execute one to one with CLAI and the paraentheses broken the commands. It's really complex right now to fix because we need a lex analyzer :S

To Reproduce
Steps to reproduce the behavior:

  1. Write command with parentheses (ls | grep hi) | grep .

Expected behavior
process the command without break it.

shell and OS (please complete the following information):

  • OS: all
  • Shell all

migrate to Pipfile/.locl

Feature description
pinning python modules to a specific version in a requirements.txt seems to be a not-good practice. Migrating dependency management to a Pipfile (and a Pipfile.lock) would help in keeping the application stack more concise.

Acceptance criteria

  1. requirements.txt is removed in favour of Pipfile

@fridex

planutils integration

planutils integration 😎

  • a skill to navigate IPC events?
  • running experiments on benchmarks for papers.
  • answering questions on planner properties.

More uses cases to be figured out.

UnboundLocalError: local variable 'data' referenced before assignment in nlc2cmd/wa_skills/tarbot.py

Describe the bug
UnboundLocalError: local variable 'data' referenced before assignment in nlc2cmd/wa_skills/tarbot.py

To Reproduce
Steps to reproduce the behavior:

  1. start clai
  2. intent should be related to compression or extraction

output
# cat nohup.out
Exception in thread Thread-8:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/local/share/clai/bin/clai/server/plugins/nlc2cmd/service.py", line 24, in __compute
result.append( eval('wa_skills.' + args[0])(args[1]) )
File "/opt/local/share/clai/bin/clai/server/plugins/nlc2cmd/wa_skills/tarbot.py", line 157, in wa_skill_processor_tarbot
return data, confidence
UnboundLocalError: local variable 'data' referenced before assignment

shell and OS (please complete the following information):

  • OS: linux
  • Shell bash
  • Version python 3.6.x

Additional context

how to solve
When this else statement is triggered, data is not defined before hitting this line and we are returning data in the next statement. So we need to define default value of data.

local NLC layer

As we noted in Local versus external services: pros and cons? there are several advantages to be had for having skills local, including 1) being able to adapt to individual users and machines 2) latency of response 3) security and privacy, 4) connectivity issues, and so on.

This issue tracks conversion of the nlc2cmd use case to a local NLC layer. @MayankAgarwal can you look at what lightweight NLC options we can use? Going with Rasa.

integration test update

The integration tests for the skills are currently mixed up. It is hard to tell if a skill is working
as expected versus if the responses of the skills are orchestrated differently so as the output does not actually show up.

  • Invoke all tests for the skills with >> clai "skill name" <sample command>
  • Have the current tests as additional ones for different kinds of orchestrators.

Support CLAI execution in Windows container (and Windows OS local environment)

Feature description
Many developers still work in a Windows environment. Certain industry projects are also built on a Windows platform/Azure stack. Despite the fact that the Windows container image is larger than most OS images, there are older projects which will utilize it as they "transition to the cloud".

CLAI is currently deployable with MacOS/Ubuntu & Fedora images. It would be nice if it can also be executable with Window images.

Acceptance criteria

  1. Deployment of CLAI in Windows container is enabled with most (if not all) capabilities currently available for other OS.
  2. Instructions for users are updated.

installer for emulator

Describe the bug
The Emulator has unmet dependencies.

To Reproduce
Screen Shot 2020-03-17 at 6 16 59 PM

@flipper83 I imagine you wanted to keep the emulator separate from CLAI installation? Should there be a separate installer for the Emulator?

Preference based orchestration model

A new orchestration module which:

  • Let's the user specify a partial order over the skills in a configuration file.
  • Defaults to the max orchestration pattern if not part of specified preferences.

Setting appropriate flag for pip install

Describe the bug
When install.sh hits the line python3 -m pip install -r requirements.txt, the following pip install error message pops up. ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. For my particular case wrapt was causing problems but can be any other package.

To Reproduce
Steps to reproduce the behavior:

  1. Hit $ sudo ./install.sh on terminal.

shell and OS (please complete the following information):

  • OS: Linux

Additional context
pip cannot properly remove packages installed by "pure" distutils, because distutils doesn't record enough metadata for us to do so. If you installed a package using distutils, you need to manage (and in particular) uninstall it "using distutils". Unfortunately distutils doesn't include an uninstall command, so "uninstall using distutils" means manually removing the package.

This issue can be solved by using --ignore-installed flag. Some users have also temporarily resolved by using --user flag. But --ignore-installed worked for me.

Improve clai's performance when disconnected form the internet.

Feature description
When using clai with suboptimal or no internet, clai could auto-detect via ping 8.8.8.8 that the connectivity state is poor or dead, and not try to connect to the clai server and hang the terminal for 3 seconds. Instead, clai could log commands issued during the outage and send them over once connectivity is re-established.

Acceptance criteria

  1. When internet access is disconnected, clai does not try to connect to the remote server.

Calling clai skills with single quotes picks up entire line as command

Describe the bug
When calling a CLAI skill in double quotes, the text following the double quotes is passed to the skill that is in the double quotes. For example: clai "helpme" nfs will pass the command nfs as input to the helpme skill.

When doing the same thing with single quotes the operation is different. clai 'helpme' nfs passes the command clai helpme nfs as input to CLAI. The helpme skill is never run, and instead we get a CLAI usage message.

To Reproduce
Steps to reproduce the behavior:

  1. use tail -f to look at the end of the logfile
  2. Enter the command clai "helpme" nfs
  3. Observe the log entries
  4. Enter the command clai 'helpme' nfs
  5. Observe the log entries

Expected behavior
The same behavior should happen for clai 'helpme' nfs as happens for clai "helpme" nfs. That is, the helpme skill should be invoked and look up information on the keyword "nfs".

Screenshots
If applicable, add screenshots to help explain your problem.

Log file
issue 89 example.log

shell and OS (please complete the following information):

  • OS: x86_64 RedHat Linux
  • Shell bash
  • Version GNU bash 4.2.46(2)

importlib-metadata version error

Version error while installation on Catalina (I guess this was introduced on adding support for Python 3.8?)

ERROR: catalogue 0.0.8 has requirement importlib-metadata>=0.20; python_version < "3.8", but you'll have importlib-metadata 0.17 which is incompatible.

There are no issues labeled "good first issue"

Feature description

This project could enhance its open-source presence by having issues that could be approached by newcomers

Acceptance criteria

  1. Criteria for check the issue is complete.
  2. Criteria for check the issue is complete.

The bash built-in 'shopt' functionality is suppressed by clai

Describe the bug
When using Clai, the shopt functionality is suppressed and stops working.

To Reproduce
Steps to reproduce the behavior:

With Clai Active

Andrews-MBP-3:~ achicks$ shopt -s cdspell
Andrews-MBP-3:~ achicks$ shopt | grep cdspell
cdspell        	on
Andrews-MBP-3:~ achicks$ cd clay
-bash: cd: clay: No such file or directory

Expected behavior

Andrews-MBP-3:git achicks$ pwd
/Users/achicks/git
Andrews-MBP-3:git achicks$ ls | grep clai
clai
Andrews-MBP-3:~ achicks$ cd clay
clai
Andrews-MBP-3:clai achicks$ pwd
/Users/achicks/git/clai

shell and OS (please complete the following information):

  • OS: [MacOS]
  • Shell [bash]
  • Version [5.0]

Installation error with `typed-ast` version

Describe the bug
Installation error with typed-ast version.

ERROR: mypy 0.750 has requirement typed-ast<1.5.0,>=1.4.0, but you'll have typed-ast 1.3.5 which is incompatible.
ERROR: black 19.10b0 has requirement typed-ast>=1.4.0, but you'll have typed-ast 1.3.5 which is incompatible.

Log file

log.txt

handling orchestrator options

Currently, the orchestration patter is specified in code [link]

  • We should move it to a config file -- configPlugins.json -- where the user can specify which orchestration pattern to use (and potentially install) at the time of installing CLAI.

  • Add command line option to change this option at runtime: e.g. >> clai orchestrate max_orchestration (this might require installing dependencies of the new pattern)

Clai does not work with python 3.8.1

Describe the bug
Clai does not work with python 3.8.1 but Clai prerequisite mentions python 3.6.x + versions

To Reproduce
Steps to reproduce the behavior:

  1. Install python 3.8.1
  2. Install Clai
  3. Restart terminal
  4. Bash commands don't work

output from terminal
# ls
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/util.py", line 277, in _run_finalizers
finalizer()
File "/usr/local/lib/python3.8/multiprocessing/util.py", line 201, in call
res = self._callback(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 689, in _terminate_pool
cls._help_stuff_finish(inqueue, task_handler, len(pool))
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 674, in _help_stuff_finish
inqueue._rlock.acquire()
KeyboardInterrupt
Process ForkPoolWorker-2:
Process ForkPoolWorker-4:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 356, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.8/multiprocessing/queues.py", line 356, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt

^C
#

note that I have waited for full 2 minutes before hitting CTRL+C.

shell and OS (please complete the following information):

  • OS: Linux
  • Shell: bash
  • Version: Python 3.8.1

Having problems setting up CLAI container in Ubuntu 14.0.4

Describe the bug
I am trying to follow the steps mentioned in the README to set up the CLAI container on my Ubuntu 14.0.4 system (Linux en4119722l 4.4.0-75-generic #96~14.04.1-Ubuntu and Docker version 1.6.2, build 7c8fca2), but the command BuildDockerImage.sh is failing while reporting missing flags

To Reproduce

clai$ sudo ./BuildDockerImage.sh
===============================================================

 Phase 1: Building CLAI Container --no-cache

===============================================================
docker: "build" requires 1 argument. See 'docker build --help'.

real	0m0.016s
user	0m0.016s
sys	0m0.000s
Failed to build CLAI Playground Container. Aborting Build.

emulator requirements

Hi @flipper83 I had some issues getting the emulator started:

  • File name requirements-emulator.sh ➡️ requirements-emulator.txt
  • Dependency issues:
ERROR: watson-developer-cloud 2.4.0 has requirement websocket-client==0.47.0, but you'll have websocket-client 0.57.0 which is incompatible.
ERROR: ibm-watson 4.0.1 has requirement websocket-client==0.48.0, but you'll have websocket-client 0.57.0 which is incompatible.
  • File error
Traceback (most recent call last):
  File "emulator.py", line 16, in <module>
    emulator.launch()
  File "/Users/tathagata/clai/clai/emulator/clai_emulator.py", line 44, in launch
    self.add_toolbar(self.root)
  File "/Users/tathagata/clai/clai/emulator/clai_emulator.py", line 165, in add_toolbar
    self.add_refresh_button(toolbar)
  File "/Users/tathagata/clai/clai/emulator/clai_emulator.py", line 192, in add_refresh_button
    self.refresh_image = tk.PhotoImage(file=f"{path}/refresh.png")
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3545, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3501, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "/Users/tathagata/clai/clai/emulator/refresh.png"
  • **optional** Deprecation warning:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

Run Clai as a Daemon rather than a Background Process

Feature description
Currently, clai.sh starts the server as a background process. This becomes an issue when attempting to uninstall the program, the processes are not shutdown but instead the source code directory is removed. This leaves the processes as zombies. To properly handle running the processes we can create a Daemon class that records the PID on startup. The PID can then be referenced later for shutting down.

Acceptance criteria

  1. Clai uninstall no longer leaves the processes as zombies.

Clai command responds before Clai Server is running.

Describe the bug
The clai server accepts commands before the server is correctly configured to issue installs.
To Reproduce
Steps to reproduce the behavior:

  1. Install clai
  2. clai activate <skill>
  3. clai deactivate <skill>
  4. clai stop
  5. clai start
  6. clai activate <--issue quickly.

Observed behavior
The / and | in the beginning is just the clai logo being formatted incorrectly by git.

/ | | | /\ | |
| | | | / \ | |
| | | | / /\ \ | |
| | | |____ / ____ \ | |
_| || // _\ |____|

nohup: appending output to ‘nohup.out’
[root@623acef53b3a ~]# clai skills
Available Skills:
◻ fixit (Not Installed)
◻ helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
☑ nlc2cmd (Installed)

[root@623acef53b3a ~]# clai activate helpme
Available Skills:
◻ fixit (Not Installed)
◻ helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
☑ nlc2cmd (Installed)

[root@623acef53b3a ~]# clai activate helpme
Available Skills:
◻ fixit (Not Installed)
◻ helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
☑ nlc2cmd (Installed)

Wait for 2 -3 minutes

[root@623acef53b3a ~]# clai activate helpme
Available Skills:
◻ fixit (Not Installed)
☑  helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
☑ nlc2cmd (Installed)

Expected behavior

[root@623acef53b3a ~]# clai activate helpme
Available Skills:
◻ fixit (Not Installed)
☑  helpme (Not Installed)
◻ howdoi (Not Installed)
◻ ibmcloud (Not Installed)
◻ man page explorer (Not Installed)
☑ nlc2cmd (Installed)

shell and OS (please complete the following information):

  • OS: [MacOS & z/OS]
  • Shell [Bash]
  • Version [5.0 & 4.3]

Docker build fail on MacOS 12 on Apple Silicon (M1)

I have cloned the repo and just start ./BuildDockerImage.sh (does not matter if executing with or without sudo). No matter which terminal I use (zsh or fish in my case) - it fails with

#20 71.37     Traceback (most recent call last):
#20 71.37       File "<string>", line 1, in <module>
#20 71.37       File "/tmp/pip-build-5basj87q/cryptography/setup.py", line 14, in <module>
#20 71.37         from setuptools_rust import RustExtension
#20 71.37     ModuleNotFoundError: No module named 'setuptools_rust'
#20 71.37
#20 71.37     ----------------------------------------
#20 71.59 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5basj87q/cryptography/
------
executor failed running [/bin/sh -c if [ "$jenkinsbuild" = "true" ] ; then         sudo pip3 install -r requirements.txt -r requirements_test.txt ;     else         sudo pip3 install -r requirements.txt ;     fi     && sudo python3 install.py --unassisted --shell bash]: exit code: 1

image

shell

  • OS: macOS 12.1 (21C52)
  • Shell: zsh or fish

Is the project abandoned?

I cannot see any new commits for 3 years, the README doesn't say anything either. This seems promising but gives me errors, instead of writing an issue I thought it'd be more appropriate if I just asked.

If it is abandoned, do you know an alternative? I'd really like to use AI on my CLI.

StopDockerImage.sh obsolete

The StopDockerImage.sh script is obsolete. It relies on an assumption that all CLAI containers are built from an ancestor named CLAIPlaygroundContainer, which is no longer the case.

executable suggestions for pro users

Feature description

For many CLAI skills, pro users would like a mode where a skill returns its output to a new line in the terminal, but does not send a return. This will allow the user to edit the command prior to executing it, and enables another assistant-like interaction pattern.

For example, the nlc2cmd skill, with this feature turned on, would have the option of populating the suggestion (Try >> suggestion) into the terminal window / command prompt following the return from CLAI, i.e.

/> suggestion

This would allow the user to edit the contents of the suggestion before deciding to execute or not. This is an enhancement of the current y/n/e mode that we provide.

Acceptance criteria

  1. CLAI is able to auto-populate a returned suggestion on to the prompt; and
  2. There is a mode that can be enabled for getting the above behavior.

This suggestion from David MacMillan at the ICML 2020 IBM Booth.

make CLAI faster

Since the CLAI platform tries to instrument the command line to the most generic extent possible for different kinds of AI agents, it is understandably slow for any specific use case.

That being said, we welcome any contributions to make it faster (targeting any part of the code). Some ideas rolling around:

  • have post_execution only: that way we can still respond to the user commands after the fact, after a bash command failure prompt for natural language commands for example, but users don't have to wait for execution of normal commands this way. Maybe a new mode for CLAI where the pre-execution processing can be turned off?

  • remove remote calls to the extent possible. iss31

  • other ideas welcome 😃

stderr from python (and possibly other apps) not logged on screen

Describe the bug
When running python in clai enabled terminal, the stderr is not logged on the screen.
Only when the python session is closed, all the stderr is logged back

To Reproduce
Steps to reproduce the behavior:

  1. Start clai enabled terminal
  2. Start python
  3. Run some command that should give error
  4. The error is not logged on the screen
  5. Run exit(). All the errors from previous executions can now be seen

Expected behavior
python should behave as it does on other terminals

Screenshots
36773c80-fca8-11e9-9339-97e877ba359a

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.