OpenAPI Skill server-url configurations#797
Merged
adrianwyatt merged 23 commits intoMay 5, 2023
Merged
Conversation
amsacha
previously approved these changes
May 3, 2023
adrianwyatt
requested changes
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. 
adrianwyatt
previously approved these changes
May 5, 2023
adrianwyatt
previously approved these changes
May 5, 2023
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 <[email protected]>
Co-authored-by: Adrian Bonar (HE/HIM) <[email protected]>
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 <[email protected]>
Co-authored-by: Adrian Bonar (HE/HIM) <[email protected]>
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 <[email protected]>
Co-authored-by: Adrian Bonar (HE/HIM) <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
PopulateListfunction 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
SemanticKernelControllerand passed to the Import methodi.e.,