-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Revise AI section #49905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Revise AI section #49905
Conversation
Update the document to improve the section on using AI for serialization. Added details on handling nested and polymorphic types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR revises the AI section of the serialization documentation to better explain how to use AI tools for generating code that handles nested and polymorphic types. The changes update the section heading and provide a more detailed example prompt for GitHub Copilot.
Key Changes
- Updated the heading to clarify focus on nested and polymorphic types
- Expanded the example Copilot prompt to demonstrate generating code for hierarchical object structures with custom JsonConverter
- Improved the link text for Visual Studio Code in the "See also" section
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a couple small comments, but this is good.
I'll let @gewarren review and approve.
|
|
||
| > [!TIP] | ||
| > You can use AI assistance to [serialize to JSON](#use-ai-to-serialize-to-json). | ||
| > You can use AI assistance to [serialize to JSON](#use-ai-to-serialize-nested-and-polymorphic-types). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the focus of the example has changed, seems like this belongs more in https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/polymorphism.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're revising these examples per community & cloud advocate feedback to show extended use cases which demonstrate the true value add of Copilot. In the other doc, this could come across as a simpler example use case given the doc's topic. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @gewarren. While the example should be expanded to be good, the true value add isn't going to be demonstrated in this article. However, I'm going to give that feedback down below inline with the copilot prompt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gewarren, @adegeo - thanks! thoughts/suggestions on a good example scenario for this doc which is more than basic? Most folks know basic prompting at this point, so the previous example could be thought of as a bit basic.
cc: @BillWagner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is the proposed example a good one for https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/polymorphism.md, or would it need to be revised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this example belongs where we go deeper on the polymorphism capabilities of System.Text.Json. Andy's suggestion would really help readers see more value from Copilot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and having that polymorphism AI example should be pretty comprehensive. More introduction in the copilot suggestion, setting up the scenario copilot is going to fix, maybe provide example code, etc, and then demonstrate it. Let's make Copilot work for our users, not make our users fight with copilot for something useable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all for your input & feedback. I'll revise the example in this article using one of your suggestions below.
I’ll leave the advanced polymorphic example for the polymorphism article (I can draft the example and move it there, but I’ll let the SMEs review and finalize it).
adegeo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking much better. Here are some suggestions to push this through to the finish line. Thanks!
| Review Copilot's suggestions before applying them. | ||
|
|
||
| For more information about GitHub Copilot, see GitHub's [FAQs](https://github.com/features/copilot#faq). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really only need a small disclaimer at the end of these Copilot suggestions.
| *Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot general use FAQs](https://aka.ms/copilot-general-use-faqs).* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have this disclaimer before. It was revised in the doc based on feedback we've seen to just add the current "Review Copilot's suggestions before applying them." This disclaimer is present in Copilot.
| You can use AI tools, such as GitHub Copilot, to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to fit your object fields and serialization needs. | ||
|
|
||
| The following text shows an example prompt for Copilot Chat: | ||
| Here's an example prompt you can use in Visual Studio Code Copilot Chat to generate serialization code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this isn't specific to VSCode, it should be generic:
| Here's an example prompt you can use in Visual Studio Code Copilot Chat to generate serialization code. | |
| Here's an example prompt you can use in Copilot to generate serialization code: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it in Visual Studio Code. I wouldn't want to claim it'll give the same results everywhere. User is free to copy and try the prompt with any Copilot.
| - [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) | ||
| - [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) | ||
| - [GitHub Copilot in Visual Studio Code](https://code.visualstudio.com/docs/copilot/overview) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't make sense for the article. It should point to how to deserialize and maybe more complex serialization:
| - [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) | |
| - [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) | |
| - [GitHub Copilot in Visual Studio Code](https://code.visualstudio.com/docs/copilot/overview) | |
| - [How to read JSON as .NET objects (deserialize)](deserialization.md) | |
| - [How to customize property names and values with System.Text.Json](customize-properties.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to add links directly in the section, so we decided to add these links to the Related links. wrt the other links, I'll leave it to the author @gewarren to decide which ones to include.
Co-authored-by: Andy (Steve) De George <[email protected]>
Update the document to improve the section on using AI for serialization. Added details on handling nested and polymorphic types.
Internal previews