{"id":13465339,"url":"https://github.com/microsoft/kernel-memory","last_synced_at":"2025-05-13T20:20:35.559Z","repository":{"id":181065080,"uuid":"666163354","full_name":"microsoft/kernel-memory","owner":"microsoft","description":"RAG architecture: index and query any data using LLM and natural language, track sources, show citations, asynchronous memory patterns.","archived":false,"fork":false,"pushed_at":"2025-04-25T22:29:55.000Z","size":26853,"stargazers_count":1901,"open_issues_count":27,"forks_count":358,"subscribers_count":46,"default_branch":"main","last_synced_at":"2025-04-28T11:56:47.321Z","etag":null,"topics":["indexing","llm","memory","rag","semantic-search"],"latest_commit_sha":null,"homepage":"https://microsoft.github.io/kernel-memory","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-13T21:33:28.000Z","updated_at":"2025-04-28T06:24:05.000Z","dependencies_parsed_at":"2023-10-20T05:57:32.915Z","dependency_job_id":"426a602c-7c28-4e10-83d8-e88b136d1393","html_url":"https://github.com/microsoft/kernel-memory","commit_stats":{"total_commits":574,"total_committers":43,"mean_commits":"13.348837209302326","dds":0.6167247386759582,"last_synced_commit":"ccfb81530e1a6396a788e0b8a0bcecff74f16099"},"previous_names":["microsoft/semantic-memory","microsoft/kernel-memory"],"tags_count":259,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fkernel-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fkernel-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fkernel-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fkernel-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/kernel-memory/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311332,"owners_count":21569008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["indexing","llm","memory","rag","semantic-search"],"created_at":"2024-07-31T15:00:27.811Z","updated_at":"2025-04-28T11:57:04.897Z","avatar_url":"https://github.com/microsoft.png","language":"C#","readme":"Kernel Memory\n=============\n\n[![License: MIT](https://img.shields.io/github/license/microsoft/kernel-memory)](https://github.com/microsoft/kernel-memory/blob/main/LICENSE)\n[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord\u0026color=d82679\u0026logo=discord\u0026logoColor=white)](https://aka.ms/KMdiscord)\n[![Docker Image](https://img.shields.io/docker/pulls/kernelmemory/service?label=Docker\u0026color=%230db7ed\u0026logo=docker\u0026logoColor=white)](https://hub.docker.com/r/kernelmemory/service)\n[![NuGet Version](https://img.shields.io/nuget/v/Microsoft.KernelMemory?label=nuget\u0026color=%23512BD4\u0026logo=.net\u0026logoColor=white)](https://www.nuget.org/packages/Microsoft.KernelMemory)\n[![GitHub Release](https://img.shields.io/github/v/release/microsoft/kernel-memory?color=%23dddddd\u0026label=tag\u0026logo=github\u0026logoColor=white)](https://github.com/microsoft/kernel-memory/releases)\n\nThis repository presents best practices and a reference implementation for Memory in specific AI\nand LLMs application scenarios. Please note that **the code provided serves as a demonstration**\nand is **not an officially supported** Microsoft offering.\n\n**Kernel Memory** (KM) is a **multi-modal [AI Service](service/Service/README.md)** specialized\nin the efficient indexing of datasets through custom continuous data hybrid pipelines, with support\nfor **[Retrieval Augmented Generation](https://en.wikipedia.org/wiki/Prompt_engineering#Retrieval-augmented_generation)**\n(RAG), synthetic memory, prompt engineering, and custom semantic memory processing.\n\nKM is available as a **Web Service**, as a **[Docker container](https://hub.docker.com/r/kernelmemory/service)**,\na **[Plugin](https://learn.microsoft.com/copilot/plugins/overview)** for ChatGPT/Copilot/Semantic\nKernel, and as a .NET library for embedded applications.\n\nUtilizing advanced embeddings and LLMs, the system enables Natural Language querying for obtaining\nanswers from the indexed data, complete with citations and links to the original sources.\n\nKernel Memory is designed for seamless integration as a Plugin with [Semantic Kernel](https://github.com/microsoft/semantic-kernel),\nMicrosoft Copilot and ChatGPT.\n\n![image](docs/img/kernel-memory-lambda-architecture.png)\n\n\n\n\nKernel Memory Service on Azure\n==============================\n\nKernel Memory can be deployed in various configurations, including as a **Service** in Azure.\nTo learn more about deploying Kernel Memory in Azure, please refer to the\n[Azure deployment guide](https://microsoft.github.io/kernel-memory/azure).\nFor detailed instructions on deploying to Azure, you can check the [infrastructure documentation](/infra/README.md).\n\nIf you are already familiar with these resources, you can quickly deploy by clicking the following\nbutton.\n\n[![Deploy to Azure](docs/azure-button.png)](https://aka.ms/KernelMemoryDeploy2Azure)\n\n🔗 See also: [Kernel Memory via Docker](#kernel-memory-docker-image) and [Serverless Kernel Memory with Azure services example](examples/007-dotnet-serverless-azure).\n\n## Running Kernel Memory with Aspire\n\nKernel Memory can be easily run and imported in other projects also via .NET Aspire. For example:\n```csharp\nvar builder = DistributedApplication.CreateBuilder();\n\nbuilder.AddContainer(\"kernel-memory\", \"kernelmemory/service\")\n    .WithEnvironment(\"KernelMemory__TextGeneratorType\", \"OpenAI\")\n    .WithEnvironment(\"KernelMemory__DataIngestion__EmbeddingGeneratorTypes__0\", \"OpenAI\")\n    .WithEnvironment(\"KernelMemory__Retrieval__EmbeddingGeneratorType\", \"OpenAI\")\n    .WithEnvironment(\"KernelMemory__Services__OpenAI__APIKey\", \"...your OpenAI key...\");\n\nbuilder.Build().Run();\n```\n\n[![Run with .NET Aspire](docs/aspire-button.png)](examples/303-dotnet-aspire/Program.cs)\n\n\n\n\nData Ingestion using Kernel Memory OpenAPI Web Service\n======================================================\n\nThe example show the default documents ingestion pipeline:\n\n1. Extract text: automatically recognize the file format and extract the information\n2. Partition the text in small chunks, ready for search and RAG prompts\n3. Extract embeddings using any LLM embedding generator\n4. Save embeddings into a vector index such as\n   [Azure AI Search](https://learn.microsoft.com/azure/search/vector-search-overview),\n   [Qdrant](https://qdrant.tech/) or other DBs.\n\nThe example shows how to **safeguard private information** specifying who owns each document, and\nhow to **organize data** for search and faceted navigation, using **Tags**.\n\n## C#\n\n\u003e ```csharp\n\u003e #r \"nuget: Microsoft.KernelMemory.WebClient\"\n\u003e\n\u003e var memory = new MemoryWebClient(\"http://127.0.0.1:9001\"); // \u003c== URL of KM web service\n\u003e\n\u003e // Import a file\n\u003e await memory.ImportDocumentAsync(\"meeting-transcript.docx\");\n\u003e\n\u003e // Import a file specifying Document ID and Tags\n\u003e await memory.ImportDocumentAsync(\"business-plan.docx\",\n\u003e     new Document(\"doc01\")\n\u003e         .AddTag(\"user\", \"devis@contoso.com\")\n\u003e         .AddTag(\"collection\", \"business\")\n\u003e         .AddTag(\"collection\", \"plans\")\n\u003e         .AddTag(\"fiscalYear\", \"2025\"));\n\u003e ```\n\n## Python\n\n\u003e ```python\n\u003e import requests\n\u003e\n\u003e # Files to import\n\u003e files = {\n\u003e           \"file1\": (\"business-plan.docx\", open(\"business-plan.docx\", \"rb\")),\n\u003e         }\n\u003e\n\u003e # Tags to apply, used by queries to filter memory\n\u003e data = { \"documentId\": \"doc01\",\n\u003e          \"tags\": [ \"user:devis@contoso.com\",\n\u003e                    \"collection:business\",\n\u003e                    \"collection:plans\",\n\u003e                    \"fiscalYear:2025\" ]\n\u003e        }\n\u003e\n\u003e response = requests.post(\"http://127.0.0.1:9001/upload\", files=files, data=data)\n\u003e ```\n\n\n\n\nDirect Data Ingestion using embedded Serverless .NET component\n==============================================================\n\n\u003e ```csharp\n\u003e var memory = new KernelMemoryBuilder()\n\u003e     .WithOpenAIDefaults(Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\"))\n\u003e     .Build\u003cMemoryServerless\u003e();\n\u003e\n\u003e // Import a file\n\u003e await memory.ImportDocumentAsync(\"meeting-transcript.docx\");\n\u003e\n\u003e // Import a file specifying Document ID and Tags\n\u003e await memory.ImportDocumentAsync(\"business-plan.docx\",\n\u003e     new Document(\"doc01\")\n\u003e         .AddTag(\"collection\", \"business\")\n\u003e         .AddTag(\"collection\", \"plans\")\n\u003e         .AddTag(\"fiscalYear\", \"2025\"));\n\u003e ```\n\n\n\n\nMemory retrieval and RAG\n========================\n\nAsking questions, running RAG prompts, and filtering by user and other criteria is simple, with\nanswers including citations and all the information needed to verify their accuracy, pointing to\nwhich documents ground the response.\n\n## C#\n\n\u003e ### Asking questions:\n\u003e Questions can be asked targeting the entire memory set, or a subset using filters,\n\u003e e.g. to implement security filters.\n\u003e ```csharp\n\u003e var answer1 = await memory.AskAsync(\"How many people attended the meeting?\");\n\u003e\n\u003e var answer2 = await memory.AskAsync(\"what's the project timeline?\",\n\u003e                                     filter: MemoryFilters.ByTag(\"user\", \"devis@contoso.com\"));\n\u003e ```\n\n\u003e ### Token usage:\n\u003e When generating answers with LLMs, the result includes a token usage report.\n\u003e ```csharp\n\u003e foreach (var report in tokenUsage)\n\u003e {\n\u003e     Console.WriteLine($\"{report.ServiceType}: {report.ModelName} ({report.ModelType})\");\n\u003e     Console.WriteLine($\"- Input : {report.ServiceTokensIn}\");\n\u003e     Console.WriteLine($\"- Output: {report.ServiceTokensOut}\");\n\u003e }\n\u003e ```\n\u003e #### Output:\n\u003e \u003e Azure OpenAI: gpt-4o (TextGeneration)\n\u003e \u003e - Input : 24356 tokens\n\u003e \u003e - Output: 103 tokens\n\n![km-stream-token-usage](https://github.com/user-attachments/assets/71abf161-106c-47cc-af06-66f810314687)\n\n\u003e ### Data lineage, citations, referencing sources:\n\u003e\n\u003e ```csharp\n\u003e await memory.ImportFileAsync(\"NASA-news.pdf\");\n\u003e\n\u003e var answer = await memory.AskAsync(\"Any news from NASA about Orion?\");\n\u003e\n\u003e Console.WriteLine(answer.Result + \"/n\");\n\u003e\n\u003e foreach (var x in answer.RelevantSources)\n\u003e {\n\u003e     Console.WriteLine($\"  * {x.SourceName} -- {x.Partitions.First().LastUpdate:D}\");\n\u003e }\n\u003e ```\n\u003e\n\u003e \u003e Yes, there is news from NASA about the Orion spacecraft. NASA has invited the\n\u003e \u003e media to see a new test version [......] For more information about the Artemis program,\n\u003e \u003e you can visit the NASA website.\n\u003e \u003e\n\u003e \u003e - **NASA-news.pdf -- Tuesday, August 1, 2023**\n\n## Python\n\n\u003e ### Asking questions:\n\u003e\n\u003e ```python\n\u003e import requests\n\u003e import json\n\u003e\n\u003e data = {\n\u003e     \"question\": \"what's the project timeline?\",\n\u003e     \"filters\":  [ {\"user\": [\"devis@contoso.com\"]} ]\n\u003e }\n\u003e\n\u003e response = requests.post(\n\u003e     \"http://127.0.0.1:9001/ask\",\n\u003e     headers={\"Content-Type\": \"application/json\"},\n\u003e     data=json.dumps(data),\n\u003e ).json()\n\u003e\n\u003e print(response[\"text\"])\n\u003e ```\n\n## OpenAPI\n\n\u003e ```\n\u003e curl http://127.0.0.1:9001/ask -d'{\"query\":\"Any news from NASA about Orion?\"}' -H 'Content-Type: application/json'\n\u003e ```\n\u003e\n\u003e ```json\n\u003e {\n\u003e   \"Query\": \"Any news from NASA about Orion?\",\n\u003e   \"Text\": \"Yes, there is news from NASA about the Orion spacecraft. NASA has invited the media to see a new test version [......] For more information about the Artemis program, you can visit the NASA website.\",\n\u003e   \"RelevantSources\": [\n\u003e     {\n\u003e       \"Link\": \"...\",\n\u003e       \"SourceContentType\": \"application/pdf\",\n\u003e       \"SourceName\": \"file5-NASA-news.pdf\",\n\u003e       \"Partitions\": [\n\u003e         {\n\u003e           \"Text\": \"Skip to main content\\nJul 28, 2023\\nMEDIA ADVISORY M23-095\\nNASA Invites Media to See Recovery Craft for\\nArtemis Moon Mission\\n(/sites/default/ﬁles/thumbnails/image/ksc-20230725-ph-fmx01_0003orig.jpg)\\nAboard the [......] to Mars (/topics/moon-to-\\nmars/),Orion Spacecraft (/exploration/systems/orion/index.html)\\nNASA Invites Media to See Recovery Craft for Artemis Moon Miss... https://www.nasa.gov/press-release/nasa-invites-media-to-see-recov...\\n2 of 3 7/28/23, 4:51 PM\",\n\u003e           \"Relevance\": 0.8430657,\n\u003e           \"SizeInTokens\": 863,\n\u003e           \"LastUpdate\": \"2023-08-01T08:15:02-07:00\"\n\u003e         }\n\u003e       ]\n\u003e     }\n\u003e   ]\n\u003e }\n\u003e ```\n\nThe OpenAPI schema (\"swagger\") is available at http://127.0.0.1:9001/swagger/index.html when\nrunning the service locally with OpenAPI enabled.\n[Here's a copy](https://editor.swagger.io/?url=https://raw.githubusercontent.com/microsoft/kernel-memory/refs/heads/main/swagger.json).\n\n\n🔗 See also: \n- [Full example with ingestion, search and RAG queries](https://github.com/microsoft/kernel-memory/tree/main/examples/001-dotnet-WebClient).\n- [Full example using serverless .NET component](https://github.com/microsoft/kernel-memory/blob/main/examples/002-dotnet-Serverless).\n\n\n\n\nKernel Memory Docker image\n==========================\n\nIf you want to give the service a quick test, use the following command\nto **start the Kernel Memory Service** using OpenAI:\n\n```shell\ndocker run -e OPENAI_API_KEY=\"...\" -it --rm -p 9001:9001 kernelmemory/service\n```\n\nIf you prefer using custom settings and services such as Azure OpenAI, Azure\nDocument Intelligence, etc., you should create an `appsettings.Development.json`\nfile overriding the default values set in `appsettings.json`, or using the\nconfiguration wizard included:\n\n    cd service/Service\n    dotnet run setup\n\nThen run this command to start the [Docker image](https://hub.docker.com/r/kernelmemory/service)\nwith the configuration just created:\n\non Windows:\n\n    docker run --volume .\\appsettings.Development.json:/app/appsettings.Production.json -it --rm -p 9001:9001 kernelmemory/service\n\non Linux / macOS:\n\n    docker run --volume ./appsettings.Development.json:/app/appsettings.Production.json -it --rm -p 9001:9001 kernelmemory/service\n\n🔗 See also: \n* [How to configure KM service](https://github.com/microsoft/kernel-memory/blob/main/service/Service/README.md#%EF%B8%8F-configuration)\n* [Deploy Kernel Memory to Azure](#kernel-memory-service-on-azure).\n\n\n\n\nMemory as a Service: Data Ingestion Pipelines + RAG Web Service\n===============================================================\n\nDepending on your scenarios, you might want to run all the code **remotely through an asynchronous\nand scalable service,\nor locally inside your process.**\n\n![image](docs/img/kernel-memory-as-a-service.png)\n\nIf you're importing small files, and use only .NET and can block the application process while\nimporting documents, then local-in-process execution can be fine, using the **MemoryServerless**\ndescribed below.\n\nHowever, if you are in one of these scenarios:\n\n- My app is written in **TypeScript, Java, Rust, or some other language**\n- I'd just like a web service to import data and send questions to answer\n- I'm importing **big documents that can require minutes to process**, and I don't want to block the\n  user interface\n- I need memory import to **run independently, supporting failures and retry logic**\n- I want to define **custom pipelines mixing multiple languages** like Python, TypeScript, etc\n\nthen you're likely looking for a **Memory Service**, and you can deploy Kernel Memory as a backend\nservice, using the default ingestion logic, or your custom workflow including steps coded in\nPython/TypeScript/Java/etc., leveraging the asynchronous non-blocking memory encoding process,\nuploading documents and asking questions using the **MemoryWebClient**.\n\n![image](docs/img/kernel-memory-client.png)\n\n[Here](service/Service/README.md) you can find a complete set of instruction about\n[how to run the Kernel Memory service](service/Service/README.md).\n\n## Embedded Memory Component (aka \"serverless\")\n\nKernel Memory works and scales at best when running as an asynchronous **Web Service**, allowing to\ningest thousands of documents and information without blocking your app.\n\nHowever, Kernel Memory can also run in serverless mode, embedding `MemoryServerless` class instance\nin .NET backend/console/desktop apps in synchronous mode.\nEach request is processed immediately, although calling clients are responsible for handling\ntransient errors.\n\n![image](docs/img/kernel-memory-embedded-serverless.png)\n\n\n\n\nExtensions\n==========\n\nKernel Memory relies on external services to run stateful pipelines, store data, handle embeddings,\nand generate text responses. The project includes extensions that allow customization of file\nstorage, queues, vector stores, and LLMs to fit specific requirements.\n\n- **AI**: Azure OpenAI, OpenAI, ONNX, Ollama, Anthropic, Azure AI Document Intelligence, Azure AI\n  Content Safety\n- **Vector Store**: Azure AI Search, Postgres, SQL Server, Elasticsearch, Qdrant, Redis, MongoDB\n  Atlas, In memory store\n- **File Storage**: Azure Blob storage, AWS S3, MongoDB Atlas, Local disk, In memory storage\n- **Ingestion pipelines**: Azure Queues, RabbitMQ, In memory queues\n\n\n\n\nCustom memory ingestion pipelines\n===================================\n\nDocument ingestion operates as a stateful pipeline, executing steps in a defined sequence.\nBy default, Kernel Memory employs a pipeline to **extract** text, **chunk** content, **vectorize**,\nand **store** data.\n\nIf you need a custom data pipeline, you can modify the sequence, add new steps, or replace existing\nones by providing custom “handlers” for each desired stage. This allows complete flexibility in\ndefining how data is processed. For example:\n\n```csharp\n// Memory setup, e.g. how to calculate and where to store embeddings\nvar memoryBuilder = new KernelMemoryBuilder()\n    .WithoutDefaultHandlers()\n    .WithOpenAIDefaults(Environment.GetEnvironmentVariable(\"OPENAI_API_KEY\"));\n\nvar memory = memoryBuilder.Build();\n\n// Plug in custom .NET handlers\nmemory.Orchestrator.AddHandler\u003cMyHandler1\u003e(\"step1\");\nmemory.Orchestrator.AddHandler\u003cMyHandler2\u003e(\"step2\");\nmemory.Orchestrator.AddHandler\u003cMyHandler3\u003e(\"step3\");\n\n// Use the custom handlers with the memory object\nawait memory.ImportDocumentAsync(\n    new Document(\"mytest001\")\n        .AddFile(\"file1.docx\")\n        .AddFile(\"file2.pdf\"),\n    steps: new[] { \"step1\", \"step2\", \"step3\" });\n```\n\n![image](docs/img/kernel-memory-pipelines.png)\n\n\n\n\nKernel Memory (KM) and Semantic Kernel (SK)\n===========================================\n\n**Semantic Kernel is an SDK for C#, Python, and Java** used to develop solutions with AI. SK\nincludes libraries that wrap direct calls to databases, supporting vector search.\n\nSemantic Kernel is maintained in three languages, while the list of supported storage engines\n(known as \"connectors\") varies across languages.\n\n**Kernel Memory (KM) is a SERVICE** built on Semantic Kernel, with additional features developed for\nRAG, Security, and Cloud deployment. As a service, **KM can be used from any language, tool, or\nplatform, e.g. browser extensions and ChatGPT assistants.**\n\nKernel Memory provides several features out of the scope of Semantic Kernel, that would usually be\ndeveloped manually, such as storing files, extracting text from documents, providing a framework to\nsecure users' data, content moderation etc.\n\nKernel Memory is also leveraged to explore new AI patterns, which sometimes are backported to\nSemantic Kernel and Microsoft libraries, for instance vector stores flexible schemas, advanced\nfiltering, authentications.\n\nHere's comparison table:\n\n| Feature          | Kernel Memory                                                         | Semantic Kernel    |\n|------------------|-----------------------------------------------------------------------|--------------------|\n| Runtime          | Memory as a Service, Web service                                      | SDK packages       |\n| Data formats     | Web pages, PDF, Images, Word, PowerPoint, Excel, Markdown, Text, JSON | Text only          |\n| Language support | Any language                                                          | .NET, Python, Java |\n| RAG              | Yes                                                                   | -                  |\n| Cloud deployment | Yes                                                                   | -                  |\n\n\n\n\nExamples and Tools\n==================\n\n## Examples\n\n1. [Collection of Jupyter notebooks with various scenarios](examples/000-notebooks)\n2. [Using Kernel Memory web service to upload documents and answer questions](examples/001-dotnet-WebClient)\n3. [Importing files and asking question without running the service (serverless mode)](examples/002-dotnet-Serverless)\n4. [Kernel Memory RAG with Azure services](examples/007-dotnet-serverless-azure)\n5. [Kernel Memory with .NET Aspire](examples/303-dotnet-aspire)\n6. [Using KM Plugin for Semantic Kernel](examples/003-dotnet-SemanticKernel-plugin)\n7. Customizations\n   * [Processing files with custom logic (custom handlers) in serverless mode](examples/004-dotnet-serverless-custom-pipeline)\n   * [Processing files with custom logic (custom handlers) in asynchronous mode](examples/005-dotnet-AsyncMemoryCustomPipeline)\n   * [Customizing RAG and summarization prompts](examples/101-dotnet-custom-Prompts)\n   * [Custom partitioning/text chunking options](examples/102-dotnet-custom-partitioning-options)\n   * [Using a custom embedding/vector generator](examples/103-dotnet-custom-EmbeddingGenerator)\n   * [Using custom content decoders](examples/108-dotnet-custom-content-decoders)\n   * [Using a custom web scraper to fetch web pages](examples/109-dotnet-custom-webscraper)\n   * [Writing and using a custom ingestion handler](examples/201-dotnet-serverless-custom-handler)\n   * [Using Context Parameters to customize RAG prompt during a request](examples/209-dotnet-using-context-overrides)\n8. Local models and external connectors\n   * [Using custom LLMs](examples/104-dotnet-custom-LLM)\n   * [Using local LLMs with Ollama](examples/212-dotnet-ollama) \n   * [Using local LLMs with llama.cpp via LlamaSharp](examples/105-dotnet-serverless-llamasharp)\n   * [Using local models with LM Studio](examples/208-dotnet-lmstudio)\n   * [Using Semantic Kernel LLM connectors](examples/107-dotnet-SemanticKernel-TextCompletion)\n   * [Generating answers with Anthropic LLMs](examples/110-dotnet-anthropic)\n9. [Upload files and ask questions from command line using curl](examples/006-curl-calling-webservice)\n10. [Summarizing documents, using synthetic memories](examples/106-dotnet-retrieve-synthetics)\n11. [Hybrid Search with Azure AI Search](examples/111-dotnet-azure-ai-hybrid-search)\n12. [Running a single asynchronous pipeline handler as a standalone service](examples/202-dotnet-custom-handler-as-a-service)\n13. [Integrating Memory with ASP.NET applications and controllers](examples/204-dotnet-ASP.NET-MVC-integration)\n14. [Sample code showing how to extract text from files](examples/205-dotnet-extract-text-from-docs)\n15. [.NET configuration and logging](examples/206-dotnet-configuration-and-logging)\n16. [Expanding chunks retrieving adjacent partitions](examples/207-dotnet-expanding-chunks-on-retrieval)\n17. [Creating a Memory instance without KernelMemoryBuilder](examples/210-KM-without-builder)\n18. [Intent Detection](examples/211-dotnet-WebClient-Intent-Detection)\n19. [Fetching data from Discord](examples/301-discord-test-application)\n20. [Test project using KM package from nuget.org](examples/203-dotnet-using-KM-nuget)\n\n## Tools\n\n1. [.NET appsettings.json generator](tools/InteractiveSetup)\n2. [Curl script to upload files](tools/km-cli/upload-file.sh)\n3. [Curl script to ask questions](tools/km-cli/ask.sh)\n4. [Curl script to search documents](tools/km-cli/search.sh)\n5. [Script to start Qdrant for development tasks](tools/run-qdrant.sh)\n6. [Script to start Elasticsearch for development tasks](tools/run-elasticsearch.sh)\n7. [Script to start MS SQL Server for development tasks](tools/run-mssql.sh)\n8. [Script to start Redis for development tasks](tools/run-redis.sh)\n9. [Script to start RabbitMQ for development tasks](tools/run-rabbitmq.sh)\n10. [Script to start MongoDB Atlas for development tasks](tools/run-mongodb-atlas.sh)\n\n## .NET packages\n\n- **Microsoft.KernelMemory.WebClient:** .NET web client to call a running instance of Kernel Memory\n  web service.\n\n  [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.WebClient)](https://www.nuget.org/packages/Microsoft.KernelMemory.WebClient/)\n  [![Example code](https://img.shields.io/badge/example-code-blue)](examples/001-dotnet-WebClient)\n\n- **Microsoft.KernelMemory:** Kernel Memory library including all extensions and clients, it can be\n  used to build custom pipelines and handlers. It contains also the serverless client to use memory\n  in a synchronous way without the web service.\n\n  [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Core)](https://www.nuget.org/packages/Microsoft.KernelMemory.Core/)\n  [![Serverless example](https://img.shields.io/badge/example-code-blue)](examples/002-dotnet-Serverless)\n  [![Custom pipeline example](https://img.shields.io/badge/example-code-blue)](examples/004-dotnet-serverless-custom-pipeline)\n  [![Custom pipeline example](https://img.shields.io/badge/example-code-blue)](examples/005-dotnet-async-memory-custom-pipeline)\n\n- **Microsoft.KernelMemory.Service.AspNetCore:** an extension to load Kernel Memory into your\n  ASP.NET apps.\n\n  [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Service.AspNetCore)](https://www.nuget.org/packages/Microsoft.KernelMemory.Service.AspNetCore/)\n  [![Example code](https://img.shields.io/badge/example-code-blue)](examples/204-dotnet-ASP.NET-MVC-integration)\n\n- **Microsoft.KernelMemory.SemanticKernelPlugin:** a Memory plugin for Semantic Kernel, replacing\n  the original Semantic Memory available in SK.\n\n  [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.SemanticKernelPlugin)](https://www.nuget.org/packages/Microsoft.KernelMemory.SemanticKernelPlugin/)\n  [![Example code](https://img.shields.io/badge/example-code-blue)](examples/003-dotnet-SemanticKernel-plugin)\n\n- [**Microsoft.KernelMemory.\\*** packages](https://www.nuget.org/packages?q=microsoft.kernelmemory):\n  Kernel Memory Core and all KM extensions split into distinct packages.\n\n### Packages for Python, Java and other languages\n\nKernel Memory service offers a **Web API** out of the box, including the\n[**OpenAPI swagger**](https://editor.swagger.io/?url=https://github.com/microsoft/kernel-memory/blob/main/swagger.json)\ndocumentation that you can leverage to test the API and create custom web clients. For instance,\nafter starting the service locally, see http://127.0.0.1:9001/swagger/index.html.\n\nA .NET Web Client and a Semantic Kernel plugin are available, see the nugets packages above.\n\nFor Python, TypeScript, Java and other languages we recommend leveraging the Web Service. We also welcome\nPR contributions to support more languages.\n\n\n\n\nContributors\n============\n\n\u003c!--\ngh api repos/:owner/:repo/contributors --paginate --jq '\n  [ .[] | {\n    login: .login,\n    id: .id,\n    url: .html_url,\n    avatar: \"https://avatars.githubusercontent.com/u/\\(.id)?v=4\u0026s=110\"\n  } ] as $list\n  | (\n      \"| \" + ($list[0:6] | map(\"\u003cimg alt=\\\"\\(.login)\\\" src=\\\"\\(.avatar)\\\" width=\\\"110\\\"\u003e\") | join(\" | \")) + \" |\\n\" +\n      \"|:---:|:---:|:---:|:---:|:---:|:---:|\\n\" +\n      \"| \" + ($list[0:6] | map(\"[\\(.login)](\\(.url))\") | join(\" | \")) + \" |\\n\" +\n      (\n        reduce range(6; ($list | length); 6) as $i (\n          \"\";\n          . + \"| \" + ($list[$i:$i+6] | map(\"\u003cimg alt=\\\"\\(.login)\\\" src=\\\"\\(.avatar)\\\" width=\\\"110\\\"\u003e\") | join(\" | \")) + \" |\\n\" +\n              \"| \" + ($list[$i:$i+6] | map(\"[\\(.login)](\\(.url))\") | join(\" | \")) + \" |\\n\"\n        )\n      )\n    )\n'\n--\u003e\n\n| \u003cimg alt=\"dluc\" src=\"https://avatars.githubusercontent.com/u/371009?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"marcominerva\" src=\"https://avatars.githubusercontent.com/u/3522534?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"anthonypuppo\" src=\"https://avatars.githubusercontent.com/u/6828951?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"crickman\" src=\"https://avatars.githubusercontent.com/u/66376200?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"TaoChenOSU\" src=\"https://avatars.githubusercontent.com/u/12570346?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"cherchyk\" src=\"https://avatars.githubusercontent.com/u/1703275?v=4\u0026s=110\" width=\"110\"\u003e |\n|:---:|:---:|:---:|:---:|:---:|:---:|\n| [dluc](https://github.com/dluc) | [marcominerva](https://github.com/marcominerva) | [anthonypuppo](https://github.com/anthonypuppo) | [crickman](https://github.com/crickman) | [TaoChenOSU](https://github.com/TaoChenOSU) | [cherchyk](https://github.com/cherchyk) |\n| \u003cimg alt=\"kbeaugrand\" src=\"https://avatars.githubusercontent.com/u/9513635?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"alexmg\" src=\"https://avatars.githubusercontent.com/u/131293?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"alkampfergit\" src=\"https://avatars.githubusercontent.com/u/358545?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"dependabot[bot]\" src=\"https://avatars.githubusercontent.com/u/49699333?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"slorello89\" src=\"https://avatars.githubusercontent.com/u/42971704?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"xbotter\" src=\"https://avatars.githubusercontent.com/u/3634877?v=4\u0026s=110\" width=\"110\"\u003e |\n| [kbeaugrand](https://github.com/kbeaugrand) | [alexmg](https://github.com/alexmg) | [alkampfergit](https://github.com/alkampfergit) | [dependabot[bot]](https://github.com/apps/dependabot) | [slorello89](https://github.com/slorello89) | [xbotter](https://github.com/xbotter) |\n| \u003cimg alt=\"westdavidr\" src=\"https://avatars.githubusercontent.com/u/669668?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"luismanez\" src=\"https://avatars.githubusercontent.com/u/9392197?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"afederici75\" src=\"https://avatars.githubusercontent.com/u/13766049?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"koteus\" src=\"https://avatars.githubusercontent.com/u/428201?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"amomra\" src=\"https://avatars.githubusercontent.com/u/11981363?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"lecramr\" src=\"https://avatars.githubusercontent.com/u/20584823?v=4\u0026s=110\" width=\"110\"\u003e |\n| [westdavidr](https://github.com/westdavidr) | [luismanez](https://github.com/luismanez) | [afederici75](https://github.com/afederici75) | [koteus](https://github.com/koteus) | [amomra](https://github.com/amomra) | [lecramr](https://github.com/lecramr) |\n| \u003cimg alt=\"chaelli\" src=\"https://avatars.githubusercontent.com/u/878151?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"pawarsum12\" src=\"https://avatars.githubusercontent.com/u/136417839?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"aaronpowell\" src=\"https://avatars.githubusercontent.com/u/434140?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"alexibraimov\" src=\"https://avatars.githubusercontent.com/u/59023460?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"akordowski\" src=\"https://avatars.githubusercontent.com/u/9746197?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"coryisakson\" src=\"https://avatars.githubusercontent.com/u/303811?v=4\u0026s=110\" width=\"110\"\u003e |\n| [chaelli](https://github.com/chaelli) | [pawarsum12](https://github.com/pawarsum12) | [aaronpowell](https://github.com/aaronpowell) | [alexibraimov](https://github.com/alexibraimov) | [akordowski](https://github.com/akordowski) | [coryisakson](https://github.com/coryisakson) |\n| \u003cimg alt=\"DM-98\" src=\"https://avatars.githubusercontent.com/u/10290906?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"EelcoKoster\" src=\"https://avatars.githubusercontent.com/u/3356003?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"GraemeJones104\" src=\"https://avatars.githubusercontent.com/u/79144786?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"imranshams\" src=\"https://avatars.githubusercontent.com/u/15226209?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"jurepurgar\" src=\"https://avatars.githubusercontent.com/u/6506920?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"JustinRidings\" src=\"https://avatars.githubusercontent.com/u/49916830?v=4\u0026s=110\" width=\"110\"\u003e |\n| [DM-98](https://github.com/DM-98) | [EelcoKoster](https://github.com/EelcoKoster) | [GraemeJones104](https://github.com/GraemeJones104) | [imranshams](https://github.com/imranshams) | [jurepurgar](https://github.com/jurepurgar) | [JustinRidings](https://github.com/JustinRidings) |\n| \u003cimg alt=\"Foorcee\" src=\"https://avatars.githubusercontent.com/u/5587062?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"v-msamovendyuk\" src=\"https://avatars.githubusercontent.com/u/61688766?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"qihangnet\" src=\"https://avatars.githubusercontent.com/u/1784873?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"neel015\" src=\"https://avatars.githubusercontent.com/u/34688460?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"pascalberger\" src=\"https://avatars.githubusercontent.com/u/2190718?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"pradeepr-roboticist\" src=\"https://avatars.githubusercontent.com/u/6598307?v=4\u0026s=110\" width=\"110\"\u003e |\n| [Foorcee](https://github.com/Foorcee) | [v-msamovendyuk](https://github.com/v-msamovendyuk) | [qihangnet](https://github.com/qihangnet) | [neel015](https://github.com/neel015) | [pascalberger](https://github.com/pascalberger) | [pradeepr-roboticist](https://github.com/pradeepr-roboticist) |\n| \u003cimg alt=\"setuc\" src=\"https://avatars.githubusercontent.com/u/9305355?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"slapointe\" src=\"https://avatars.githubusercontent.com/u/1054412?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"spenavajr\" src=\"https://avatars.githubusercontent.com/u/96045491?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"tarekgh\" src=\"https://avatars.githubusercontent.com/u/10833894?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"teresaqhoang\" src=\"https://avatars.githubusercontent.com/u/125500434?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"tomasz-skarzynski\" src=\"https://avatars.githubusercontent.com/u/119002478?v=4\u0026s=110\" width=\"110\"\u003e |\n| [setuc](https://github.com/setuc) | [slapointe](https://github.com/slapointe) | [spenavajr](https://github.com/spenavajr) | [tarekgh](https://github.com/tarekgh) | [teresaqhoang](https://github.com/teresaqhoang) | [tomasz-skarzynski](https://github.com/tomasz-skarzynski) |\n| \u003cimg alt=\"Valkozaur\" src=\"https://avatars.githubusercontent.com/u/58659526?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"vicperdana\" src=\"https://avatars.githubusercontent.com/u/7114832?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"walexee\" src=\"https://avatars.githubusercontent.com/u/12895846?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"aportillo83\" src=\"https://avatars.githubusercontent.com/u/72951744?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"carlodek\" src=\"https://avatars.githubusercontent.com/u/56030624?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"KSemenenko\" src=\"https://avatars.githubusercontent.com/u/4385716?v=4\u0026s=110\" width=\"110\"\u003e |\n| [Valkozaur](https://github.com/Valkozaur) | [vicperdana](https://github.com/vicperdana) | [walexee](https://github.com/walexee) | [aportillo83](https://github.com/aportillo83) | [carlodek](https://github.com/carlodek) | [KSemenenko](https://github.com/KSemenenko) |\n| \u003cimg alt=\"roldengarm\" src=\"https://avatars.githubusercontent.com/u/37638588?v=4\u0026s=110\" width=\"110\"\u003e | \u003cimg alt=\"snakex64\" src=\"https://avatars.githubusercontent.com/u/39806655?v=4\u0026s=110\" width=\"110\"\u003e |\n| [roldengarm](https://github.com/roldengarm) | [snakex64](https://github.com/snakex64) |\n","funding_links":[],"categories":["others","Plugins","A01_文本生成_文本对话","**Section 2** : Azure OpenAI and Reference Architecture","LLM Frameworks","C# #"],"sub_categories":["大语言对话模型及数据","**Microsoft Azure OpenAI relevant LLM Framework**"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fkernel-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fkernel-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fkernel-memory/lists"}