### Motivation and Context
This is a path of changes following the removal of the `Experimental`
attribute from non-GA packages API's.
Since all the existing AI Connectors that are still in `preview`,
`alpha` and `beta` can still change or discontinued before GA, the usage
of experiments within pre-production is redundant and not necessary.
### Motivation and Context
Adding support for AI context behaviors to Semantic Kernel.
These allow creating plugins that are able to listen to messages being
added to the chat history and contribute to the AI context on each
invocation. This PR also integrates support for these with Agents and
AgentThreads.
#10100#10712
---------
Co-authored-by: SergeyMenshykh <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
We got a report stating that there was still a old limit on the number
of files supplied to the Azure Assistant API.
This PR fixes that and also does some further cleanup of the code.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
---------
Co-authored-by: Chris <[email protected]>
fixes#6614
### Motivation and Context
- Adds support for Microsoft Plugins Manifest to semantic kernel in
dotnet.
- Fixes performance bottleneck for API Manifest loading.
- Fixes broken integration tests for API manifest loading.
- Adds an OpenAPI operation id normalization visitor to replace `.` by
`_` so function names are valid.
- Fixes performance bottleneck in OpenAPI operation loading.
- Fixes experimental ID for API manifest from SKEXP0043 to SKEXP0040
after the renumbering
- Upgrades OAI.net and ApiManifest references.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
On the unit tests: I'd like guidance on where to add unit tests for:
- API Manifest loading (wasn't done at the time)
- Microsoft Manifest loading.
- Operation Id Normalization Visitor
### Why so many files?
- `./kiota`: all generated files, it contains kiota workspace
configuration, which comes with copies of the OAS descriptions, etc… You
don’t need to review it manually. It is useful because it allows us to
automatically generate/refresh the integration tests plugins. If you
feel like it's adding too much noise, we can remove those, we'll loose
the ability to refresh the plugins definitions. https://aka.ms/kiota
- `Samples/concepts`: restored the api manifest for astronomy API to fix
the API manifest integration test. Added sample Microsoft Manifest for
the new integration tests. Those are automatically generated via kiota
and can be automatically refreshed later.
- `Src/Functions`: Microsoft manifests implementation, API manifest
fixes.
### How to run the local tests
Create the following JSON file
`D:\github\semantic-kernel\dotnet\samples\Concepts\bin\Debug\net8.0\appsettings.Development.json`
(for some reason given how the project is setup this file is not being
copied automatically. I didn't to touch any of the project setup out of
fear of breaking other things)
```json
{
"MSGraph": {
"ClientId": "clientId",
"TenantId": "tenantId",
"Scopes": [
"Calendars.Read",
"Contacts.Read",
"Files.Read.All",
"Mail.Read",
"User.Read"
],
"RedirectUri": "http://localhost"
}
}
```
Replace the clientId and TenantId by your own value.
To create the application registration, go to
https://aad.portal.azure.com, create a new application registration, new
public client (add the redirect URI). In API access, add the listed
Microsoft Graph delegated scopes. Grant consent after adding the scopes.
During the first run, your browser will open to get the token.
### File paths and copies
Like for the development settings, the project is NOT copying the sample
plugin files for some reason. This is why the loading of the files in
the integration tests looks at source files directly with `../../../`
path segments. Happy to review that upon guidance.
### License for Astrology plugins
The description is under the Apache license. I added the plugin (API and
Microsoft) to restore the integration test for the former and mirror the
setup to the latter. In the case of API plugins, we're only referring to
it, so having a plugin is fine. In case of the Microsoft plugin, we have
a full copy under the kiota configuration directory, and a sliced down
version (derived work) in the example plugin. The value of this API is
that it allows us to test scenarios outside of Microsoft Graph. But if
the license is a challenge, we can remove those before merging.
@RogerBarreto to provide more context on why those were deleted at the
first place in #6005
### Why so many commits?
Incremental work during the implementation, plus regular merges from
main to make sure everything was current and we wouldn't end up with
conflicts, etc... Happy to rebase and squash once the initial reviews
are through.
---------
Signed-off-by: Vincent Biret <[email protected]>
Co-authored-by: Mustafa Zengin <[email protected]>
### Motivation, Context and Description
This PR merges the AOT-related changes to make
`SemanticKernel.Abstractions`, `SemanticKernel.Core`, and
`Connectors.Onnx` packages Native-AOT compatible into the main branch.
Closes: https://github.com/microsoft/semantic-kernel/issues/5411
---------
Co-authored-by: Mark Wallace <[email protected]>
### Motivation and Context
Draft PR to keep feature branch up-to-date
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
---------
Co-authored-by: Ben Thomas <[email protected]>
Co-authored-by: Ben Thomas <[email protected]>
### Motivation and Context
- Bumping SDK versions and small adjustments
- [Latest OpenAI beta.11 reverted capability to use more customized
Uri](https://github.com/openai/openai-dotnet/pull/192), which ensure SK
previous behavior, tests were brought back as the previous experience.
Fixes#8525
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Resolves: https://github.com/microsoft/semantic-kernel/issues/5409
1. Removed experimental flags on `FunctionInvocationFilter` and
`PromptRenderFilter`.
2. Updated documentation.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Upon reviewing the Microsoft Learn documentation update, it has come to
our attention that the TELEMETRY.md file contains outdated
recommendations regarding the setup of `ILoggerFactory`.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Ensure the documentation contains the latest recommendations and
improve clarity.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
SK has included the OTel semantic conventions as an experimental
feature.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
This PR updates the telemetry sample app to show case the feature and
removes the use of planners in the sample app as not all connectors work
with the Handlebars planner (The Handlebars planner has multiple system
messages, but the Gemini connector doesn't allow that).
This PR also updates the documentations for telemetry.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
---------
Co-authored-by: Xiaoyun Zhang <[email protected]>
Co-authored-by: Cassie Breviu <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Dmytro Struk <[email protected]>
### Motivation and Context
In this change we are restructuring our samples in the following
categories:
| Type | Description |
| ----------------- |
--------------------------------------------------------------------------------------------------------
|
| `Getting started` | A single step-by-step tutorial to get started |
| `Concepts` | A concept by feature specific code snippets |
| `LearnResources` | Code snippets that are related to online
documentation sources like Microsoft Learn, DevBlogs and others |
| `Tutorials` | More in depth step-by-step tutorials |
| `Demos` | Demostration applications that leverage the usage of one or
many features |
## Decision Drivers and Principles
- **Easy to Search**: Well organized structure, making easy to find the
different types of samples
- **Lean namings**: Folder, Solution and Example names are as clear and
as short as possible
- **Sends a Clear Message**: Avoidance of Semantic Kernel specific
therms or jargons
- **Cross Language**: The sample structure will be similar on all
supported SK languages.
## Strategy on the current existing folders
| Current Folder | Proposal |
| ------------------------------------ |
-------------------------------------------------------------------------
|
| KernelSyntaxExamples/Getting_Started | Move into `Getting Started` |
| KernelSyntaxExamples/`Examples??_*` | Decompose into `Concepts` on
multiple conceptual subfolders |
| AgentSyntaxExamples | Decompose into `Concepts` on `Agents` specific
subfolders. |
| DocumentationExamples | Move into `LearnResources` subfolder and
rename to `MicrosoftLearn` |
| CreateChatGptPlugin | Move into `Demo` subfolder |
| HomeAutomation | Move into `Demo` subfolder |
| TelemetryExample | Move into `Demo` subfolder and rename to
`TelemetryWithAppInsights` |
| HuggingFaceImageTextExample | Move into `Demo` subfolder and rename to
`HuggingFaceImageToText` |
## Concepts - Previously `KernelSyntax` and `AgentSyntax`.
Both `KernelSyntaxExamples` and `AgentSyntaxExamples` will be
distributed into example code by features below.
```
samples/Concepts/
├── Functions/
├── Chat Completion/
├── Text Generation/
├── Text to Image/
├── Image to Text/
├── Text to Audio/
├── Audio to Text/
├── Telemetry
├── Logging
├── Dependecy Injection
├── Plugins
├── Auto Function Calling
├── Filtering
├── Memory
├── Search
├── Agents
├── Templates
├── RAG
├── Prompts
└── LocalModels/
```
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Initial Agent Framework. Incudes:
- All critical abstractions
- ChatCompletionAgent
- All new projects / all marked with experimental attributes
- New `AgentSyntaxExamples`
### NOTE - NOT PUBLISHING NUGET
**Test Coverage (blocks / lines):**

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Shouldn't be any surprises. Let's take personal notes on naming
preference as there hasn't been finality in decision process. A final
refactor-rename and comment update at the end should be rapid (I'd
rather do renaming/organziation once than multiple times).
I'm going to stack PR's behind this, so in the interest of progress...
### Outstanding Tasks - In Order (each a future PR)
- [ ] AgentChat (our "GroupChat")
- [ ] Assistant-as-a-Plugin
- [ ] OpenAIAssistantAgent
- [ ] OpenAIAssistantAgent Citiation Content
- [ ] Port AutoGen examples
- [ ] Streaming
- [ ] YAML Templates
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Adds a new Microsoft.SemanticKernel.Connectors.Onnx component. As of
this PR, it contains one service,
BertOnnxTextEmbeddingGenerationService, for using BERT-based ONNX models
to generate embeddings. But in time we can add more ONNX-based
implementations for using local models.
This is in part based on
https://onnxruntime.ai/docs/tutorials/csharp/bert-nlp-csharp-console-app.html
and https://github.com/dotnet-smartcomponents/smartcomponents. It
doesn't support everything that's supported via sentence-transformers,
but we should be able to extend it as needed.
cc: @luisquintanilla, @SteveSandersonMS, @JakeRadMSFT
### Motivation and Context
Reduce the burden on developers who want to use SK experimental features
by reducing the number of `SKEXP` flags to the following list:
| SKEXP | Experimental Features Category |
|-------|--------------------------------|
| SKEXP0001 | Semantic Kernel core |
| SKEXP0010 | OpenAI and Azure OpenAI services |
| SKEXP0020 | Memory abstractions |
| SKEXP0040 | Function types |
| SKEXP0050 | Out-of-the-box plugins |
| SKEXP0060 | Planners |
| SKEXP0070 | AI connectors |
| SKEXP0100 | Advanced Semantic Kernel features |
### Description
Closes#5242
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
---------
Co-authored-by: Roger Barreto <[email protected]>
To provide guidance to the community, we'll be creating a formal list of
models we would like to support within the core repo of Semantic Kernel.
---------
Co-authored-by: Roger Barreto <[email protected]>
Co-authored-by: Krzysztof Kasprowicz <[email protected]>
### Motivation and Context
This PR contains main implementation part of #4662 and adds it into
`Functions.OpenApi.Extensions` project. There were also couple of bug
fixes in the mentioned PR, those will be handled in subsequent PRs.
API Manifest can describe capabilities of an AI plugin for a chat-based
system among other things. For a full description of API Manifest, see
the [API Manifest
Specification](https://darrelmiller.github.io/api-manifest/draft-miller-api-manifest.html).
API Manifest refers to one or more OpenAPI documents as API dependencies
and it selects a subset of operations from those documents to describe
the capabilities of an AI plugin.
### Description
Semantic Kernel has a way of creating plugins from OpenAPI operations,
but it has a couple of limitations that can be addressed with API
Manifest:
1. It can only create functions from OpenAPI operations that are
described in a single OpenAPI document.
2. It cannot reference multiple OpenAPI documents in a single plugin.
Not being able to slice OpenAPI operations is a major limitation,
especially for large APIs such as Microsoft Graph, which has over 1000
operations.
Today, we can create a Semantic Kernel plugin from an OpenAPI file and
one OpenAPI file corresponds to one plugin. We don't have a way of
selecting a subset of operations.
```mermaid
graph TB
subgraph OpenAPI1
operation11
operation12
operation13
end
subgraph OpenAPI2
operation21
operation22
operation23
end
subgraph OpenAPIPlugin1
function11
function12
function13
end
subgraph OpenAPIPlugin2
function21
function22
function23
end
operation11 -.- function11
operation12 -.- function12
operation13 -.- function13
operation21 -.- function21
operation22 -.- function22
operation23 -.- function23
style OpenAPIPlugin1 fill:blue,color:white
style OpenAPIPlugin2 fill:blue,color:white
```
### Proposed Solution
After Semantic Kernel APIManifest support, we will have an APIManifest
file, which will be used as a filter on OpenAPI files and it can
reference more than one OpenAPI file. The filter can be used as a guide
to select only certain operations to be converted into functions.
Assume that we want to create a single plugin with `function11` from
`OpenAPI1` and `function21` and `function22` from `OpenAPI2`. We want to
preserve the one-to-one mapping between the APIManifest and the plugin,
e.g. between `ApiManifestX` and `PluginX`:
```mermaid
graph TB
subgraph OpenAPI1
operation11
operation12
operation13
end
subgraph OpenAPI2
operation21
operation22
operation23
end
subgraph APIManifestX
reference11
reference21
reference22
end
subgraph PluginX
function11
function21
function22
end
reference11 -.- operation11
reference21 -.- operation21
reference22 -.- operation22
function11 -.- reference11
function21 -.- reference21
function22 -.- reference22
style APIManifestX fill:green,color:white
style PluginX fill:blue,color:white
```
If we use existing OpenAPI to Plugin public methods after on-the-fly
slicing, we can only achieve the following because there is an
assumption that a single OpenAPI is converted into a single plugin,
which breaks APIManifest to Plugin one-to-one mapping. A single
`APIManifestX` file corresponds to two plugins, namely, `PluginX1` and
`PluginX2`:
```mermaid
graph TB
subgraph OpenAPI1
operation11
operation12
operation13
end
subgraph OpenAPI2
operation21
operation22
operation23
end
subgraph APIManifestX
reference11
reference21
reference22
end
subgraph OpenAPI1_Sliced
operation11_sliced[operation11]
end
subgraph OpenAPI2_Sliced
operation21_sliced[operation21]
operation22_sliced[operation22]
end
subgraph PluginX1
function11
end
subgraph PluginX2
function21
function22
end
reference11 -.- operation11
reference21 -.- operation21
reference22 -.- operation22
operation11 -.- operation11_sliced -.- function11
operation21 -.- operation21_sliced -.- function21
operation22 -.- operation22_sliced -.- function22
style APIManifestX fill:green,color:white
style PluginX1 fill:blue,color:white
style PluginX2 fill:blue,color:white
```
To avoid this, the implementation of regular OpenAPI plugin generation
and API Manifest plugin generation meets at the function generation
level, so reuse starts at `CreateRestApiFunction`.
The PR also adds a KernelSyntaxExample for `/me/messages` endpoint of
Microsoft Graph.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
---------
Co-authored-by: SergeyMenshykh <[email protected]>
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
This PR contains new interface for audio-to-text services and
implementation of OpenAI connector to use Azure/OpenAI Whisper model.
The implementation relies on Azure .NET SDK.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Added new `IAudioToTextService` interface.
2. Added new `AzureOpenAIAudioToTextService` and
`OpenAIAudioToTextService` implementations.
3. Added new `OpenAIAudioToTextExecutionSettings` to define
audio-to-text configuration (e.g. filename, language etc.).
4. Added unit and integration tests.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Add support for Open AI File Service:
- https://platform.openai.com/docs/api-reference/files
- https://api.openai.com/v1/files
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
ADR: https://github.com/microsoft/semantic-kernel/pull/4803
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
This PR contains changes to introduce Function and Prompt Filters - the
functionality, which is similar to hooks, but uses different
registration model. Instead of attaching event handlers (e.g.
`kernel.FunctionInvoking += MyHandler`), it is possible to implement
middleware functionality in separate class by implementing
`IFunctionFilter` interface for function execution middleware and
`IPromptFilter` interface for prompt rendering middleware.
It is possible to register multiple function and prompt filters. The
functionality is implemented near hooks, so both hooks and filters are
supported.
In similar way as hooks, filters allow to:
1. Get and override function result value.
2. Get function information and metadata (including token usage).
3. Get and override kernel arguments.
4. Cancel function execution.
5. Get and override rendered prompt before sending it to AI.
Usage Example:
MyFunctionFilter.cs
```csharp
public class MyFunctionFilter : IFunctionFilter
{
public void OnFunctionInvoked(FunctionInvokedContext context)
{
// Process data after function invocation
}
public void OnFunctionInvoking(FunctionInvokingContext context)
{
// Process data before function invocation
}
}
```
Registration
```csharp
var builder = Kernel.CreateBuilder();
builder.Services.AddSingleton<IFunctionFilter, MyFunctionFilter>();
var kernel = builder.Build();
```
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
- Mark gRPC and OpenAPI functions as experimental, to improve them in
v1.
- Enable dynamic payload building by default, aligning with the
functionality of other functions.
---------
Co-authored-by: Roger Barreto <[email protected]>
### Motivation and Context
Adding the experimental attribute to packages and classes in the .NET
SDK of Semantic Kernel to mark things that won't be ready be v1.0.0 of
Semantic Kernel.
### Contribution Checklist
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
---------
Co-authored-by: Mark Wallace <[email protected]>
### Motivation and Context
Replace `Skill` with `Plugin` in docs and dotnet readme's
### Contribution Checklist
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
## Summary
This set of commits updates the terminology used in the project from
SKILLS to PLUGINS. SKILLS have been renamed to PLUGINS throughout the
codebase, and related documentation and comments have been updated
accordingly. Additionally, the telemetry metrics have been updated to
reflect the new naming convention.
## Changes
- Rename SKILLS to PLUGINS throughout the codebase
- Update related documentation and comments
- Update telemetry metrics to reflect new naming convention
---
*Powered by [Microsoft Semantic
Kernel](https://github.com/microsoft/semantic-kernel)*
### Motivation and Context
This pull request updates the logger creation in various classes
throughout the project, replacing the usage of `nameof` with `typeof` to
ensure that the logger instances are created with the correct type
information.
When objects create loggers using only the class or type name results in
the need to control filtering for each individual class or type. If we
instead use the full name of the class or type, we can depend on
namespace level filtering.
```
builder.AddFilter("Microsoft", LogLevel.Warning);
builder.AddFilter("Microsoft.SemanticKernel", LogLevel.Critical);
builder.AddFilter("Microsoft.SemanticKernel.Reliability", LogLevel.Information);
```
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
---------
Co-authored-by: Dmytro Struk <[email protected]>
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
This PR contains changes in telemetry to add logging and metering for
prompt, completion and total tokens used for each request to Azure
OpenAI/OpenAI APIs.
Example of logging in Application Insights:

Example of metering in Application Insights:

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Added logging and metering for tokens information in `ClientBase`
class of OpenAI connector.
2. Fixed examples.
3. Updated telemetry documentation.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
This PR contains documentation for telemetry in SK, including
information about _logging_, _metering_ and _tracing_.
Note: I created new `dotnet/docs` folder to keep all documentation
related to SK .NET version.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄