11# Semantic Memory
22
3- ** Semantic Memory** is an open-source library and service specializing in the
4- efficient indexing of datasets through custom continuous data pipelines.
3+ ** Semantic Memory** is an open-source library and [ service] ( dotnet/Service )
4+ specialized in the efficient indexing of datasets through custom continuous data
5+ pipelines.
56
67![ image] ( https://github.com/microsoft/semantic-memory/assets/371009/31894afa-d19e-4e9b-8d0f-cb889bf5c77f )
78
8- Utilizing advanced embeddings and LLMs, the system enables natural language
9+ Utilizing advanced embeddings and LLMs, the system enables Natural Language
910querying for obtaining answers from the indexed data, complete with citations
1011and links to the original sources.
1112
@@ -18,19 +19,23 @@ Semantic Memory enhances data-driven features in applications built using SK.
1819> ℹ️ ** NOTE** : the documentation below is work in progress, will evolve quickly
1920> as is not fully functional yet.
2021
21- # Examples
22+ # Importing memory in serverless mode
2223
23- ## Importing memory, locally, without deployments
24+ Semantic Memory works and scales at best when running as a service, allowing to
25+ ingest thousands of documents and information without blocking your app.
2426
25- Importing documents into your Semantic Memory can be as simple as this:
27+ However, you can use Semantic Memory also serverless, embedding the ` MemoryPipelineClient `
28+ in your app. Importing documents into your Semantic Memory can be as simple as this:
2629
2730``` csharp
2831var memory = new MemoryPipelineClient ();
2932
33+ # Import a file (default user)
3034await memory .ImportFileAsync (" meeting-transcript.docx" );
3135
36+ # Import a file specifying a User and Tags
3237await memory .ImportFileAsync (" business-plan.docx" ,
33- new DocumentDetails (" file1" , " user0022 " )
38+ new DocumentDetails (" file1" , " user@some.email " )
3439 .AddTag (" collection" , " business" )
3540 .AddTag (" collection" , " plans" )
3641 .AddTag (" type" , " doc" ));
@@ -41,26 +46,28 @@ Asking questions
4146``` csharp
4247string answer1 = await memory .AskAsync (" How many people attended the meeting?" );
4348
44- string answer2 = await memory .AskAsync (" what's the project timeline?" , " user0022 " );
49+ string answer2 = await memory .AskAsync (" what's the project timeline?" , " user@some.email " );
4550```
4651
4752The code leverages the default documents ingestion pipeline:
4853
49- 1 . Extract text
50- 2 . Partition the text in small chunks
51- 3 . Extract embedding
52- 4 . Save embedding into a vector index
54+ 1 . Extract text: recognize the file format and extract the information
55+ 2 . Partition the text in small chunks, to optimize search
56+ 3 . Extract embedding using an LLM embedding generator
57+ 4 . Save embedding into a vector index such as
58+ [ Azure Cognitive Search] ( https://learn.microsoft.com/en-us/azure/search/vector-search-overview ) ,
59+ [ Qdrant] ( https://qdrant.tech/ ) or other DBs.
5360
54- Data is also organized by users, protecting information and allowing to
55- organize private information. And memories can be labelled and organized
56- using ** Tags ** .
61+ Documents are organized by users, safeguarding their private information.
62+ Furthermore, memories can be categorized and structured using ** tags ** , enabling
63+ efficient search and retrieval through faceted navigation .
5764
5865## Import memory using Semantic Memory Web Service
5966
6067Depending on your scenarios, you might want to run all the code ** locally
6168inside your process, or remotely through an asynchronous service.**
6269
63- If you're importing small files, and need only C# or Python, and can block
70+ If you're importing small files, and need only C# or only Python, and can block
6471the process during the import, local-in-process execution can be fine, using
6572the ** MemoryPipelineClient** seen above.
6673
0 commit comments