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

.Net: fix: hard limit to functions descriptions for OAS imports #9841

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

baywet
Copy link
Member

@baywet baywet commented Nov 28, 2024

this PR adds a hard limit to function descriptions to avoid hitting the limit from the model planner

@baywet baywet requested a review from a team as a code owner November 28, 2024 16:06
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Nov 28, 2024
@github-actions github-actions bot changed the title fix: hard limit to functions descriptions for OAS imports .Net: fix: hard limit to functions descriptions for OAS imports Nov 28, 2024
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
var operation = new RestApiOperation(
id: operationItem.OperationId,
servers: operationServers,
path: path,
method: new HttpMethod(method),
description: string.IsNullOrEmpty(operationItem.Description) ? operationItem.Summary : operationItem.Description,
description: description?.Substring(0, Math.Min(description.Length, 1000)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some scenarios may benefit from this change, while others may not. We shouldn't assume that this change works for all situations that SK addresses. So, if the CopilotAgentPlugin scenarios need it, consider applying it there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could/should the value be an option somewhere without any default? If so where?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not specific to copilot agent plugins. Anything openapi based is going to have the same issue since this description comes from the open API document. Hence why I patched it here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also beyond a configurable option, there probably should be a hard limit for service protection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SK OpenAPI functionality provides customization capabilities that can be extended and used for cases like this - OpenApiPlugin_Customization.

SK should tend to make as minimal assumptions about user scenarios as possible to remain maintainable and cater to a wide range of user scenarios, while simultaneously allowing for the tweaking of certain aspects for specific scenarios via customization.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my question is: what would be an acceptable API to have those sorts protections in semantic kernel (maybe off by default) which people could configure, without having to implement a decorator themselves?

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants