AI Assistant
AI Assistant in CoCalc
CoCalc integrates large language models including OpenAI's ChatGPT, Google's Gemini, Anthropic's Claude, and Mistral as virtual assistants. They generate human-like responses and code, assist with programming, explain error messages, and ultimately making it easier for you to get your work done.
Help with coding
Virtual assistant
AI language models in CoCalc
There are various places where an AI Assistant appears in CoCalc, as illustrated below and explained in the docs.
CoCalc currently supports the following language models:
Help fixing code
In this example, a code cell in a Jupyter Notebook returned an error. Clicking the botton to explain the error message creates a message addressed to ChatGPT, which asks for help and to fix the code.
With enough context – the few lines of input code and the lines in the stacktrace – it will attempt to fix the code for you. The fix might not be perfect, but it can be a good starting point.
Mention AI models in any Chatroom in CoCalc
multiply two random matrices in pytorch
Sure enough, ChatGPT generates code that does exactly that. By copying that simple example into your Jupyter Notebook, the user can immediately run it and continue to play around with it.
Note: Use @ also to talk to Google's Gemini model.
Generate Jupyter Cells
In a Jupyter Notebook, you can tell a language model to generate a cell for you. This is useful if you want to explore a topic, but don't know where to start. In the example on the left, we ask ChatGPT to generate a cell for us about a linear regression for a stochastic process:
Generating Code
Write a short C program, which iterates over all numbers from 0 to 100 and sums up those, which are divisible by 7!
ChatGPT or Gemini can also generate source code for you. In the example displayed on the left, we first create an empty file named
c-program.cpp
in C++. Next, we open the AI Assistant dialogue and prompt it to generate some code:After the code is generated, we copy it into the
c-program.cpp
file as depicted. To compile and run the C++ program, we use the clang++
compiler provided in the Frame Editor's Terminal.Help with
Writing documents in the typesetting language LaTeX can be challenging. In the example on the left, we ask ChatGPT to generate the LaTeX formulas for the Maxell equations. Sure enough, it answers with a short explanation and a snippet of LaTeX code.
On top of that, it can even assist you in fixing LaTeX error messages. the "Help me fix this…" button, and CoCalc will submit the error message, some context, and a prompt for correction. This will provide you with a useful indicator of the issue and potential solutions.
Start free today. Upgrade later.