Wing Tips: AI Chat in Wing Pro
This Wing Tip describes how to use the AI Chat tool in Wing Pro 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 suggestion and AI Coder, as they were described in the previous Wing Tip:
- 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 tool is used to ask about the purpose of a particular class and then for more information about several methods within the class:

Shown above: Asking AI Chat 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 Chat is asked to produce an example of using a particular class:

Shown above: Asking AI Chat to write example code that illustrates how to use class Assistant
In this example there was significant processing time involved, but this has improved as generative AI advances, and you'll certainly receive results far faster than if you wrote the code yourself.
Although AI Chat will never modify your code directly, you can use blocks of code it produces by right-clicking on them to copy or paste into your current editor.
Getting Started
To try out AI Chat in Wing Pro, see the AI Quick Start and the rest of 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: