Skip to content

Commit dfa1e45

Browse files
authored
Updating documentation with VectorSearch, VectorData and InMemory refactor (#343)
1 parent ce05787 commit dfa1e45

27 files changed

+881
-145
lines changed

.openpublishing.redirection.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,12 @@
747747
},
748748
{
749749
"source_path": "semantic-kernel/how-to/vector-store-data-ingestion.md",
750-
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/vector-store-data-ingestion",
750+
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/how-to/vector-store-data-ingestion",
751+
"redirect_document_id": false
752+
},
753+
{
754+
"source_path": "semantic-kernel/concepts/vector-store-connectors/vector-store-data-ingestion.md",
755+
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/how-to/vector-store-data-ingestion",
751756
"redirect_document_id": false
752757
},
753758
{
@@ -757,7 +762,12 @@
757762
},
758763
{
759764
"source_path": "semantic-kernel/how-to/vector-store-custom-mapper.md",
760-
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/vector-store-custom-mapper",
765+
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/how-to/vector-store-custom-mapper",
766+
"redirect_document_id": false
767+
},
768+
{
769+
"source_path": "semantic-kernel/concepts/vector-store-connectors/vector-store-custom-mapper.md",
770+
"redirect_url": "/semantic-kernel/concepts/vector-store-connectors/how-to/vector-store-custom-mapper",
761771
"redirect_document_id": false
762772
},
763773
{

semantic-kernel/concepts/ai-services/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
- name: Chat completion
44
href: chat-completion/TOC.yml
55
expanded: true
6-
- name: Integrations
6+
- name: AI Integrations
77
href: integrations.md
Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: integrations
2+
title: AI Integrations for Semantic Kernel
33
description: Learn which features are available for C#, Python, and Java through integrations.
44
author: sophialagerkranspandey
55
ms.topic: reference
@@ -8,13 +8,13 @@ ms.date: 07/11/2023
88
ms.service: semantic-kernel
99
---
1010

11-
# Integrations for Semantic Kernel
11+
# AI Integrations for Semantic Kernel
1212

13-
Semantic Kernel provides a wide range of integrations to help you build powerful AI agents. These integrations include AI services, memory connectors. Additionally, Semantic Kernel integrates with other Microsoft services to provide additional functionality via plugins.
13+
Semantic Kernel provides a wide range of AI service integrations to help you build powerful AI agents. Additionally, Semantic Kernel integrates with other Microsoft services to provide additional functionality via plugins.
1414

1515
## Out-of-the-box integrations
1616

17-
With the available AI and memory connectors, developers can easily build AI agents with swappable components. This allows you to experiment with different AI services and memory connectors to find the best combination for your use case.
17+
With the available AI connectors, developers can easily build AI agents with swappable components. This allows you to experiment with different AI services to find the best combination for your use case.
1818

1919
### AI Services
2020

@@ -28,56 +28,11 @@ With the available AI and memory connectors, developers can easily build AI agen
2828
| Text to Audio (Experimental) |||| Example: Text-to-speech |
2929
| Audio to Text (Experimental) |||| Example: Whisper |
3030

31-
32-
### Memory Connectors (Experimental)
33-
34-
Vector databases have many use cases across different domains and applications that involve natural language processing (NLP), computer vision (CV), recommendation systems (RS), and other areas that require semantic understanding and matching of data.
35-
36-
One use case for storing information in a vector database is to enable large language models (LLMs) to generate more relevant and coherent responses based on an [AI plugin](../create-plugins/index.md).
37-
38-
However, large language models often face challenges such as generating inaccurate or irrelevant information; lacking factual consistency or common sense; repeating or contradicting themselves; being biased or offensive. To overcome these challenges, you can use a vector database to store information about different topics, keywords, facts, opinions, and/or sources related to your desired domain or genre.
39-
Then, you can use a large language model and pass information from the vector database with your AI prompt to generate more accurate and relevant content.
40-
41-
For example, if you want to write a blog post about the latest trends in AI, you can use a vector database to store the latest information about that topic and pass the information along with the ask to a LLM in order to generate a blog post that leverages the latest information.
42-
43-
## Available connectors to vector databases
44-
Today, Semantic Kernel offers several connectors to vector databases that you can use to store and retrieve information. These include:
45-
46-
47-
| Service | C# | Python |
48-
|--------------------------|:----:|:------:|
49-
| Vector Database in Azure Cosmos DB for NoSQL | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/azure_cosmosdb_no_sql)
50-
| Vector Database in vCore-based Azure Cosmos DB for MongoDB | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/azure_cosmosdb) |
51-
| Azure AI Search | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.AzureAISearch) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/azure_cognitive_search) |
52-
| Azure PostgreSQL Server | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Postgres) |
53-
| Azure SQL Database | [C#](https://github.com/kbeaugrand/SemanticKernel.Connectors.Memory.SqlServer) |
54-
| Chroma | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Chroma) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/chroma) |
55-
| DuckDB | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.DuckDB) | |
56-
| Milvus | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Milvus) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/milvus) |
57-
| MongoDB Atlas Vector Search | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.MongoDB) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/mongodb_atlas) |
58-
| Pinecone | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Pinecone) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/pinecone) |
59-
| Postgres | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Postgres) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/postgres) |
60-
| Qdrant | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Qdrant) | |
61-
| Redis | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Redis) | |
62-
| Sqlite | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Sqlite) | |
63-
| Weaviate | [C#](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors/Connectors.Memory.Weaviate) | [Python](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/weaviate) |
64-
65-
### Vector database solutions
66-
- [Azure Cosmos DB for NoSQL](/azure/cosmos-db/nosql/vector-search) Integrated Vector Database with DiskANN
67-
- [Azure Cosmos DB for MongoDB](/azure/cosmos-db/mongodb/vcore/vector-search) Integrated Vector Database
68-
- [Azure SQL Database](/azure/azure-sql/database/ai-artificial-intelligence-intelligent-applications?&preserve-view=true#vector-search)
69-
- [Azure PostgreSQL Server pgvector Extension](/azure/postgresql/flexible-server/how-to-use-pgvector)
70-
- [Azure AI Search](/azure/search/search-what-is-azure-search)
71-
- [Open-source vector databases](/azure/cosmos-db/mongodb/vcore/vector-search-ai)
72-
73-
:::image type="content" source="../media/decision-guide-databases-and-ai-search.png" lightbox="../media/decision-guide-databases-and-ai-search.png" alt-text="Vector indexing service decision guide":::
74-
75-
7631
## Additional plugins
7732

7833
If you want to extend the functionality of your AI agent, you can use plugins to integrate with other Microsoft services. Here are some of the plugins that are available for Semantic Kernel:
7934

8035
| Plugin | C# | Python | Java | Description |
8136
| ---------- | :-: | :----: | :--: | ----------- |
82-
| Logic Apps |||| Build workflows within Logic Apps using its available connectors and import them as plugins in Semantic Kernel. [Learn more](../concepts/plugins/adding-logic-apps-as-plugins.md). |
37+
| Logic Apps |||| Build workflows within Logic Apps using its available connectors and import them as plugins in Semantic Kernel. [Learn more](../plugins/adding-logic-apps-as-plugins.md). |
8338
| Azure Container Apps Dynamic Sessions |||| With dynamic sessions, you can recreate the Code Interpreter experience from the Assistants API by effortlessly spinning up Python containers where AI agents can execute Python code. [Learn more](/azure/container-apps/sessions). |

semantic-kernel/concepts/vector-store-connectors/TOC.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66
href: defining-your-data-model.md
77
- name: Defining your storage schema using a record definition
88
href: schema-with-record-definition.md
9+
- name: Embedding Generation
10+
href: embedding-generation.md
11+
- name: Vector Search
12+
href: vector-search.md
913
- name: Serialization of data models
1014
href: serialization.md
15+
- name: Legacy Memory Stores
16+
href: memory-stores.md
17+
- name: Code samples
18+
href: code-samples.md
1119
- name: Out-of-the-box connectors
1220
href: out-of-the-box-connectors/TOC.yml
13-
- name: How to ingest data into a Vector Store
14-
href: vector-store-data-ingestion.md
15-
- name: How to build a custom mapper for a Vector Store connector
16-
href: vector-store-custom-mapper.md
21+
- name: How to
22+
href: how-to/TOC.yml
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Semantic Kernel Vector Store code samples (Preview)
3+
description: Lists code samples for the Semantic Kernel Vector Store abstractions and implementations
4+
zone_pivot_groups: programming-languages
5+
author: westey-m
6+
ms.topic: conceptual
7+
ms.author: westey
8+
ms.date: 07/08/2024
9+
ms.service: semantic-kernel
10+
---
11+
# Semantic Kernel Vector Store code samples (Preview)
12+
13+
> [!WARNING]
14+
> The Semantic Kernel Vector Store functionality is in preview, and improvements that require breaking changes may still occur in limited circumstances before release.
15+
16+
::: zone pivot="programming-language-csharp"
17+
18+
## Simple Data Ingestion and Vector Search
19+
20+
For two very simple examples of how to do data ingestion into a vector store and do vector search, check out these
21+
two examples, which use Qdrant and InMemory vector stores to demonstrate their usage.
22+
23+
- [Simple Vector Search](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Simple.cs)
24+
- [Simple Data Ingestion](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_Simple.cs)
25+
26+
## Common code with multiple stores
27+
28+
Vector stores may different in certain aspects, e.g. with regards to the types of their keys or the types of fields each support.
29+
Even so, it is possible to write code that is agnostic to these differences.
30+
31+
For a data ingestion sample that demonstrates this, see:
32+
- [MultiStore Data Ingestion](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_MultiStore.cs)
33+
34+
For a vector search sample demonstrating the same concept see the following samples.
35+
Each of these samples are referencing the same common code, and just differ on the type of
36+
vector store they create to use with the common code.
37+
38+
- [Azure AI Search vector search with common code](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_AzureAISearch.cs)
39+
- [InMemory vector search with common code](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_InMemory.cs)
40+
- [Qdrant vector search with common code](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Qdrant.cs)
41+
- [Redis vector search with common code](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiStore_Redis.cs)
42+
43+
## Supporting multiple vectors in the same record
44+
45+
The Vector Store abstractions support multiple vectors in the same record, for vector databases that support this.
46+
The following sample shows how to create some records with multiple vectors, and pick the desired target vector
47+
when doing a vector search.
48+
49+
- [Choosing a vector for search on a record with multiple vectors](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_MultiVector.cs)
50+
51+
## Vector search with paging
52+
53+
When doing vector search with the Vector Store abstractions it's possible to use Top and Skip parameters to support paging, where e.g.
54+
you need to build a service that reponds with a small set of results per request.
55+
56+
- [Vector search with paging](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Concepts/Memory/VectorStore_VectorSearch_Paging.cs)
57+
58+
> [!WARNING]
59+
> Not all vector databases support Skip functionality natively for vector searches, so some connectors may have to fetch Skip + Top records and skip
60+
> on the client side to simulate this behavior.
61+
62+
::: zone-end
63+
::: zone pivot="programming-language-python"
64+
65+
## Coming soon
66+
67+
More coming soon.
68+
69+
::: zone-end
70+
::: zone pivot="programming-language-java"
71+
72+
## Coming soon
73+
74+
More coming soon.
75+
76+
::: zone-end

semantic-kernel/concepts/vector-store-connectors/data-architecture.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: The Semantic Kernel Vector Store data architecture (Experimental)
2+
title: The Semantic Kernel Vector Store data architecture (Preview)
33
description: Defines the data architecture for Semantic Kernel, including the relationship between vector stores, collections and records.
44
author: westey-m
55
ms.topic: conceptual
66
ms.author: westey
77
ms.date: 07/08/2024
88
ms.service: semantic-kernel
99
---
10-
# The Semantic Kernel Vector Store data architecture (Experimental)
10+
# The Semantic Kernel Vector Store data architecture (Preview)
1111

1212
> [!WARNING]
13-
> The Semantic Kernel Vector Store functionality is experimental, still in development and is subject to change.
13+
> The Semantic Kernel Vector Store functionality is in preview, and improvements that require breaking changes may still occur in limited circumstances before release.
1414
1515
Vector Store abstractions in Semantic Kernel are based on three main components: **vector stores**, **collections** and **records**.
1616
**Records** are contained by **collections**, and **collections** are contained by **vector stores**.

semantic-kernel/concepts/vector-store-connectors/defining-your-data-model.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Defining your Semantic Kernel Vector Store data model (Experimental)
2+
title: Defining your Semantic Kernel Vector Store data model (Preview)
33
description: Describes how to create a data model with Semantic Kernel to use when writing to or reading from a Vector Store.
44
zone_pivot_groups: programming-languages
55
author: westey-m
@@ -8,10 +8,10 @@ ms.author: westey
88
ms.date: 07/08/2024
99
ms.service: semantic-kernel
1010
---
11-
# Defining your data model (Experimental)
11+
# Defining your data model (Preview)
1212

1313
> [!WARNING]
14-
> The Semantic Kernel Vector Store functionality is experimental, still in development and is subject to change.
14+
> The Semantic Kernel Vector Store functionality is in preview, and improvements that require breaking changes may still occur in limited circumstances before release.
1515
1616
## Overview
1717

@@ -27,9 +27,7 @@ The properties on these classes are decorated with attributes that indicate the
2727
Here is an example of a model that is decorated with these attributes.
2828

2929
```csharp
30-
using Microsoft.SemanticKernel.Data;
31-
32-
#pragma warning disable SKEXP0001
30+
using Microsoft.Extensions.VectorData;
3331

3432
public class Hotel
3533
{
@@ -42,7 +40,7 @@ public class Hotel
4240
[VectorStoreRecordData(IsFullTextSearchable = true)]
4341
public string Description { get; set; }
4442

45-
[VectorStoreRecordVector(4, IndexKind.Hnsw, DistanceFunction.CosineDistance)]
43+
[VectorStoreRecordVector(4, DistanceFunction.CosineDistance, IndexKind.Hnsw)]
4644
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
4745

4846
[VectorStoreRecordData(IsFilterable = true)]
@@ -95,7 +93,7 @@ public string HotelName { get; set; }
9593
Use this attribute to indicate that your property contains a vector.
9694

9795
```csharp
98-
[VectorStoreRecordVector(Dimensions: 4, IndexKind.Hnsw, DistanceFunction.CosineDistance)]
96+
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction.CosineDistance, IndexKind.Hnsw)]
9997
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
10098
```
10199

0 commit comments

Comments
 (0)