Commit Graph
29 Commits
Author SHA1 Message Date
ChrisandGil LaHaye 47b879435d .Net: Experimental Feature - Assistants API (#3446)
### 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 is an experimental feature that integrates Open AI assistants into
Semantic Kernel:


https://devblogs.microsoft.com/semantic-kernel/assistants-the-future-of-semantic-kernel/

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

This change introduces an assistant framework that integrates with
semantic-kernel patterns, particularly around function calling.

https://platform.openai.com/docs/api-reference/assistants

Assistant usage is showcased in two `KernelSyntaxExamples`.

This initial version does not support:

- Files
- Retrieval
- Code Interpreter



<img width="308" alt="image"
src="https://github.com/microsoft/semantic-kernel/assets/66376200/fc221f53-1717-4767-828c-4f90fd5d0129">

### 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: Gil LaHaye <[email protected]>
2023-11-15 23:03:53 +00:00
21a12849ce .Net: MongoDB memory store connector for .NET (#2950)
### Motivation and Context
Resolves: #2817

### Description

MongoDB memory store connector for .NET, build on top of MongoDB .NET
driver. A memory store abstraction that facilitates connections between
a MongoDB Atlas cluster to conduct [Atlas Vector
Search](https://www.mongodb.com/products/platform/atlas-vector-search)
on the Microsoft Semantic Kernel.

### 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: Mark Wallace <[email protected]>
Co-authored-by: Dmytro Struk <[email protected]>
2023-11-09 16:43:05 +00:00
Mark Wallace 86a2e3f491 .Net: Handlebars prompt template support (#3392)
### 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: -->

- [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 😄
2023-11-08 22:18:44 +00:00
+11 19815a7432 .Net: Add Flow Orchestrator extension to Semantic Kernel (#3023)
## Summary
This pull request adds the Flow Orchestrator extension to the Semantic
Kernel. The Flow Orchestrator extension provides a way to define and
execute complex workflows using a YAML-based DSL. The extension includes
several new classes and extension methods, as well as a new project file
and several new files in the Extensions/Experimental/Orchestration.Flow
directory.

## Changes
- Added Experimental.Orchestration.Flow.csproj
- Added ContextVariablesExtensions.cs
- Added FlowExtensions.cs
- Added SKContextExtensions.cs
- Added new file SKContextExtensions.cs
- Added new file FlowOrchestrator.cs
- Added new file FlowOrchestratorConfig.cs
- Added FlowOrchestratorConfig class to provide configuration options
for the ReAct engine used by the Flow orchestrator
- Added FlowOrchestrator class to provide a way to define and execute
complex workflows using a YAML-based DSL
- Added SKContextExtensions class to provide several extension methods
for the SKContext class
- Added FlowExtensions class to provide extension methods for the Flow
class

---
*Powered by [Microsoft Semantic
Kernel](https://github.com/microsoft/semantic-kernel)*

Fixes #2164


![image](https://github.com/microsoft/semantic-kernel/assets/35783676/a065e637-c89f-4f2e-986e-629b71ccf81c)

### 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 😄
- [x] Successful [Integration
Tests](https://github.com/microsoft/semantic-kernel/actions/runs/6355696897/job/17264142726)
[Integration
Tests](https://github.com/microsoft/semantic-kernel/actions/runs/6551142172)

@yan-li 
Co-authored-by: Yan Li
[[email protected]](mailto:[email protected])

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Yan Li <[email protected]>
Co-authored-by: Yan Li <[email protected]>
Co-authored-by: Mark Karle <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shawn Callegari <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
Co-authored-by: Dmytro Struk <[email protected]>
Co-authored-by: Eduard van Valkenburg <[email protected]>
Co-authored-by: SergeyMenshykh <[email protected]>
Co-authored-by: Lisa Harrylock <[email protected]>
Co-authored-by: Shay Rojansky <[email protected]>
Co-authored-by: Anthony Puppo <[email protected]>
Co-authored-by: Weihan Li <[email protected]>
Co-authored-by: Jadyn <[email protected]>
Co-authored-by: Matthew Bolaños <[email protected]>
Co-authored-by: Abby Harrison <[email protected]>
Co-authored-by: Weihan Li <[email protected]>
Co-authored-by: Gina Triolo <[email protected]>
Co-authored-by: Jib <[email protected]>
2023-11-06 20:27:15 +00:00
Mark WallaceandDmytro Struk fbe29e5e15 .Net: Merge Semantic Function back into SK Core Refactor Semantic Functions to SemanticKernel.Core (#3199)
### Motivation and Context

### Description

### Contribution Checklist

- [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 😄

## Summary
This pull request refactors the Semantic Functions project to use the
SemanticKernel.Core project instead of the Functions.Semantic project.
The SemanticKernel.Core project is now used for the SemanticFunction,
PromptTemplate, and PromptTemplateConfig classes. The Plugins.Core
project no longer references the Functions.Semantic project. The
SemanticFunctionTests and PromptTemplateConfigTests classes have been
moved to the SemanticKernel.UnitTests project.

## Changes
- Removed ProjectReference to Functions.Semantic.csproj from
Plugins.Core.csproj
- Renamed KernelSemanticFunctionExtensions.cs to
Extensions/KernelSemanticFunctionExtensions.cs
- Renamed SemanticFunction.cs to Functions/SemanticFunction.cs
- Renamed PromptTemplate.cs to TemplateEngine/PromptTemplate.cs
- Renamed PromptTemplateConfig.cs to
TemplateEngine/PromptTemplateConfig.cs
- Removed ProjectReference to Functions.Semantic.csproj from
SemanticKernel.MetaPackage.csproj
- Moved SemanticFunctionTests.cs to SemanticKernel.UnitTests/Functions/
- Moved PromptTemplateConfigTests.cs to
SemanticKernel.UnitTests/TemplateEngine/

---
*Powered by [Microsoft Semantic
Kernel](https://github.com/microsoft/semantic-kernel)*

---------

Co-authored-by: Dmytro Struk <[email protected]>
2023-10-17 14:25:25 +00:00
Stephen Toub d50361e7a1 .Net: Use the new TensorPrimitives for numerical operations (#3113)
### Motivation and Context

Fixes https://github.com/microsoft/semantic-kernel/issues/3021

### Description

Obsoletes the numerical APIs (they should be removed when appropriate)
and replaces usage with the new System.Numerics.Tensors.TensorPrimitives
type.

### Contribution Checklist

- [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
- [ ] I didn't break anyone 😄
2023-10-10 17:56:39 +00:00
Mark Wallace 88e8e96a10 .Net: Rename the Microsoft.SemanticKernel.TemplateEngine.PromptTemplateEngine package (#3077)
Rename the Microsoft.SemanticKernel.TemplateEngine.PromptTemplateEngine
package to Microsoft.SemanticKernel.TemplateEngine.Basic to match the
naming convention we are adopting

### Motivation and Context

Consistent naming across the Semantic Kernel packages

### Description

### Contribution Checklist

- [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 😄
2023-10-06 13:10:21 +00:00
Dmytro Struk 705defb220 .Net: Memory Plugin extraction - Part 1 (#3042)
### 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 is based on feature branch created by @shawncal:
https://github.com/microsoft/semantic-kernel/tree/feature/memory-plugin

The changes include moving part of Memory-related logic to separate
`Plugins.Memory` project, as preparation to remove `Memory` property
from `Kernel` type (which will be added as Part 2 of this task). More
information is available in ADR.

Part 2 of this task will be available as soon as the other task
regarding service/plugin registration in Kernel will be implemented and
merged to `main` branch. In this case, it will be possible to remove
Memory logic from main packages completely, and inject Memory as Plugin
into other Plugins that require it.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Created new project `Plugins.Memory`. 
2. Moved Memory-related logic to `Plugins.Memory` project.
3. Moved Memory-related unit tests to `Plugins.UnitTests` project.
4. Added `Plugins.Memory` project as part of Semantic Kernel
metapackage.
5. Updated access level of Memory data structures to `public` as part of
new `Plugins.Memory` project (so they are accessible by tests and users
if needed).
6. Added ADR,

### 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
- [ ] I didn't break anyone 😄
- This PR contains breaking changes as namespaces for several
Memory-related classes were changed according to new project location.
2023-10-04 13:23:35 +00:00
Mark Wallace 1fad7a12d9 .Net: Extract semantic functions from Kernel.Core (#2961)
### Motivation and Context

1. Why is this change required? This is part of the work to extract
functionality from Semantic Kernel core prior to 1.0 release.
2. What problem does it solve? Isolates the semantic function
implementation from the Semantic Kernel core.
3. What scenario does it contribute to? Contributes to the goal of
reducing the Semantic Kernel core to focus on AI orchestration.
4. If it fixes an open issue, please link to the issue here.
https://github.com/microsoft/semantic-kernel/issues/2563
Fixes #2563
### Description

- Move classes from abstractions SemanticFunctions folder to new
functions.semantic project
- Move classes from core SemanticFunctions and SkillDefinition folders
to new functions.semantic project
- Fix up all unit tests

### Contribution Checklist

- [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 😄
2023-09-27 10:49:00 +00:00
Lisa HarrylockandMark Wallace fbd0afd687 .Net: Merge planner packages2 (#2931)
### Motivation and Context

Combining the planner files into one package makes it easier to provide
a consistent interface for planners.
Fixes #2856

This introduces breaking changes since the namespaces for the planners
changed.

### Description
* Created Planners.Core and Planners.Core.UnitTests projects under new
folder Planners
* Created a folder for each type of planner within the Planners project
* Moved planner files to their new project and folder.
* Removed old projects

### 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
- [ ] I didn't break anyone 😄 - Namespaces for planner files
changed

---------

Co-authored-by: Mark Wallace <[email protected]>
2023-09-25 17:41:50 +00:00
Lee Miller 4a2cf70c9f .Net: Add new token counter implementations to TextChunker (#2840)
Implement MicrosoftML and DeepDev token counters in the TextChunker
example. Update the project file with new package references and modify
the RunExampleWithCustomTokenCounter method to support different token
counter types.

Inspired by #2809 

Fixes #478 

| Iteration | MicrosoftML (ms) | MicrosoftMLRoberta (ms) | SharpToken
(ms) | DeepDev (ms) |

|------------|-------------------|--------------------------|-----------------|--------------|
| 1 | 38 | 10,189 | 14,305 | 16,701 |
| 2 | 36 | 5,581 | 8,381 | 14,214 |
| 3 | 13 | 5,354 | 7,955 | 13,630 |
| 4 | 27 | 5,679 | 9,156 | 16,164 |
| 5 | 16 | 5,158 | 8,657 | 17,276 |
| Average | 26.0 | 7,512.2 | 9,710.8 | 15,597 |




### SharpToken
<sup style="font-size: smaller;">(Avg. Execution Time: 9,710.8 ms)</sup>
```
The city of Venice, located in the northeastern part of Italy,
is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the
Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and
Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine
mosaics, and the Campanile bell tower offering views of the city's red roofs.
------------------------
The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that
covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which
5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations
and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining
rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world.
------------------------
The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands
stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the
Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's
biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms,
known as coral polyps.
```

### MicrosoftML
<sup style="font-size: smaller;">(Avg. Execution Time: 26.0 ms)</sup>
```

The city of Venice,
located in the northeastern part of Italy,
is renowned for its unique
geographical features.
Built on more than 100 small
------------------------
islands in a lagoon in the
Adriatic Sea, it has no roads,
just canals including the Grand Canal
thoroughfare lined with Renaissance and
------------------------
Gothic palaces.
The central square,
Piazza San Marco, contains St.
Mark's Basilica, which is tiled with Byzantine
mosaics,
------------------------
and the Campanile bell tower offering
views of the city's red roofs.
The Amazon Rainforest, also known as Amazonia,
------------------------
is a moist broadleaf tropical
rainforest in the Amazon biome that
covers most of the Amazon
basin of South America.
This basin encompasses 7
------------------------
million square kilometers,
of which
5.
5 million square kilometers
are covered by the rainforest.
This region includes territory
------------------------
belonging to nine nations
and 3.
4 million square kilometers
of uncontacted tribes.
The Amazon represents over
------------------------
half of the planet's remaining
rainforests and comprises the largest and most
biodiverse tract of tropical
rainforest in the world.
------------------------
The Great Barrier Reef is the world's
largest coral reef system composed of over 2,
900 individual reefs and 900 islands
------------------------
stretching for over 2,
300 kilometers over an
area of approximately 344,
400 square kilometers.
The reef is located in the
------------------------
Coral Sea, off the coast of Queensland,
Australia.
The Great Barrier Reef can be seen
from outer space and is the world's
------------------------
biggest single structure
made by living organisms.
This reef structure is composed of and
built by billions of tiny organisms, known as coral polyps.
```

### MicrosoftMLRoberta
<sup style="font-size: smaller;">(Avg. Execution Time: 7,512.2 ms)</sup>
```
The city of Venice, located in the northeastern part of Italy,
is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the
Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and
Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine
mosaics, and the Campanile bell tower offering views of the city's red roofs.
------------------------
The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that
covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which
5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations
and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining
rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world.
------------------------
The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands
stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the
Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's
biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms,
known as coral polyps.
```

### DeepDev
<sup style="font-size: smaller;">(Avg. Execution Time: 15,597 ms)</sup>
```
The city of Venice, located in the northeastern part of Italy,
is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the
Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and
Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine
mosaics, and the Campanile bell tower offering views of the city's red roofs.
------------------------
The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that
covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which
5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations
and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining
rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world.
------------------------
The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands
stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the
Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's
biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms,
known as coral polyps.
```

### 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 😄
2023-09-22 19:07:27 +00:00
Mark WallaceandRoger Barreto 559d6f339f .Net: Rename the folder containing the SemanticKernel.Core project (#2919)
### Motivation and Context

Rename the folder containing the SemanticKernel.Core project to match
the project name

### Contribution Checklist

- [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: Roger Barreto <[email protected]>
2023-09-22 09:38:38 +00:00
Mark Wallace 1221fd7948 .Net: Rename the SemanticKernel project to SemanticKernel.Core (#2909)
### Motivation and Context

`SemanticKernel` core project should be named `SemanticKernel.Core` to
match the assembly name and be consistent with other projects


![image](https://github.com/microsoft/semantic-kernel/assets/127216156/166229eb-b847-4d5f-9fdb-2b4a688e28c7)

### Contribution Checklist

- [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 😄
2023-09-20 16:15:09 -07:00
Mark Wallace 99b5ed8ec8 .Net: Rename 'Skills' -> 'Plugins' - Part 2 (#2863)
### Motivation and Context

Rename Skills to Functions for GRPC and OpenAPI packages. Second sub
task from https://github.com/microsoft/semantic-kernel/issues/2119.

### Description

1. Move GRPC and OpenAPI projects to a new `Functions` folder on disk
and in the solution
1. Update GRPC and OpenAPI projects to use Functions instead of Skills
in assembly names, namespace, class names
1. Rename Skills.UnitTests to Functions.UnitTests project

Solution Explorer

![image](https://github.com/microsoft/semantic-kernel/assets/127216156/ebc4562a-4a45-435f-a06d-edd611cdfb03)

### 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 😄
2023-09-19 13:55:22 +00:00
Mark Wallace c10f7c4e3a .Net: Rename 'Skills' -> 'Plugins' - Part 1 (#2854)
### Motivation and Context

Rename `Skills` to `Plugins`. First sub task from
https://github.com/microsoft/semantic-kernel/issues/2119.

### Description

This is the first PR

1. Move Core, Document, MsGraph and Web skill projects to a new
`Plugins` folder
2. Update Core, Document, MsGraph and Web projects to use `Plugins`
instead of `Skills` in assembly names, namespace, class names
3. Extract text from `Skills.UnitTests` and create new
`Plugins.UnitTests` project

Solution Explorer:

![image](https://github.com/microsoft/semantic-kernel/assets/127216156/16dd8146-d8a0-44e3-8995-894afb644e09)

File Explorer:

![image](https://github.com/microsoft/semantic-kernel/assets/127216156/1aef0bd9-ac54-492f-8725-eac0d3e6db86)

### Contribution Checklist

- [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
- [ ] I didn't break anyone 😄
2023-09-18 18:58:36 +00:00
Dmytro Struk 2111f5b529 .Net: Removed GPT3Tokenizer and related files (#2809)
### 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.
-->

Closes https://github.com/microsoft/semantic-kernel/issues/2679
Closes https://github.com/microsoft/semantic-kernel/issues/2508
Closes https://github.com/microsoft/semantic-kernel/issues/2334

This PR contains changes to remove `GPT3Tokenizer` from Semantic Kernel
repository.

Alternatives:
https://github.com/microsoft/Tokenizer
https://github.com/dmitry-brazhenko/sharptoken

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Removed tokenizer logic, tests and related files.
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
- [ ] I didn't break anyone 😄
2023-09-14 17:26:47 +00:00
434b3cfaab .Net: Update missing documentation (#2538)
### 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.
-->
CA1591 was suppressed, so many files were missing documentation. This
removes that suppression and adds comments. I used
https://github.com/mkarle/sk-autodocs to automatically generate the
documentation.

### Description
- Unsuppressed CA1591 from top-level editorconfig but kept it suppressed
for unit tests
- Ran `dotnet build | Out-File -FilePath .\log.log` to get a log of
missing XML documentation
- Ran ` sk-autodocs --dotnet-build-log log.log` to generate
documentation for the files missing documentation
- Went through each file and (hopefully) corrected any mistakes. The
most common problems were that it would change the namespace to braces
or remove the empty line at the end.

<!-- 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: Lisa Harrylock <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
2023-09-07 08:25:23 +00:00
Shawn CallegariandDmytro Struk f833bcd240 .Net: Combining memory connector examples into TextMemorySkill (#2421)
Combining all the (nearly identical) memory connector syntax examples
into the single Example15_TextMemorySkill.cs example.


### Motivation and Context
General cleanup and code reduction. 

### 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]>
2023-09-05 18:56:24 +00:00
Roger Barreto 5de1dbac66 .Net: Extract Retry Implementation (#2656)
### Motivation and Context

Reduce the responsibility surface of Semantic Kernel regarding
Resiliency implementations, keeping only the abstractions that can be
delegated and handling by well know resiliency libraries and custom
implementations.

Extract existing logic from Kernel Core to an extension project that can
handle retry logic similar to the prior using Polly Policies.

Resolves #2271
Closes #2271 

⚠️ Small breaking changes.

### Description

This change removes and deprecates the usage of Retry implementations in
our Resiliency namespace with `NullHttpHandlerFactory` implementations.

### Contribution Checklist

- [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
- [ ] I didn't break anyone 😄
2023-09-04 16:51:06 +00:00
Mark Wallace 562d73c6cf .Net: Extract template engine from Kernel.Core (#2562)
### Motivation and Context

1. Why is this change required? This is part of the work to extract
functionality from Semantic Kernel core prior to 1.0 release.
2. What problem does it solve? Provides a pattern to follow for
additional template engine implementations.
3. What scenario does it contribute to? Contributes to the goal of
reducing the Semantic Kernel core to focus on AI orchestration.
4. If it fixes an open issue, please link to the issue here.
https://github.com/microsoft/semantic-kernel/issues/2527

### Description

- Create new template engine project in the extensions folder
- Move template engine code from semantic kernel abstractions and core
- Refactor `IPromptTemplateEngine` so that it doesn't depend on details
of the default implementation
- Refactor `PromptTemplateEngine` to match the new interface definition
- Move template engine unit tests to the extensions unit tests project

### Contribution Checklist

- [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 😄
2023-08-29 08:50:11 +00:00
4721625e6a .Net: Adding Kusto as an external memory (#2257)
### 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

Adding Kusto as an external memory.

### 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]>
Co-authored-by: Shawn Callegari <[email protected]>
2023-08-10 20:53:29 +00:00
Devis Lucato 8b4d916561 Rename Azure Search to Azure Cognitive Search (#2075)
### Motivation and Context

The service was renamed to Azure Cognitive Search in 2019, so we should
follow the new convention. The only thing still named "Azure Search" is
the old Azure SDK, out of scope.

### Description

* Revert nuget package name to the previous name (we'll delete the new
package, which has been out only for few days)
* Rename C# and Python classes and namespaces
2023-07-19 21:11:13 +00:00
01afd3f128 .Net: Update KernelSyntaxExamples env variables (#1832)
### Description
Updating KernelSyntaxExamples to use the same environment variable keys
as the Integration tests. This is a step toward making these tests
simpler to run, and even running them as automation in CI tests.

This is a first pass -- more cleanup to be done.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [X] The code builds clean without any errors or warnings
- [X] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [X] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 😄

---------

Co-authored-by: name <email>
Co-authored-by: Dmytro Struk <[email protected]>
2023-07-17 17:36:06 +00:00
Devis Lucato 5024744217 Python, DotNet: New Semantic Memory Storage based on Azure Cognitive Search (#1439)
* .NET, Python: Add new Memory Storage based on Azure Cognitive Search
with custom embeddings
* .NET: Delete previous Azure Search semantic memory component based on old
Azure Semantic Search w/ Lucene
2023-07-16 00:20:09 -07:00
Stephen ToubandShawn Callegari e7ba201b16 Downgrade several 7.0.* packages to 6.0.* (#1799)
This pains me, as it's a technical step backwards. But there are two
problems today:
1) The .NET support policy today unfortunately applies not only to the
.NET SDK and runtime but also to nuget packages released in the same
wave, which means that if someone is relying on eg System.Text.Json and
is running on .NET 6, having SK depend on System.Text.Json with a
minimum version of 7.0 forces the consumer to also use the 7.0 version
of System.Text.Json from the nuget, which then means that one assembly
falls under the STS support policy instead of LTS support policy, which
means that one assembly will have support end for it a few months
earlier than it otherwise would. I've raised this issue for further
evaluation on the .NET side of things, but in the meantime, this lowers
the version number to remove the perceived problem and possible barrier
to adoption.
2) Azure Functions has two deployment models: in-process and isolated.
Ideally functions use isolated, which gives them the freedom to
reference whatever they need. The in-process model is exactly what it
sounds like: the function runs in the same process as the host, and the
host pins several dependencies at 6.0 versions. That means that if a
function references a 7.0 version, it'll fail to load in the in-process
model. While we'd like for folks to be using the isolated model, we
can't force it, and we don't want a need for the in-process model to
block SK usage.

This commit downgrades back to the 6.0 versions, at least where
possible. Some of the connectors reference libraries (e.g. NRedisStack,
pgvector, etc.) that themselves have a 7.0 dependency.

Closes https://github.com/microsoft/semantic-kernel/issues/1793

---------

Co-authored-by: Shawn Callegari <[email protected]>
2023-07-04 05:21:13 +00:00
49e20107b9 Add StepwisePlanner extension for MRKL style planning (#1468)
### Motivation and Context
This pull request adds a new extension for semantic planning using a
stepwise approach. The StepwisePlanner extension allows users to create
and execute plans that consist of a sequence of semantic and native
functions, each with a goal and a set of inputs and outputs. The
extension uses a semantic search engine to find relevant functions for
each step, and a plan creation service to generate a plan that satisfies
the user's ask. The extension also provides a system step function that
executes the plan and returns the final answer and intermediate
observations. The extension can be configured with various parameters,
such as the relevancy threshold, the maximum number of relevant
functions, the excluded and included functions and skills, and the
maximum number of tokens, iterations, and time for the plan.

Regarding #1472

### Description
- Add StepwisePlanner.cs, which registers the planner native functions
and the system step function
- Add StepwisePlannerConfig.cs, which defines the configuration options
for the StepwisePlanner extension
- Add SystemStep.cs, which represents a step in a Stepwise plan, with
properties for the thought, action, action variables, observation, final
answer, and original response
- Add helper methods for formatting and validating function views,
generating plan requests, and invoking the plan.
- Add logging and error handling for the planner extension
- Add unit tests for the planner extension and the native functions

### Related
- Majority of work initially started from @kaza in #992 

### Changes in other PRs to merge separately
- #1464
- #1465 
- #1466 

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Almir Kazazic <[email protected]>

---------

Co-authored-by: Lee Miller <[email protected]>
2023-06-26 19:32:19 +00:00
Dmytro Struk 85d420f77c Chroma memory store - C# implementation (#1634)
### 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 for Chroma C# memory store. 
For more information about Chroma, see:
https://docs.trychroma.com/getting-started.

To run integration tests, local Chroma server should be up and running.

To start local Chroma server for testing (this information is also
included in
[README](https://github.com/microsoft/semantic-kernel/blob/0fb77e0c0f347e3f22d79b3c99e7f84d35340462/dotnet/src/Connectors/Connectors.Memory.Chroma/README.md)):
1. Clone Chroma:

```bash
git clone https://github.com/chroma-core/chroma.git
cd chroma
```

2. Run local Chroma server with Docker within Chroma repository root:

```bash
docker-compose up -d --build
```

3. Use Semantic Kernel with Chroma, using server local endpoint
`http://localhost:8000`:
```csharp
const string endpoint = "http://localhost:8000";

ChromaMemoryStore memoryStore = new(endpoint);

IKernel kernel = Kernel.Builder
    .WithLogger(logger)
    .WithOpenAITextEmbeddingGenerationService("text-embedding-ada-002", "OPENAI_API_KEY")
    .WithMemoryStorage(memoryStore)
    //.WithChromaMemoryStore(endpoint) // This method offers an alternative approach to registering Chroma memory store.
    .Build();
```

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

Main public classes:
1. `ChromaMemoryStore` - implementation of `IMemoryStore` interface.
Uses `ChromaClient` to communicate with Chroma API. Throws
`ChromaMemoryStoreException` in case of issues.
2. `ChromaClient` - responsible for communication with Chroma API.
Throws `ChromaClientException` in case of issues.

Chroma entity models:
1. `ChromaCollectionModel` - defines Chroma collection.
2. `ChromaEmbeddingsModel` - defines Chroma embeddings, constructed from
`MemoryRecord`.
3. `ChromaQueryResultModel` - defines Chroma search result set.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
2023-06-26 19:24:30 +00:00
395525702b Move SK.CoreSkills to new package: SK.Skills.Core (#1623)
### Motivation and Context
Slimming down the kernel core project, nuget package.

### Description
These "Core Skills" are good ones to have, but are not fundamental to
the operation of SK. They will continue to be included in the
"Microsoft.SemanticKernel" nuget metapackage, but if a developer chooses
to just install the minimal "Microsoft.SemanticKernel.Core", they may
not want these skills. This packages them so that they are now optional.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [X] The code builds clean without any errors or warnings
- [X] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [X] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 😄

---------

Co-authored-by: name <email>
Co-authored-by: Lee Miller <[email protected]>
2023-06-22 08:13:54 +00:00
Shawn Callegariandname f8a8d884ff Moving KernelSyntaxExamples into the dotnet/ folder (#1616)
"KernelSyntaxExamples" is the only outstanding project under /samples
that still uses project references to access the kernel libraries.

This change consolidates all the building, linked dotnet SDK code in
SK-dotnet.sln into a single top-level folder. This will simplify build
jobs, automatic code owner assignment, and other dev ops tasks.

Coming next: other projects in samples will get removed from the
dotnet/SK-dotnet.sln solution, and a new solution with dedicated builds
created for the /samples folder.

TBD:
- Language-specific code "samples" will move into a similar subfolder
for each language.
- The current "/samples" folder (at the root) will likely become
something like "apps", with the demo apps promoted to the top-level
folder for better discoverability.
- notebooks may also move to this folder in the future.

Co-authored-by: name <email>
2023-06-21 01:37:54 +00:00