-
Notifications
You must be signed in to change notification settings - Fork 214
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
Generate adaptive cards when creating API Plugins #5674
Comments
On AC 8, let's say that an endpoint changes, but the user says no to regen the adaptive card, are we failing? Are we generating the adaptive card because the endpoint changed? Or do we do a "mix" of we generate the updated function, but we inject the existing adaptive card? Last option seems pretty dangerous... |
In the API plugin we reference the OpenAPI description through the If the user says "No" to regen adaptive cards, we should not fail if there was a change in the endpoint. We should not regen the adaptive card even if there was a change in the endpoint. We should just add the new selected endpoints/remove unselected endpoints in the API plugin and regen the sliced OpenAPI description. Does that make sense? |
This brings so many questions. First off, what if I'm generating a plugin manifest with the goal of feeding it to semantic kernel/something other than TTK? Do I always get an adaptive card? That I need to manually delete every time? Also, the experience you're describing is very VS Code centric, what about the CLI? Are we going to start interrupting the shell and ask "modal" prompts? or are we adding additional switches? The adaptive card is deeply dependent on TTK (I think you can also use adaptive cards in windows apps, outlook, and SPFx, but let's ignore those for now as they are not copilot scenarios). I DO NOT think it makes sense architecturally to start mixing concerns, and take ownership of something additional we don't know much about. It'd probably make much more sense to "handover back" to TTK saying "here is the schema, do what you must". TTK has a deep expertise of adaptive cards, validation libraries, etc... that we don't have and would have to build. Lastly, mixing generated code and manual edits will lead to a poor experience, especially because of the overwrite problem. Adaptive cards are meant to be designed, sometimes by other audiences than developers (this is why they are a bunch of simplified controls, personalization points etc...). Getting "in the way of the developer" and starting to ask to overwrite files is going to lead to a lot of friction in the experience. Being able to work on two separate files, once that describes the data structure, auto-generated, and another that describes the card "layout" handcrafted, would probably deliver a MUCH better end user experience. But I don't know if this is something supported by adaptive cards today. |
Hey Vincent, thanks for asking question to get as much information as possible. About the CLI experience, we had an internal conversation a few days ago and yes, we decided to add a new and optional switch --adaptive-card (alias --ac) as part of plugin command, defaulting to false when not provided. So we will always assume one doesn't want to generate adaptive cards if not said otherwise. For the VS Code extension, when generating the plugin the first time, we will always generate adaptive cards, and for every regeneration, we should ask the user whether or not they want to regenerate adaptive cards as well and let them know that any manual change will be override. I'm going to update the CLI spec to cover the new switch 😄 We also believe that Kiota + TypeSpec for authoring APIs can bring a massive benefit with new decorators, some of them related to tagging which properties should be used in the adaptive card and Kiota would be able to actually create something based on the developer preference. So I don't agree with the Now, about mixing generated code and manual edits, I do agree with you. This is very trick. Because of that, we have talked to TTK and asked them to support adaptive cards in a different file and use an import mechanism when provisioning/publishing to merge both files when generating the package OfficeDev/teams-toolkit#12665 |
Current Challenge
Today, the Teams Toolkit (TTK) VS Code extension generates adaptive cards when scaffolding the project. However, with the integration of Kiota into TTK to generate API plugins, there is a potential issue. When regenerating plugins, Kiota may override the plugin manifest content, deleting any previously added adaptive cards. This is because Kiota currently does not have adaptive card generation as part of its logic.
Proposal
As part of the Kiota plugin generator history, we should generate adaptive cards when generating API plugins. This way, whether a user is generating a plugin for the first time or regenerating an existing plugin, Kiota can provide initial adaptive cards based on the selected endpoints. These cards can later be improved by the user.
We need to do reverse engineering in TTK's code and add the same logic they are using to generate adaptive cards into Kiota generation.
Description
Adaptive cards information are generated for each function that returns a complex data structure under the
response_semantics
in the API Plugin. The response_semantics property instructs the agent how it should display data it receives from the API. It consists of 3 properties: data_path, properties, and static_template.So for example, given the /search/issues#GET operation, based on the GitHub's OpenAPI description, this is the reponse:
The
data_path
specifies a JSON path expression that points to the relevant part of the API response. In the above scenario, thedata_path
should point toitems
.The next part of response semantics are
properties
that are used to tell the agent which of the data properties from the API response represent the item’s properties such as title, description or URL.The final property of response semantics is
static_template
which is used to define an Adaptive Card template to show the data from the API.Here is an example of the desired structure:
Acceptance Criteria:
response_semantics
.response_semantics
must includedata_path
,properties
with at leasttitle
and thestatic_template
.The text was updated successfully, but these errors were encountered: