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
OpenAPI Skill server-url configurations #797
Merged
adrianwyatt
merged 23 commits into
microsoft:main
from
teresaqhoang:prohibit-planner-server-url-override
May 5, 2023
Merged
OpenAPI Skill server-url configurations #797
adrianwyatt
merged 23 commits into
microsoft:main
from
teresaqhoang:prohibit-planner-server-url-override
May 5, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teresaqhoang
added
PR: ready for review
All feedback addressed, ready for reviews
planner
Anything related to planner or plans
kernel
Issues or pull requests impacting the core kernel
labels
May 3, 2023
amsacha
previously approved these changes
May 3, 2023
adrianwyatt
requested changes
May 3, 2023
adrianwyatt
added
PR: feedback to address
Waiting for PR owner to address comments/questions
and removed
PR: ready for review
All feedback addressed, ready for reviews
labels
May 3, 2023
This comment was marked as resolved.
This comment was marked as resolved.
adrianwyatt
previously approved these changes
May 4, 2023
### Motivation and Context This PR enables GitHub integration with Copilot Planner. ### Description Server-side - Added C# classes for GitHub schema objects - Adds tokenLimit for Planner response content. Currently, it's set at 75% of the remaining limit after memories response and document context have already been allocated. - Added `OptimizeOpenApiSkillJson` method that is called on Planner completion. This method: - removes all new line characters (huge token suck) from API response - truncates the API response by object until it's under the relatedInformationTokenLimit. - If the request can't be truncated, error message added to bot context - For GitHub skills specifically, the API response is deserialized into `PullRequest` or `PullRequest[]` objects to filter noisy properties. Web app side - If plugins require additional api requirements, these are added to the ask variables (rather than headers in http request) -- this allows the kernel/planner to directly consume these without any additional handling server side - `repo` and `owner` added as additional GitHub api requirements - Rename ApiRequirements to ApiProperties. These properties can be optional. ![image](https://user-images.githubusercontent.com/125500434/236005717-14016432-b5de-47b3-a128-e38418c267e3.png)
teresaqhoang
changed the title
Removing server-url from suggested Planner parameters
Add default parameter values for available functions on Plan creation (ActionPlanner)
May 4, 2023
teresaqhoang
added
PR: ready for review
All feedback addressed, ready for reviews
and removed
PR: feedback to address
Waiting for PR owner to address comments/questions
labels
May 5, 2023
adrianwyatt
previously approved these changes
May 5, 2023
adrianwyatt
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
May 5, 2023
dotnet/src/Skills/Skills.OpenAPI/Extensions/RestApiOperationExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Skills/Skills.OpenAPI/Extensions/KernelOpenApiExtensions.cs
Outdated
Show resolved
Hide resolved
adrianwyatt
previously approved these changes
May 5, 2023
dotnet/src/Skills/Skills.UnitTests/OpenAPI/OpenApiDocumentParserV31Tests.cs
Show resolved
Hide resolved
lemillermicrosoft
approved these changes
May 5, 2023
5 tasks
codebrain
pushed a commit
to searchpioneer/semantic-kernel
that referenced
this pull request
May 16, 2023
### Motivation and Context **1. Add default parameter values for available functions on Plan creation (ActionPlanner)** - This commit changes the `PopulateList` function to include the default value of each parameter in the generated string. This makes the list of available functions more informative and helpful for LLM to know the default behavior of a function. The default value is shown in parentheses after the parameter description. - This is helpful in parsing the correct server-url for OpenAPI functions (before, the planner was suggesting arbitrary values that were more-than-intermittently wrong). **2. Add support to override the server-url from user input** - User input is passed as customer variable in Ask context when SK is invoked in the format {openApiSkillName}-server-url - This can then be parsed in the `SemanticKernelController` and passed to the Import method i.e., ``` if (openApiSkillsAuthHeaders.JiraAuthentication != null) { this._logger.LogInformation("Registering Jira Skill"); var authenticationProvider = new BasicAuthenticationProvider(() => { return Task.FromResult(openApiSkillsAuthHeaders.JiraAuthentication); }); var hasServerUrlOverride = variables.Get("jira-server-url", out string serverUrlOverride); await planner.Kernel.ImportOpenApiSkillFromFileAsync( skillName: "JiraSkill", filePath: Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"Skills/OpenApiSkills/JiraSkill/openapi.json"), authCallback: authenticationProvider.AuthenticateRequestAsync, serverUrlOverride: hasServerUrlOverride ? serverUrlOverride : null ); } ``` 3. Adds missing user-agent parameter to all ImportOpenApiSkill methods for consistency --------- Co-authored-by: Adrian Bonar <56417140+adrianwyatt@users.noreply.github.com> Co-authored-by: Adrian Bonar (HE/HIM) <adribona@microsoft.com>
dehoward
pushed a commit
to lemillermicrosoft/semantic-kernel
that referenced
this pull request
Jun 1, 2023
### Motivation and Context **1. Add default parameter values for available functions on Plan creation (ActionPlanner)** - This commit changes the `PopulateList` function to include the default value of each parameter in the generated string. This makes the list of available functions more informative and helpful for LLM to know the default behavior of a function. The default value is shown in parentheses after the parameter description. - This is helpful in parsing the correct server-url for OpenAPI functions (before, the planner was suggesting arbitrary values that were more-than-intermittently wrong). **2. Add support to override the server-url from user input** - User input is passed as customer variable in Ask context when SK is invoked in the format {openApiSkillName}-server-url - This can then be parsed in the `SemanticKernelController` and passed to the Import method i.e., ``` if (openApiSkillsAuthHeaders.JiraAuthentication != null) { this._logger.LogInformation("Registering Jira Skill"); var authenticationProvider = new BasicAuthenticationProvider(() => { return Task.FromResult(openApiSkillsAuthHeaders.JiraAuthentication); }); var hasServerUrlOverride = variables.Get("jira-server-url", out string serverUrlOverride); await planner.Kernel.ImportOpenApiSkillFromFileAsync( skillName: "JiraSkill", filePath: Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"Skills/OpenApiSkills/JiraSkill/openapi.json"), authCallback: authenticationProvider.AuthenticateRequestAsync, serverUrlOverride: hasServerUrlOverride ? serverUrlOverride : null ); } ``` 3. Adds missing user-agent parameter to all ImportOpenApiSkill methods for consistency --------- Co-authored-by: Adrian Bonar <56417140+adrianwyatt@users.noreply.github.com> Co-authored-by: Adrian Bonar (HE/HIM) <adribona@microsoft.com>
golden-aries
pushed a commit
to golden-aries/semantic-kernel
that referenced
this pull request
Oct 10, 2023
### Motivation and Context **1. Add default parameter values for available functions on Plan creation (ActionPlanner)** - This commit changes the `PopulateList` function to include the default value of each parameter in the generated string. This makes the list of available functions more informative and helpful for LLM to know the default behavior of a function. The default value is shown in parentheses after the parameter description. - This is helpful in parsing the correct server-url for OpenAPI functions (before, the planner was suggesting arbitrary values that were more-than-intermittently wrong). **2. Add support to override the server-url from user input** - User input is passed as customer variable in Ask context when SK is invoked in the format {openApiSkillName}-server-url - This can then be parsed in the `SemanticKernelController` and passed to the Import method i.e., ``` if (openApiSkillsAuthHeaders.JiraAuthentication != null) { this._logger.LogInformation("Registering Jira Skill"); var authenticationProvider = new BasicAuthenticationProvider(() => { return Task.FromResult(openApiSkillsAuthHeaders.JiraAuthentication); }); var hasServerUrlOverride = variables.Get("jira-server-url", out string serverUrlOverride); await planner.Kernel.ImportOpenApiSkillFromFileAsync( skillName: "JiraSkill", filePath: Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"Skills/OpenApiSkills/JiraSkill/openapi.json"), authCallback: authenticationProvider.AuthenticateRequestAsync, serverUrlOverride: hasServerUrlOverride ? serverUrlOverride : null ); } ``` 3. Adds missing user-agent parameter to all ImportOpenApiSkill methods for consistency --------- Co-authored-by: Adrian Bonar <56417140+adrianwyatt@users.noreply.github.com> Co-authored-by: Adrian Bonar (HE/HIM) <adribona@microsoft.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kernel
Issues or pull requests impacting the core kernel
.NET
Issue or Pull requests regarding .NET code
planner
Anything related to planner or plans
PR: ready to merge
PR has been approved by all reviewers, and is ready to merge.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
1. Add default parameter values for available functions on Plan creation (ActionPlanner)
This commit changes the
PopulateList
function to include the default value of each parameter in the generated string. This makes the list of available functions more informative and helpful for LLM to know the default behavior of a function. The default value is shown in parentheses after the parameter description.This is helpful in parsing the correct server-url for OpenAPI functions (before, the planner was suggesting arbitrary values that were more-than-intermittently wrong).
2. Add support to override the server-url from user input
SemanticKernelController
and passed to the Import methodi.e.,