Skip to content

.Net: OpenAI function calling - enable auto execution of functions #2932

Closed

Description

@gitri-ms

Expand on our function calling support to enable the kernel to automatically execute functions returned by the model. This needs further consideration on questions such as:

  • how to maintain separation between connector-specific constructs and the core kernel abstractions
  • how to differentiate between chat message results and function results
  • how this impacts flows/chaining

For context, the initial implementations of function calling (and some discussion on this topic) are here: #2842 & #2356

Activity

  1. added
    .NETIssue or Pull requests regarding .NET code
    pythonPull requests for the Python Semantic Kernel
    sk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
    on Sep 21, 2023
  2. changed the title [-]OpenAI function calling - enable auto execution of functions[/-] [+]Python: OpenAI function calling - enable auto execution of functions[/+] on Sep 21, 2023
  3. changed the title [-]Python: OpenAI function calling - enable auto execution of functions[/-] [+].Net: OpenAI function calling - enable auto execution of functions[/+] on Sep 21, 2023
  4. moved this to Backlog - New features in Semantic Kernelon Sep 22, 2023
  5. stephentoub commented on Oct 11, 2023

    @stephentoub
    Member

    I left a few comments at #2842 (comment), but FWIW, I think this is a key differentiator that SK can provide. It takes something that's otherwise filled with boilerplate and leverages SK's strengths and the knowledge already built up to reduce that boilerplate all down to a one-liner. We should make this happen :)

  6. stephentoub commented on Oct 16, 2023

    @stephentoub
    Member

    Here's approximately what I think we should do for v1:
    main...stephentoub:semantic-kernel:chatcompletionwithfunctions

    This is adding an IChatCompletionWithFunctions, which exposes a GetChatCompletionsAsync and GetStreamingChatCompletionsAsync that just takes an additional argument (in my commit, it's an SKContext, but it could be something else that includes functions). This makes it trivial for a consumer to just do the normal chatting but with planning integrated into the chat: in the case of OpenAI or Azure OpenAI, the implementation can choose to use the server-side functionality, or in the case of another provider, it could choose to use a client-side planner and proactively augment the chat information sent.

    The difference in what consumption like is night and day. Take a look at the Example59_OpenAIFunctionCalling. There are four implementations there: automatic (using this new interface) vs manual (working at the message level directly), and non-streaming vs streaming. The automatic ones that leverage IChatCompletionWithFunctions make it a no-brainer to use. The manual ones are not only incredibly hard (and not all that much better than what you can do at the underlying OpenAIClient level), you can't even implement the manual streaming one today due to missing support in SK.

    I would strongly urge us to make getting something like this in for 1.0 a priority.

  7. moved this from Backlog - New features to Backlog in Semantic Kernelon Nov 28, 2023
  8. moved this from Backlog to Sprint: Planned in Semantic Kernelon Nov 28, 2023
  9. moved this from Sprint: Planned to Sprint: Done in Semantic Kernelon Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codepythonPull requests for the Python Semantic Kernelsk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions