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 for plugin manifest #1666

Closed

Commits on Jun 27, 2023

  1. 🛠️ Refactor plan parsing and add GetFunction option

    This commit refactors the SequentialPlanParser class to simplify the
    logic and avoid catching and rethrowing exceptions. It also adds a
    GetFunction option to the SequentialPlannerConfig class, which allows
    the caller to provide a custom function to get a function by name. This
    can be useful for scenarios where the available functions are not
    statically defined or need to be resolved dynamically. Additionally,
    this commit changes the stop sequence for the plan parsing to be
    "<!-- END -->" instead of just "<!--", to avoid ambiguity with other
    comments.
    
    The commit also refactors the plan parsing logic to use a function
    delegate instead of a SKContext parameter. This allows for more
    flexibility and customization in how the skill functions are retrieved.
    The function delegate can be provided by the SequentialPlannerConfig or
    by a default implementation that uses the SKContext.
    
    The commit also updates the unit tests and the planner extensions to
    use the new function delegate parameter. The skprompt.txt file was
    updated to clarify some points about the function syntax and the
    available functions. The examples were also reorganized and simplified.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    9fce6e8 View commit details
    Browse the repository at this point in the history
  2. 📝 Remove text and comment nodes from plan steps

    This commit changes the SequentialPlanParser to ignore text and comment
    nodes when parsing a plan from XML. These nodes are not valid steps and
    should not be added to the plan. This also updates the unit tests to
    reflect the expected behavior. Additionally, this commit adds some
    comments to the skprompt.txt file to clarify the expected format and
    validity of the plans.
    
    Squashed commit of the following:
    
    commit eeae9b0
    Author: Lee Miller <[email protected]>
    Date:   Thu Jun 22 15:26:51 2023 -0700
    
        🐛 Fix sequential plan parser to ignore non-function tags
    
        The sequential plan parser was incorrectly adding non-function tags
        as steps in the plan, resulting in extra and invalid steps. This
        commit fixes the parser to skip any tags that are not <function>
        and only add the function steps to the plan. This also updates the
        unit tests to reflect the expected behavior and output of the parser.
    
    commit 0e2e9c1
    Author: Lee Miller <[email protected]>
    Date:   Thu Jun 22 15:23:14 2023 -0700
    
        🐛 Fix plan parsing to ignore text and comments
    
        The plan parser was incorrectly adding text and comment nodes as steps
        in the plan, which could cause errors or unexpected behavior. This
        commit fixes the parser to skip over these nodes and only add function
        nodes as steps. It also adds some TODO comments for possible future
        enhancements to use text or comments as reasoning or desired functions
        for a plan.
    
    commit 5bb555c
    Author: Lee Miller <[email protected]>
    Date:   Thu Jun 22 14:44:29 2023 -0700
    
        🛠️ Fix stop sequence for sequential planner
    
        The stop sequence for the sequential planner was missing the "END" part,
        which could cause problems when parsing the XML plan. This commit fixes
        the stop sequence to include the "END" comment.
    
        It also simplifies the instructions for creating a plan, removing some
        redundant or outdated information. It adds an example of how to call a
        function with multiple inputs, and how to use XML comments in the input
        values.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    9879f80 View commit details
    Browse the repository at this point in the history
  3. 🔄 Swap parameter order in ToPlanFromXml method

    The parameter order in the ToPlanFromXml method was inconsistent with
    the rest of the codebase, and could cause confusion for callers. This
    commit swaps the order of the allowMissingFunctions and GetFunction
    parameters, and updates the XML documentation accordingly. No changes
    were made to the method logic or functionality.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    efc062b View commit details
    Browse the repository at this point in the history
  4. 📝 Update SequentialPlanner to use AzureChatCompletionService and lowe…

    …r relevancy threshold
    
    This commit updates the SequentialPlanner to use the
    AzureChatCompletionService instead of the AzureTextCompletionService,
    which is more suitable for generating natural language responses. It
    also lowers the relevancy threshold for the planner to 0.5, which may
    improve the quality of the plans.
    
    Additionally, this commit updates the skprompt.txt file to include the
    available functions in the prompt, and to clarify the steps for creating
    a plan and calling a function. It also adds some examples of valid and
    invalid function calls.
    
    Finally, this commit removes a redundant EmailSkillFake import in the
    SequentialPlannerTests class, and adds a fake EmailSkill to simulate the
    use of a custom skill in the planning process. No functional changes
    were made to the tests or the planner.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    cd89d95 View commit details
    Browse the repository at this point in the history
  5. 👌 Simplify and rename function-related code

    - Use ternary operator to simplify GetAvailableFunctionsAsync logic
    - Rename GetFunction to GetSkillFunction for clarity and consistency
    - Update references to GetFunction in SequentialPlanParser and SequentialPlanner
    - Rename GetFunction property in SequentialPlannerConfig to GetSkillFunction
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    7ea8479 View commit details
    Browse the repository at this point in the history
  6. 🛠️ Rename GetFunction to GetSkillFunction in SequentialPlanParser

    This commit renames the GetFunction method in the SequentialPlanParser
    class to GetSkillFunction, to better reflect its purpose and avoid
    confusion with other methods that also deal with functions. The method
    is used to create a delegate that takes a skill name and returns a
    corresponding function object. All the references and tests that use
    this method are also updated accordingly. This change improves the
    readability and clarity of the code.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    7a847f6 View commit details
    Browse the repository at this point in the history
  7. 🔌 Add extension methods for importing plugin manifest

    This commit adds two extension methods for the IKernel interface that
    allow importing a plugin manifest document from a URL or a string. The
    plugin manifest is a JSON document that lists the names and URLs of
    remote plugins that provide chat GPT skills. The extension methods use
    the existing ImportChatGptPluginSkillFromUrlAsync method to import each
    plugin and its functions, and return a dictionary of the imported
    functions. The commit also adds a model class for the plugin manifest
    and its contents.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    aec848d View commit details
    Browse the repository at this point in the history
  8. WIP 🧪 Add integration tests for sequential planner config and plugin …

    …manifest
    
    This commit adds two new integration test classes for the sequential
    planner configuration and the plugin manifest functionality. The tests
    use the Azure OpenAI services for text completion and embedding
    generation, and require the corresponding configuration values to be
    set in the appsettings.json file. The tests also use a custom logger
    and a redirect output helper to capture the test output. The test
    classes implement the IDisposable interface to properly dispose of the
    logger and the output helper.
    
    The commit also adds the ability to supply custom functions for getting
    available functions and getting a specific function in the sequential
    planner config. This allows the planner to use functions from a plugin
    manifest instead of relying on the default context.Skills. The commit
    includes a test case for creating a plan with custom functions, using a
    fake email skill and a chat plugin skill from Klarna. The test case
    demonstrates how to load a plugin manifest, populate a vector store
    with the functions, and use the custom functions to create and invoke
    a plan.
    lemillermicrosoft committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    def7b3f View commit details
    Browse the repository at this point in the history