
.. _specador-ai-assistant:

AI Assistant
============

.. |ai-icon| image:: ../../images/ai-assistant.png
   :class: inline

.. |save-icon| image:: ../../images/save-button.png
   :class: inline


.. rst-class:: lead

   When working in DVT IDE, you can automatically generate comments for your code using the `DVT AI Assistant <https://eda.amiq.com/documentation/vscode/sv/toc/ai-assistant/overview.html>`_.

1. Open the :guilabel:`Specador HTML Preview`, by placing the cursor on an element declaration (e.g., ``module``, ``interface``, ``class``, ``entity``, ``unit``), 
then :guilabel:`Right-Click` and choose :menuselection:`Show --> Show in HTML Preview`.

2. Simply press the |ai-icon| button next to a variable, function, port, signal etc. to generate missing comments using AI.
To generate all missing comments press the :guilabel:`Generate missing comments` button, located in the top-right corner.

.. figure:: ../../images/specador-ai-generated-comment.gif
   :align: center

   Generate ALL missing comments

.. figure:: ../../images/specador-ai-small-button.gif
   :align: center

   Generate ONE missing comment

3. After reviewing the generated comments you can re-generate, manually adjust or discard them altogether.

.. figure:: ../../images/specador-ai-discard.png
   :align: center

   Hover an AI-generated comment to reveal the regenerate and discard buttons.

Click an AI-generated comment to open the inline Markdown editor. 
The toolbar provides typical text formatting assistance (bold/italic, bullet lists, headers, quote etc).

.. figure:: ../../images/specador-ai-edit.png
   :align: center

   Markdown editor

4. When done, press |save-icon| to save the changes. A diff editor will present all changes to source code comments.

.. figure:: ../../images/specador-ai-save.png
   :align: center

Using the AI Assistant helps accelerate documentation while keeping you in full control of the final content.

.. attention::

   AI-generated comments may include mistakes, always review the content to ensure it matches your design intent.

.. note:: 

   The AI-generated comments follow a set of instructions called `Blueprints <https://eda.amiq.com/documentation/vscode/sv/toc/ai-assistant/key-terms.html#blueprints>`_.

   To review or edit the blueprint, use the command ``DVT AI: Edit Predefined Blueprint`` and select ``Add comment to the Specador Preview``.
   
   After you customize the blueprint and save it, the preview will use of the new instructions.
   More information about customized blueprints `here <https://eda.amiq.com/documentation/vscode/sv/toc/ai-assistant/reference.html#custom-blueprints>`_.
