Wing Tips: AI Chat in Wing Pro

Jan 24, 2024


This Wing Tip describes how AI chat in Wing Pro can be used to interact with a generative AI assistant in order to ask questions about existing code or work through the design and implementation of new code.

There are several reasons to use AI chat rather than AI code suggestion and refactoring, as described in the previous Wing Tip:

  • AI chat can preprocess much more context for your requests. This allows it to more fully understand your existing code base, and to provide more accurate and complete answers.
  • AI chat can provide more detailed responses that include both code and explanation of the code.
  • AI chat lets you iterate within the context of your previous conversation, making it easier to drill down to the details that you are trying to understand or to refine an implementation.
  • AI chat cannot directly modify your code or place code anywhere that it can be executed, which helps to address AI safety concerns.

Asking About Existing Code

Generative AI is particularly good at reading and summarizing large amounts of text or code. You can ask it to focus on specific code or provide it with a number of whole files, and then ask it to explain them to you. It may take some time to process your request, but you'll receive results much faster than trying to read through the code yourself.

Here is an example where Wing Pro's AI chat capability is used to ask about the purpose of a particular class and then for more information about several methods within the class:

AI chat to explain code in Wing Pro

Shown above: Asking the AI assistant to explain class Assistant and then the purpose of several of its methods that are @classmethod

Writing New Code

You can also ask the AI to write code in the context of an AI chat. Here's an example where the AI assistant is asked to produce an example of using a particular class:

AI chat to write some new code in Wing Pro

Shown above: Asking the AI assistant to write example code that illustrates how to use class Assistant

Once again there is some processing time involved, but you'll receive results far faster than if you wrote the code yourself. The processing time and costs seen in these examples are likely to change for the better as generative AI advances.

Getting Started

To try out AI chat in Wing Pro, check out the AI Assisted Development documentation for details on setup, framing requests, and monitoring costs. It takes a bit of time to get started, but it is well worth the effort to incorporate generative AI into your tool chain.



That's it for now! We'll be back soon with more Wing Tips for Wing Python IDE.

As always, please don't hesitate to email support@wingware.com if you run into problems or have any questions.



Share this article: