Skip to content
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

Support complex payload for OpenAPI skills #680

Conversation

SergeyMenshykh
Copy link
Member

Motivation and Context

This PR changes the way payload/body for POST and PUT operations is resolved.

This change is required to support the following scenarios:

  • A POST/PUT operation payload has more than one property with the same name - { 'sender': { 'name': 'val1'}, 'receiver': {'name': 'val2'} }
  • A POST/PUT operation payload has a property of array of objects with the same name - { 'receivers': [ {'name':'val1'}, {'name':'val2'} ] }
  • A POST/PUT operation payload metadata is missing.

Description

Curent RestApi functionality builds operation payload dynamically and relies on:

  • Payload metadata that describes the payload/body schema/shape and usually obtained from OpenAPI documents.
  • Arguments resolution mechanism that resolves payload parameters in SK context.

As practice shows, in some cases (malformed OpenAPI document), the payload metadata is missing which means that it's not possible to create operation payload dynamically and as a result it's not possible to run the operation. In other cases, if a payload has two of more parameters with the same name or parameters of array type with object items it is impossible to resolve them from SK context.

To support these scenarios, the RestApi functionality does not build the payload dynamically anymore and instead relies on either AI or a caller of the APi to create/supply it. To help AI generate the payload, a new schema property will be added to the ParameterView class to describe the payload structure/shape to AI.

Contribution Checklist

@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel.core labels Apr 26, 2023
@SergeyMenshykh SergeyMenshykh added the PR: ready for review All feedback addressed, ready for reviews label Apr 26, 2023
@lemillermicrosoft lemillermicrosoft added the PR: feedback to address Waiting for PR owner to address comments/questions label Apr 27, 2023
@SergeyMenshykh SergeyMenshykh removed the PR: feedback to address Waiting for PR owner to address comments/questions label Apr 27, 2023
@gitri-ms gitri-ms added PR: ready to merge PR has been approved by all reviewers, and is ready to merge. and removed PR: ready for review All feedback addressed, ready for reviews labels Apr 27, 2023
@lemillermicrosoft lemillermicrosoft enabled auto-merge (squash) April 27, 2023 22:18
@lemillermicrosoft lemillermicrosoft merged commit e0a439d into microsoft:main Apr 27, 2023
11 checks passed
dluc pushed a commit that referenced this pull request Apr 29, 2023
### Motivation and Context

This PR changes the way payload/body for POST and PUT operations is
resolved.

This change is required to support the following scenarios:
- A POST/PUT operation payload has more than one property with the same
name - { 'sender': { '**name**': 'val1'}, 'receiver': {'**name**':
'val2'} }
- A POST/PUT operation payload has a property of array of objects with
the same name - { 'receivers': [ {'**name**':'val1'},
{'**name**':'val2'} ] }
- A POST/PUT operation payload metadata is missing.

### Description
Curent RestApi functionality builds operation payload dynamically and
relies on:
- Payload metadata that describes the payload/body schema/shape and
usually obtained from OpenAPI documents.
- Arguments resolution mechanism that resolves payload parameters in SK
context.

As practice shows, in some cases (malformed OpenAPI document), the
payload metadata is missing which means that it's not possible to create
operation payload dynamically and as a result it's not possible to run
the operation. In other cases, if a payload has two of more parameters
with the same name or parameters of array type with object items it is
impossible to resolve them from SK context.

To support these scenarios, the RestApi functionality does not build the
payload dynamically anymore and instead relies on either AI or a caller
of the APi to create/supply it. To help AI generate the payload, a new
schema property will be added to the ParameterView class to describe the
payload structure/shape to AI.
dehoward pushed a commit to lemillermicrosoft/semantic-kernel that referenced this pull request Jun 1, 2023
### Motivation and Context

This PR changes the way payload/body for POST and PUT operations is
resolved.

This change is required to support the following scenarios:
- A POST/PUT operation payload has more than one property with the same
name - { 'sender': { '**name**': 'val1'}, 'receiver': {'**name**':
'val2'} }
- A POST/PUT operation payload has a property of array of objects with
the same name - { 'receivers': [ {'**name**':'val1'},
{'**name**':'val2'} ] }
- A POST/PUT operation payload metadata is missing.

### Description
Curent RestApi functionality builds operation payload dynamically and
relies on:
- Payload metadata that describes the payload/body schema/shape and
usually obtained from OpenAPI documents.
- Arguments resolution mechanism that resolves payload parameters in SK
context.

As practice shows, in some cases (malformed OpenAPI document), the
payload metadata is missing which means that it's not possible to create
operation payload dynamically and as a result it's not possible to run
the operation. In other cases, if a payload has two of more parameters
with the same name or parameters of array type with object items it is
impossible to resolve them from SK context.

To support these scenarios, the RestApi functionality does not build the
payload dynamically anymore and instead relies on either AI or a caller
of the APi to create/supply it. To help AI generate the payload, a new
schema property will be added to the ParameterView class to describe the
payload structure/shape to AI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code PR: ready to merge PR has been approved by all reviewers, and is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants