Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
JupyterJuliaLaTeXLinuxOctavePythonR StatsSageMathSlidesTeachingTerminalWhiteboardX11ComputeAI AssistCompareAPI
CoCalc Logo Icon
JupyterJuliaLaTeXLinuxOctavePythonR StatsSageMathSlidesTeachingTerminalWhiteboardX11ComputeAI AssistCompareAPI
Sign in or sign up to use ChatGPT.

AI Assistance

AI assistance in CoCalc
AI assistance in a CoCalc

CoCalc integrates large language models such as OpenAI's ChatGPT or Google's Gemini 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

  • Understand a vast array of programming languages.
  • Generate context-specific code based on your input.
  • Interpret error messages, providing insightful suggestions.
  • Enhance code quality by modifying your provided code snippets.
  • Virtual assistant

  • These language models, as virtual assistants, rectify bugs, comprehend and write code across many programming languages in a very convenient way.
  • They are capable of appending documentation to code.
  • They can even build upon existing code based on provided directives.
  • AI language models in CoCalc

    There are various places where AI assistants appears in CoCalc, as illustrated below and explained in the docs.
    CoCalc currently supports the following language models:

    Help fixing code

    ChatGPT explains an error message and fixes 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 @chatgpt in any Chatroom in CoCalc

    ChatGPT generates code in a chatroom
    Here, a user learning PyTorch asks ChatGPT by mentioning @chatgpt in a Side Chat. The prompt is:
    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.
    Running code snippet generated by ChatGPT
    Note: Mention @gemini to talk to Google's Gemini model.

    Generate Jupyter Cells

    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:
    ChatGPT cell prompt in Jupyter Notebook

    Generating Code

    Gemini generates C++ code in a file


    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:
    Write a short C program, which iterates over all numbers from 0 to 100 and sums up those, which are divisible by 7!
    After the code is generated, we copy it into thec-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 LaTeX\LaTeX

    Help with LaTeX
    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.
    ChatGPT generates LaTeX code for Maxwell equations
    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.
    ChatGPT helps with LaTeX error messages
    Start free today. Upgrade later.