{"id":1040,"date":"2025-02-27T21:48:40","date_gmt":"2025-02-28T05:48:40","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/?p=1040"},"modified":"2025-02-27T21:48:40","modified_gmt":"2025-02-28T05:48:40","slug":"%e4%bd%bf%e7%94%a8chroma%e6%9e%84%e5%bb%ba-net-ai%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/%e4%bd%bf%e7%94%a8chroma%e6%9e%84%e5%bb%ba-net-ai%e5%ba%94%e7%94%a8\/","title":{"rendered":"\u4f7f\u7528Chroma\u6784\u5efa.NET AI\u5e94\u7528"},"content":{"rendered":"<p style=\"text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><em><span style=\"font-size: 12pt;\">\u672c\u6587\u7ffb\u8bd1\u81ea <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/luquinta\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Luis\">Luis<\/a>\u00a0\u548c <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/jiricincura\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Jiri\">Jiri<\/a> \u7684 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-chroma-db-csharp-sdk\/\">Building .NET AI apps with Chroma<\/a><\/span><\/em><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><span class=\"\" data-bm=\"60\">\u65e0\u8bba\u60a8\u662f<\/span><span class=\"\" data-bm=\"61\">\u6784\u5efa<\/span> <span class=\"\" data-bm=\"63\">AI<\/span> <span class=\"\" data-bm=\"65\">\u89e3\u51b3\u65b9\u6848<\/span><span class=\"\" data-bm=\"66\">\u8fd8\u662f\u60f3<\/span><span class=\"\" data-bm=\"67\">\u4f7f\u7528<\/span><span class=\"\" data-bm=\"68\">\u9ad8\u7ea7<\/span><span class=\"\" data-bm=\"69\">\u641c\u7d22<\/span><span class=\"\" data-bm=\"70\">\u529f\u80fd<\/span><span class=\"\" data-bm=\"71\">\u589e\u5f3a<\/span><span class=\"\" data-bm=\"72\">\u73b0\u6709<\/span><span class=\"\" data-bm=\"73\">\u9879\u76ee<\/span><span class=\" \" data-bm=\"74\">\uff0c<\/span><span class=\" \" data-bm=\"75\">\u60a8<\/span><span class=\" \" data-bm=\"76\">\u73b0\u5728<\/span><span class=\" \" data-bm=\"77\">\u90fd\u53ef\u4ee5<\/span><span class=\"\" data-bm=\"78\">\u4f7f\u7528<\/span>\u00a0<span class=\"\" data-bm=\"81\">Chroma<\/span> <span class=\" \" data-bm=\"83\">\u4f5c\u4e3a<\/span> <span class=\" \" data-bm=\"85\">.<\/span><span class=\" \" data-bm=\"86\">NET<\/span> <span class=\" \" data-bm=\"88\">\u5e94\u7528\u7a0b\u5e8f\u4e2d<\/span><span class=\"\" data-bm=\"89\">\u7684<\/span><span class=\"\" data-bm=\"90\">\u6570\u636e\u5e93<\/span><span class=\" tta_align\" data-bm=\"91\">\u63d0\u4f9b\u7a0b\u5e8f<\/span><span class=\" \" data-bm=\"92\">\u3002<\/span><\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><strong>\u4ec0\u4e48\u662fChroma\uff1f<\/strong><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Chroma \u662f\u4e00\u6b3e\u9002\u7528\u4e8e\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u6e90\u6570\u636e\u5e93\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u501f\u52a9\u5bf9\u5b58\u50a8\u5d4c\u5165\u3001\u5143\u6570\u636e\u8fc7\u6ee4\u3001\u5411\u91cf\u641c\u7d22\u3001\u5168\u6587\u641c\u7d22\u3001\u6587\u6863\u5b58\u50a8\u548c\u591a\u6a21\u5f0f\u68c0\u7d22\u7684\u652f\u6301\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Chroma \u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u652f\u6301\u8bed\u4e49\u641c\u7d22\u548c\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff08RAG\uff09\u529f\u80fd\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6709\u5173\u66f4\u591a\u8be6\u60c5\uff0c\u8bf7\u8bbf\u95ee <a href=\"https:\/\/trychroma.com\/\">Chroma \u7f51\u7ad9<\/a>\u3002<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><strong>\u5728 C# \u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528<\/strong><strong>Chroma<\/strong><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 <a href=\"https:\/\/www.nuget.org\/packages\/ChromaDB.Client\">ChromaDB.Client<\/a>\u00a0\u6765\u8fde\u63a5\u5230 Chroma \u6570\u636e\u5e93\u5e76\u4f7f\u7528\u5411\u91cf\u641c\u7d22\u6765\u641c\u7d22\u7535\u5f71\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u7b80\u5355\u7684\u5f00\u59cb\u65b9\u5f0f\u662f\u5728\u672c\u5730\u4f7f\u7528 <a href=\"https:\/\/docs.trychroma.com\/production\/containers\/docker\">Chroma Docker \u6620\u50cf<\/a>\u3002\u60a8\u4e5f\u53ef\u4ee5<a href=\"https:\/\/docs.trychroma.com\/production\/cloud-providers\/azure\">\u5728 Azure \u4e2d\u90e8\u7f72\u5b9e\u4f8b<\/a>\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>ChromaDB.Client \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7531\u793e\u533a\u652f\u6301\u7684\u5e93\u3002<\/div><\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><strong>\u8fde\u63a5\u6570\u636e\u5e93<\/strong><\/span><\/h3>\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\">\u521b\u5efa C# \u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\">\u5b89\u88c5 <a href=\"https:\/\/www.nuget.org\/packages\/ChromaDB.Client\" target=\"_blank\" rel=\"noopener\">ChromaDB.Client<\/a> Nuget \u5305<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\">\u521b\u5efa\u5e26\u6709\u914d\u7f6e\u9009\u9879\u7684 <code>ChromaClient<\/code><\/span><\/li>\n<\/ol>\n<pre class=\"prettyprint language-cs language-csharp\" style=\"padding-left: 40px;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-cs language-csharp\">using ChromaDB.Client;\r\nvar configOptions = new ChromaConfigurationOptions(uri: \"http:\/\/localhost:8000\/api\/v1\/\");\r\nusing var httpClient = new HttpClient();\r\nvar client = new ChromaClient(configOptions, httpClient);<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u4f7f\u7528\u6258\u7ba1\u7248\u672c\u7684 Chroma \u65f6\uff0c\u8bf7\u5c06 <code>uri<\/code> \u66ff\u6362\u4e3a\u60a8\u7684\u6258\u7ba1\u7aef\u70b9\u3002<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><strong>\u521b\u5efa\u96c6\u5408<\/strong><\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u73b0\u5728\u60a8\u6709\u4e86\u5ba2\u6237\u7aef\uff0c\u8bf7\u521b\u5efa\u4e00\u4e2a\u96c6\u5408\u6765\u5b58\u50a8\u7535\u5f71\u6570\u636e\u3002<\/span><\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-cs language-csharp\">var collection = await client.GetOrCreateCollection(\"movies\");<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u5bf9\u8be5\u96c6\u5408\u6267\u884c\u64cd\u4f5c\uff0c\u60a8\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u96c6\u5408\u5ba2\u6237\u7aef\u3002<\/span><\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-cs language-csharp\">var collectionClient = new ChromaCollectionClient(collection, configOptions, httpClient);<\/code><\/span><\/pre>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><strong>\u5411\u96c6\u5408\u4e2d\u6dfb\u52a0\u6570\u636e<\/strong><\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u521b\u5efa\u96c6\u5408\u540e\uff0c\u5c31\u53ef\u4ee5\u5411\u5176\u4e2d\u6dfb\u52a0\u6570\u636e\u4e86\u3002\u6211\u4eec\u5b58\u50a8\u7684\u6570\u636e\u5305\u62ec\uff1a<\/span><\/p>\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7535\u5f71 ID<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7528\u4e8e\u8868\u793a\u7535\u5f71\u63cf\u8ff0\u7684\u5d4c\u5165\u5411\u91cf\u3002<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5305\u542b\u7535\u5f71\u6807\u9898\u7684\u5143\u6570\u636e<\/span><\/li>\n<\/ol>\n<table style=\"height: 306px; width: 90.9573%; background-color: #dbd7d7;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<th style=\"width: 2.44123%; height: 24px;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">ID<\/span><\/th>\n<th style=\"width: 7.86618%; height: 24px;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Title<\/span><\/th>\n<th style=\"width: 13.2007%; height: 24px;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Embedding<\/span><\/th>\n<th style=\"width: 68.1539%; height: 24px;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Movie Description<\/span><\/th>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 2.44123%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">1<\/span><\/td>\n<td style=\"width: 7.86618%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">The Lion King<\/span><\/td>\n<td style=\"width: 13.2007%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.10022575, -0.23998135]<\/span><\/td>\n<td style=\"width: 68.1539%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">The Lion King is a classic Disney animated film that tells the story of a young lion named Simba who embarks on a journey to reclaim his throne as the king of the Pride Lands after the tragic death of his father.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 72px;\">\n<td style=\"width: 2.44123%; height: 72px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">2<\/span><\/td>\n<td style=\"width: 7.86618%; height: 72px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Inception<\/span><\/td>\n<td style=\"width: 13.2007%; height: 72px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.10327095, 0.2563685]<\/span><\/td>\n<td style=\"width: 68.1539%; height: 72px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Inception is a mind-bending science fiction film directed by Christopher Nolan. It follows the story of Dom Cobb, a skilled thief who specializes in entering people\u2019s dreams to steal their secrets. However, he is offered a final job that involves planting an idea into someone\u2019s mind.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 2.44123%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">3<\/span><\/td>\n<td style=\"width: 7.86618%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Toy Story<\/span><\/td>\n<td style=\"width: 13.2007%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.095857024, -0.201278]<\/span><\/td>\n<td style=\"width: 68.1539%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Toy Story is a groundbreaking animated film from Pixar. It follows the secret lives of toys when their owner, Andy, is not around. Woody and Buzz Lightyear are the main characters in this heartwarming tale.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 2.44123%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">4<\/span><\/td>\n<td style=\"width: 7.86618%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Pulp Fiction<\/span><\/td>\n<td style=\"width: 13.2007%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.106827796, 0.21676421]<\/span><\/td>\n<td style=\"width: 68.1539%; height: 48px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Pulp Fiction is a crime film directed by Quentin Tarantino. It weaves together interconnected stories of mobsters, hitmen, and other colorful characters in a non-linear narrative filled with dark humor and violence.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 66px;\">\n<td style=\"width: 2.44123%; height: 66px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">5<\/span><\/td>\n<td style=\"width: 7.86618%; height: 66px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Shrek<\/span><\/td>\n<td style=\"width: 13.2007%; height: 66px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.09568083, -0.21177962]<\/span><\/td>\n<td style=\"width: 68.1539%; height: 66px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Shrek is an animated comedy film that follows the adventures of Shrek, an ogre who embarks on a quest to rescue Princess Fiona from a dragon-guarded tower in order to get his swamp back.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre class=\"prettyprint language-cs language-csharp\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-cs language-csharp\">List&lt;string&gt; movieIds = [\"1\", \"2\", \"3\", \"4\", \"5\" ];\r\n\r\nList&lt;ReadOnlyMemory&lt;float&gt;&gt; descriptionEmbeddings = [\r\n\r\n    new [] { 0.10022575f, -0.23998135f },\r\n    new [] { 0.10327095f, 0.2563685f },\r\n    new [] { 0.095857024f, -0.201278f },\r\n    new [] { 0.106827796f, 0.21676421f },\r\n    new [] { 0.09568083f, -0.21177962f },\r\n];\r\n\r\nList&lt;Dictionary&lt;string,object&gt;&gt; metadata = \r\n[\r\n    new Dictionary&lt;string, object&gt; { [\"Title\"] = \"The Lion King\" },\r\n    new Dictionary&lt;string, object&gt; { [\"Title\"] = \"Inception\"  },\r\n    new Dictionary&lt;string, object&gt; { [\"Title\"] = \"Toy Story\"  },\r\n    new Dictionary&lt;string, object&gt; { [\"Title\"] = \"Pulp Fiction\" },\r\n    new Dictionary&lt;string, object&gt; { [\"Title\"] = \"Shrek\"  },\r\n];\r\n\r\nawait collectionClient.Add(movieIds, descriptionEmbeddings, metadata);<\/code><\/span><\/pre>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><strong>\u641c\u7d22\u7535\u5f71\uff08\u4f7f\u7528\u5411\u91cf\u641c\u7d22\uff09<\/strong><\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u73b0\u5728\u60a8\u7684\u6570\u636e\u5df2\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u60a8\u53ef\u4ee5\u67e5\u8be2\u5b83\u3002\u5728\u672c\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u5411\u91cf\u641c\u7d22\u3002<\/span><\/p>\n<table style=\"width: 52.0214%; height: 65px;\">\n<tbody>\n<tr>\n<th style=\"width: 169px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Text<\/span><\/th>\n<th style=\"width: 204px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Embedding<\/span><\/th>\n<\/tr>\n<tr>\n<td style=\"width: 169px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">A family friendly movie<\/span><\/td>\n<td style=\"width: 204px; text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">[0.12217915, -0.034832448]<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre class=\"prettyprint language-cs language-csharp\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-cs language-csharp\">List&lt;ReadOnlyMemory&lt;float&gt;&gt; queryEmbedding = [new([0.12217915f, -0.034832448f])];\r\n\r\nvar queryResult = await collectionClient.Query(\r\n    queryEmbeddings: queryEmbedding,\r\n    nResults: 2,\r\n    include: ChromaQueryInclude.Metadatas | ChromaQueryInclude.Distances);\r\n\r\nforeach (var result in queryResult)\r\n{\r\n    foreach (var item in result)\r\n    {\r\n        Console.WriteLine($\"Title: {(string)item.Metadata[\"Title\"] ?? string.Empty} {(item.Distance)}\");\r\n    }\r\n}<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7ed3\u679c\u5e94\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u8f93\u51fa\u3002<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">Title: Toy Story 0.028396977\r\nTitle: Shrek 0.032012463<\/code><\/span><\/pre>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><strong>\u603b\u7ed3<\/strong><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u4e00\u6700\u65b0\u529f\u80fd\u589e\u5f3a\u4e86 .NET \u4e2d\u4e0d\u65ad\u53d1\u5c55\u7684 AI \u751f\u6001\u7cfb\u7edf\u3002\u5b83\u4e3a\u66f4\u7b80\u5355\u5730\u5b9e\u73b0\u73b0\u6709\u7684\u8bed\u4e49\u5185\u6838\u8fde\u63a5\u5668\u4ee5\u53ca\u5728\u60a8\u7684 .NET \u5e94\u7528\u7a0b\u5e8f\u4e2d\u65e0\u7f1d\u96c6\u6210 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-microsoft-extensions-vector-data\/\">Microsoft.Extensions.VectorData<\/a> \u548c <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-microsoft-extensions-ai-preview\/\">Microsoft.Extensions.AI<\/a> \u7b49\u57fa\u7840\u7ec4\u4ef6\u94fa\u5e73\u4e86\u9053\u8def\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u8981\u611f\u8c22 <a href=\"https:\/\/github.com\/ssone95\">@ssone95<\/a> \u4e3a\u8be5\u9879\u76ee\u6240\u505a\u7684\u5de5\u4f5c\u548c\u8d21\u732e\u3002\u6211\u4eec\u5f88\u9ad8\u5174\u80fd\u7ee7\u7eed\u4e0e\u793e\u533a\u5408\u4f5c\u5efa\u7acb\u5408\u4f5c\u4f19\u4f34\u5173\u7cfb\uff0c\u4f7f .NET \u5f00\u53d1\u4eba\u5458\u80fd\u591f\u6784\u5efa AI \u5e94\u7528\u7a0b\u5e8f\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\u6570\u636e\u5e93\u5982Chroma\u6784\u5efa AI \u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u67e5\u770b <a href=\"https:\/\/learn.microsoft.com\/dotnet\/ai\/quickstarts\/quickstart-ai-chat-with-data?tabs=azd&amp;pivots=openai\">.NET AI \u6587\u6863<\/a>\u3002<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u73b0\u5728\u5c31\u8bd5\u7528 Chroma C# SDK \u5e76\u00a0<a href=\"https:\/\/github.com\/ssone95\/ChromaDB.Client\">\u63d0\u4f9b\u53cd\u9988<\/a>\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea Luis\u00a0\u548c Jiri \u7684 Building .NET AI apps with Chroma \u65e0\u8bba\u60a8\u662f\u6784\u5efa AI \u89e3\u51b3\u65b9\u6848\u8fd8\u662f\u60f3\u4f7f\u7528\u9ad8\u7ea7\u641c\u7d22\u529f\u80fd\u589e\u5f3a\u73b0\u6709\u9879\u76ee\uff0c\u60a8\u73b0\u5728\u90fd\u53ef\u4ee5\u4f7f\u7528\u00a0Chroma \u4f5c\u4e3a .NET \u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u5e93\u63d0\u4f9b\u7a0b\u5e8f\u3002 \u4ec0\u4e48\u662fChroma\uff1f Chroma \u662f\u4e00\u6b3e\u9002\u7528\u4e8e\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u6e90\u6570\u636e\u5e93\u3002 \u501f\u52a9\u5bf9\u5b58\u50a8\u5d4c\u5165\u3001\u5143\u6570\u636e\u8fc7\u6ee4\u3001\u5411\u91cf\u641c\u7d22\u3001\u5168\u6587\u641c\u7d22\u3001\u6587\u6863\u5b58\u50a8\u548c\u591a\u6a21\u5f0f\u68c0\u7d22\u7684\u652f\u6301\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Chroma \u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u652f\u6301\u8bed\u4e49\u641c\u7d22\u548c\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff08RAG\uff09\u529f\u80fd\u3002 \u6709\u5173\u66f4\u591a\u8be6\u60c5\uff0c\u8bf7\u8bbf\u95ee Chroma \u7f51\u7ad9\u3002 \u5728 C# \u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528Chroma \u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 ChromaDB.Client\u00a0\u6765\u8fde\u63a5\u5230 Chroma \u6570\u636e\u5e93\u5e76\u4f7f\u7528\u5411\u91cf\u641c\u7d22\u6765\u641c\u7d22\u7535\u5f71\u3002 \u6700\u7b80\u5355\u7684\u5f00\u59cb\u65b9\u5f0f\u662f\u5728\u672c\u5730\u4f7f\u7528 Chroma Docker \u6620\u50cf\u3002\u60a8\u4e5f\u53ef\u4ee5\u5728 Azure \u4e2d\u90e8\u7f72\u5b9e\u4f8b\u3002 \u8fde\u63a5\u6570\u636e\u5e93 \u521b\u5efa C# \u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f \u5b89\u88c5 ChromaDB.Client Nuget \u5305 \u521b\u5efa\u5e26\u6709\u914d\u7f6e\u9009\u9879\u7684 ChromaClient using ChromaDB.Client; var configOptions = new ChromaConfigurationOptions(uri: [&hellip;]<\/p>\n","protected":false},"author":177361,"featured_media":1044,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[59,1,68],"tags":[57,82,83,71],"class_list":["post-1040","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-dotnet-ch","category-ai","tag-ai","tag-chroma","tag-database","tag-vectordb"],"acf":[],"blog_post_summary":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea Luis\u00a0\u548c Jiri \u7684 Building .NET AI apps with Chroma \u65e0\u8bba\u60a8\u662f\u6784\u5efa AI \u89e3\u51b3\u65b9\u6848\u8fd8\u662f\u60f3\u4f7f\u7528\u9ad8\u7ea7\u641c\u7d22\u529f\u80fd\u589e\u5f3a\u73b0\u6709\u9879\u76ee\uff0c\u60a8\u73b0\u5728\u90fd\u53ef\u4ee5\u4f7f\u7528\u00a0Chroma \u4f5c\u4e3a .NET \u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u5e93\u63d0\u4f9b\u7a0b\u5e8f\u3002 \u4ec0\u4e48\u662fChroma\uff1f Chroma \u662f\u4e00\u6b3e\u9002\u7528\u4e8e\u4eba\u5de5\u667a\u80fd\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u6e90\u6570\u636e\u5e93\u3002 \u501f\u52a9\u5bf9\u5b58\u50a8\u5d4c\u5165\u3001\u5143\u6570\u636e\u8fc7\u6ee4\u3001\u5411\u91cf\u641c\u7d22\u3001\u5168\u6587\u641c\u7d22\u3001\u6587\u6863\u5b58\u50a8\u548c\u591a\u6a21\u5f0f\u68c0\u7d22\u7684\u652f\u6301\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 Chroma \u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u652f\u6301\u8bed\u4e49\u641c\u7d22\u548c\u68c0\u7d22\u589e\u5f3a\u751f\u6210\uff08RAG\uff09\u529f\u80fd\u3002 \u6709\u5173\u66f4\u591a\u8be6\u60c5\uff0c\u8bf7\u8bbf\u95ee Chroma \u7f51\u7ad9\u3002 \u5728 C# \u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528Chroma \u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 ChromaDB.Client\u00a0\u6765\u8fde\u63a5\u5230 Chroma \u6570\u636e\u5e93\u5e76\u4f7f\u7528\u5411\u91cf\u641c\u7d22\u6765\u641c\u7d22\u7535\u5f71\u3002 \u6700\u7b80\u5355\u7684\u5f00\u59cb\u65b9\u5f0f\u662f\u5728\u672c\u5730\u4f7f\u7528 Chroma Docker \u6620\u50cf\u3002\u60a8\u4e5f\u53ef\u4ee5\u5728 Azure \u4e2d\u90e8\u7f72\u5b9e\u4f8b\u3002 \u8fde\u63a5\u6570\u636e\u5e93 \u521b\u5efa C# \u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f \u5b89\u88c5 ChromaDB.Client Nuget \u5305 \u521b\u5efa\u5e26\u6709\u914d\u7f6e\u9009\u9879\u7684 ChromaClient using ChromaDB.Client; var configOptions = new ChromaConfigurationOptions(uri: [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/users\/177361"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/comments?post=1040"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1040\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media\/1044"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media?parent=1040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/categories?post=1040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/tags?post=1040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}