DEV Community

Rachit Chawla
Rachit Chawla

Posted on • Updated on

Setting up ChatCraft.org 🤖

Thinking about artificial intelligence nowadays somewhere makes us think about NLP chatbots like chatgpt, but the truth is that AI is much more than NLP chatbots. For this semester as a part of another course OSD700, Open Source Development Project. I will be working on a chatbot for the next four months.

Why ChatCraft?

ChatCraft is a kind of R&D laboratory for exploring emerging technologies and techniques for working with LLMs. It will allow us to explore and build all kinds of interesting things together, from advanced UX (multi-modal prompting, voice assistants, mobile, etc.) to embedding native code in the web (run non-JS programming languages in the browser via WASM) to cloud computing (data syncing) to working with the latest AI models. Its not limited to just sending texts and getting reply, It also has functionality to explain things to us with diagrams/images. We are also planning to implement image and audio input and much more. It allows custom system prompt which gives us permission to setup various rules as per our needs.

Process of setting it up

Setting up chatcraft was not as straight forward as it seemed to. It required us an OpenAI key which was provided to us by the project owner. Thanks to him for that. The OpenAI key was encrypted with SOPS and we had to decrypt it using the readme.sops.md file provided which had the appropriate instructions.

Installing the Dependencies

# install prereqs
go install github.com/getsops/sops/v3/cmd/sops@v3.8.1
go install github.com/Mic92/ssh-to-age/cmd/ssh-to-age@latest
Enter fullscreen mode Exit fullscreen mode

I tried to install the required command line tools through the above commands as provided and it returned no error but sops still didn't work for me.

sops not working

The alternative I found of making it working was installing it through homebrew as that's the package manager I am using for my m1 mac. I successfully installed SOPS with the following command:

brew install sops
Enter fullscreen mode Exit fullscreen mode

Adding the user ssh key to sops.yaml

In order to get access for our ssh key we had to add the user to sops.yaml. I tried the running these commands and scripts provided to fetch my ssh key, encrypt it and verify if its in sops.yaml as an authorised user .

failed

Failed as my ssh key was not in the repo and it could not be validated. I contacted the project owner and he created a fix for this on another branch and now I already had myself as an added user to be able to decrypt the API key after validating my SSH.

Decrypting the Key

export SOPS_AGE_KEY=scripts/sops_age_key.sh

sops -d sops/keys.enc.yaml
Enter fullscreen mode Exit fullscreen mode

I was asked to used the above commands in order to decrypt the and then the yaml script with sops would return the decrypted key after validating my ssh.

The bash script sops_age_key.sh was fetching my ssh key locally and then encrypting it via age so that it can be matched with the one in github.

This didn't work as well for me. For some reason my SOPS_AGE_KEY variable didn't run the script and then get the key it just saved scripts/sops_age_key.sh as the value. I had to run the script manually and then store the value in SOPS_AGE_KEY to make it work.

Finally after all these running sops -d sops/keys.enc.yaml returned me with the valid key. I used the key in chatcraft.org and was able to use the chatbot.

ChatCraft

Thank you to my professor ( David Humphrey) and the project Owner ( Taras Glek) for this wonderful opportunity. Hoping to make some meaningful contributions over the term.

Top comments (0)