Centre d'apprentissage

Setting Up Chatbot Within COMSOL Multiphysics®


You can interact with a chatbot from within the COMSOL Multiphysics® software using the Chatbot window. This functionality enables you to:

  • Send general inquiries
  • Generate and debug COMSOL API for Java code
  • Ask questions about modeling with the COMSOL Multiphysics® software

Currently, OpenAI is the only supported provider, and the Chatbot window is only available for Windows® operating systems. In this article, we will cover how to set up and enable the chatbot tool.

Note: The Chatbot window is not included by default when you install COMSOL Multiphysics. You must manually opt to install it before it can be accessed within the software.

A UI screenshot of the Model Builder with the Chatbot window open and the Configure OpenAI API Key dialog open, prompting you to enter an API key to start using the chatbot. A UI screenshot of the Model Builder with the Chatbot window open and the Configure OpenAI API Key dialog open, prompting you to enter an API key to start using the chatbot.

COMSOL Multiphysics with the Chatbot window opened (bottom right) and the corresponding Configure API Key dialog open (center). After supplying the API key, the chatbot can be used.

Installing the Chatbot

Before configuring the settings in the software to use the chatbot tool, you must first choose to install chatbot components. By default, the components are not selected to be included in your installation of COMSOL Multiphysics. To include chatbot components, check the Chatbot Components option in the Select products to install window of the Products tab of the COMSOL Installer.

A UI screenshot of the COMSOL Installer with the Products tab selected and the Chatbot Components checkbox highlighted.

A screenshot of the COMSOL Multiphysics 6.3 Installer with the Products tab open and the Chatbot Components checkbox highlighted.

When you have selected the Chatbot Components checkbox, you can resume the remaining steps to complete your installation of the COMSOL® software. The installation process will vary slightly depending on whether you are updating your currently existing installation of COMSOL Multiphysics versus upgrading your installation to a new major version. Further details on the distinction between these variants and how to install the software are available here: "COMSOL® Installation Companion".

Note: The chatbot is only available for installation for COMSOL Multiphysics version 6.3.

Following this step, you will need to obtain an API key from an AI model platform (OpenAI, currently) to enable use of the chatbot in the software. This process will vary slightly depending on if you access the AI model from a personal account or a corporate account. See the respective instructions below on how to obtain an API key and configure the Chatbot window.

Obtaining Your Personal Account API Key

OpenAI

The following process is valid for scenarios where there is no centralized management of the OpenAI platform in your organization and you are allowed to use your own personal account:

  1. Register or Log In
    • Start by visiting the OpenAI Platform. Sign up, or log in if you already have an account. Note that OpenAI's API is a separate product from ChatGPT®. Registering for an account may require a valid phone number and email.
  2. Set Your Organization
    • Optionally, go to the Settings menu and under the Organization section, set your organization profile according to the instructions provided by OpenAI. The provided name will be displayed in the upper-left corner of the OpenAI Platform web interface. For demonstration purposes, in the screenshots below the displayed organization name is COMSOL. Note, however, that COMSOL does not provide the API key subscription. You would need to provide your own organization's name here.
  3. Set Up Billing
    • The OpenAI API is a pay-as-you-go service. As a result, to use the chatbot tool within COMSOL Multiphysics you must add a valid payment method and top up your credit balance. To do this, go to the Billing section under the Settings menu and follow the provided instructions.
The billing settings are shown after logging into an account on the OpenAI Platform web interface. The billing settings are shown after logging into an account on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the menu to create a new project opened.

  1. Create New Project
    • Optionally, in the upper-left corner of the OpenAI Platform web interface, click on the Project field, which is next to the organization name. Select the +Create project button and create a new project devoted to chatbot-related tasks. For demonstration purposes, in the screenshots below the custom project name is "for COMSOL".
The OpenAI Platform web interface with a pop-up window that prompts you to enter a name to create a new project. The OpenAI Platform web interface with a pop-up window that prompts you to enter a name to create a new project.

A screenshot of the OpenAI Platform web interface with the menu to create a new project opened.

  1. Generate the API Key
A pop-up window that prompts you to enter a name to generate a new secret API key is shown on the OpenAI Platform web interface. A pop-up window that prompts you to enter a name to generate a new secret API key is shown on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the menu to generate a new secret API key opened.

  1. Configure the API Key in COMSOL Multiphysics
    • Open a session of COMSOL Multiphysics. From the Home ribbon tab, under the Windows button, select Chatbot to open the Chatbot window. Copy the API key generated from the OpenAI Platform and paste it into the Configure OpenAI API Key dialog within the Chatbot window in COMSOL Multiphysics. Click OK.

You are now ready to use the Chatbot window in the software.

A UI screenshot of the Model Builder where the Chatbot window is opened and a general conversation has been initiated. A UI screenshot of the Model Builder where the Chatbot window is opened and a general conversation has been initiated.

COMSOL Multiphysics with the Chatbot window configured with an OpenAI API key. You can update or change the API key later from the Preferences window.

Obtaining Your Corporate Account API Key

OpenAI

The following process is valid for scenarios where there is centralized management of the OpenAI Platform in your organization and you are supposed to be connected to a corporate account. For these cases, most steps should be performed by a manager of the corporate account; the other steps should be taken by a designated COMSOL Multiphysics user. The process listed below indicates who should perform each step. The first four steps are identical to that of when obtaining a personal account API key but should be performed by the manager.

  1. Register or Log In (manager)
    • Start by visiting the OpenAI Platform. Sign up, or log in if you already have an account. Note that OpenAI's API is a separate product from ChatGPT®. Registering for an account may require a valid phone number and email.
  2. Set Your Organization (manager)
    • Optionally, go to the Settings menu and under the Organization section, set your organization profile according to the instructions provided by OpenAI. The provided name will be displayed in the upper-left corner of the OpenAI Platform web interface. For demonstration purposes, in the screenshots below the displayed organization name is COMSOL.
  3. Set Up Billing (manager)
    • The OpenAI API is a pay-as-you-go service. As a result, to use the chatbot tool within COMSOL Multiphysics you must add a valid payment method and top up your credit balance. To do this, go to the Billing section under the Settings menu and follow the instructions provided.
The billing settings are shown after logging into an account on the OpenAI Platform web interface. The billing settings are shown after logging into an account on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the Billing section of the settings opened. A valid payment method is added and the credit balance is recharged.

  1. Create New Project (manager)
    • Optionally, in the upper-left corner of the OpenAI Platform web interface, click on the Project field, which is next to the organization name. Select the +Create project button and create a new project devoted to chatbot-related tasks. For demonstration purposes, in the screenshots below the custom project name is "for COMSOL".
A pop-up window that prompts you to enter a name to create a new project is shown on the OpenAI Platform web interface. A pop-up window that prompts you to enter a name to create a new project is shown on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the menu to create a new project opened.

  1. Invite Team Members (manager)
A pop-up window that prompts you to enter an email address and specify a role for team members you want to invite to the new project created on the OpenAI Platform web interface. A pop-up window that prompts you to enter an email address and specify a role for team members you want to invite to the new project created on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the dialog to invite a new team member to an organization.

  1. Accept Invite and Register or Log In (COMSOL Multiphysics user)
    • Accept the invitation sent by the corporate account manager to your email. In the OpenAI Platform, sign up, or log in if you already have an account. Note that OpenAI's API is a separate product from ChatGPT®. The registration may require a valid phone number and email.
  2. Add Members to Project (manager)
    • In the OpenAI Platform, select the project devoted to tasks related to COMSOL Multiphysics. Go to Settings, then Project, and in the Members section, click the +Add Member Button operation. Select an appropriate team member from the menu and click the Add button. Note that only the names of members who have already accepted an invitation and have an OpenAI Platform account are displayed. Choose an appropriate role following the instructions provided by OpenAI.
A pop-up window that prompts you to add team members to the new project created on the OpenAI Platform web interface. A pop-up window that prompts you to add team members to the new project created on the OpenAI Platform web interface.

A screenshot of the OpenAI Platform web interface with the dialog to add a new team member to a project.

  1. Generate the API Key (COMSOL Multiphysics user)
    • In the OpenAI Platform web interface, select your organization and the project you have been added to. Then, go to the Dashboard menu and select the API keys section. Click the +Create new secret key button, and then click the Create secret key option.
The OpenAI Platform web interface showing a pop-up window that prompts you to enter a name to generate a new secret API key. The OpenAI Platform web interface showing a pop-up window that prompts you to enter a name to generate a new secret API key.

A screenshot of the OpenAI Platform web interface with the menu to generate a new secret API key.

  1. Configure the API Key in COMSOL Multiphysics (COMSOL Multiphysics user)
    • Open a session of COMSOL Multiphysics. From the Home ribbon tab, under the Windows button, select Chatbot to open the Chatbot window. Copy the API key generated from the OpenAI Platform and paste it into the Configure OpenAI API Key dialog within the Chatbot window in COMSOL Multiphysics. Click OK.

You are now ready to use the Chatbot window in the software.

A UI screenshot of the Model Builder where the Chatbot window is opened and a programming conversation has been initiated. A UI screenshot of the Model Builder where the Chatbot window is opened and a programming conversation has been initiated.

COMSOL Multiphysics with the Chatbot window configured and displaying part of a conversation. Here, the generated code can easily be sent to the Java Shell window, where it can be run to define a new Analytic function node in the model tree.

Updating Your Chatbot Preferences in COMSOL Multiphysics®

In addition to using the Configure OpenAI API Key dialog within the Chatbot window in COMSOL Multiphysics, you can optionally also configure use of the chatbot by updating your preferences in the software. To do so, under the File menu, select Preferences. From there, select the Chatbot page.

A UI screenshot of the Preferences window in COMSOL Multiphysics with the Chatbot category selected.

The Preferences window with the settings for the chatbot opened.

Additional options are available here, such as for enabling or disabling the chatbot tool, entering your API key, designating the AI model that the chatbot uses, and more. More information regarding the Preferences settings is available in the documentation.

Further Learning

For more information about the chatbot tool, see the "Using a Chatbot" section of the Reference Manual documentation. You can also refer to the Learning Center entry "Modeling with ChatGPT®" to gain practice in using the chatbot functionality in your modeling process. Note that the procedure outlined in that entry can be done within the Chatbot window instead of needing to have both a session of COMSOL Multiphysics and a web browser open.

ChatGPT is a registered trademark of OpenAI, Inc.

Java is a registered trademark of Oracle and/or its affiliates.

Microsoft and Windows are trademarks of the Microsoft group of companies.


Submit feedback about this page or contact support here.