Skip to content

Commit

Permalink
sample
Browse files Browse the repository at this point in the history
  • Loading branch information
cherchyk committed Aug 25, 2024
1 parent 51e31b1 commit 55b5f0a
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 53 deletions.
44 changes: 22 additions & 22 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/how-to/intent-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ private static async Task AskForIntent(string request)
}
```

You can also review [Intent Detection working example](../../examples/007-dotnet-WebClient-Intent-Detection/README.md)
You can also review [Intent Detection working example](https://github.com/microsoft/kernel-memory/tree/main/examples/211-dotnet-WebClient-Intent-Detection/README.md)
20 changes: 11 additions & 9 deletions examples/001-dotnet-WebClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@
This example shows how to import multiple files and ask questions, delegating
the work to the Kernel Memory Service.

### There are two ways to run this example:

1. The example points to `https://127.0.0.1:9001` so you should start the
Kernel Memory Service locally before running this example.

2. You can easily deploy Kernel Memory to Azure by following procedure on [this page](../../infra/README.md).
## Running the example locally

The example points to `http://127.0.0.1:9001` so you should start the Kernel Memory Service locally before running this example.
Start `dotnet/Service/Service.csproj`. See `dotnet/Service/README.md` for details.

```csharp
var memory = new MemoryWebClient("http://127.0.0.1:9001/");
// In case you have deployed the service to Azure, you can use the following code:
// s_memory = new MemoryWebClient("https://AZURE_CONTAINER_APP_ENDPOINT.azurecontainerapps.io/", apiKey: "KEY_YOU_PROVIDED_WHEN_DEPLOYING");

await memory.ImportDocumentAsync(new Document("doc012")
.AddFiles([ "file2.txt", "file3.docx", "file4.pdf" ])
Expand All @@ -29,6 +23,14 @@ while (!await memory.IsDocumentReadyAsync(documentId: "doc012"))
string answer = await memory.AskAsync("What's Semantic Kernel?");
```

# Run the example
### Run the example

To run the example, depending on your platform, execute either `run.sh` or `run.cmd` or just `dotnet run`

## Running the example with KM on Azure

You can easily deploy Kernel Memory to Azure by following procedure on [this page](../../infra/README.md). Next, you will need to update one line in `Program.cs` to point to the Azure Public IP created during the deployment, you will also need to provide the API key you used when deploying the service.

```csharp
var memory = new MemoryWebClient("http://[IP ADDRESS]/", apiKey: "KEY_YOU_PROVIDED_WHEN_DEPLOYING");
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class Program

public static async Task Main()
{
s_memory = new MemoryWebClient("https://km-service-5798c2.gentlemeadow-e01ece56.eastus2.azurecontainerapps.io/", apiKey: "6957f639-2c52-4ecc-8823-ef9b086095c1");
s_memory = new MemoryWebClient("http://127.0.0.1:9001/");

// =======================
// === INGESTION =========
Expand Down
40 changes: 20 additions & 20 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ Some examples about how to use Kernel Memory.
5. [Processing files with custom logic (custom handlers) in serverless mode](004-dotnet-serverless-custom-pipeline)
6. [Processing files with custom logic (custom handlers) in asynchronous mode](005-dotnet-AsyncMemoryCustomPipeline)
7. [Upload files and ask questions from command line using curl](006-curl-calling-webservice)
8. [Intent Detection](007-dotnet-WebClient-Intent-Detection)
9. [Customizing RAG and summarization prompts](101-dotnet-custom-Prompts)
10. [Custom partitioning/text chunking options](102-dotnet-custom-partitioning-options)
11. [Using a custom embedding/vector generator](103-dotnet-custom-EmbeddingGenerator)
12. [Using custom LLMs](104-dotnet-custom-LLM)
13. [Using LLama](105-dotnet-serverless-llamasharp)
14. [Summarizing documents, using synthetic memories](106-dotnet-retrieve-synthetics)
15. [Using Semantic Kernel LLM connectors](107-dotnet-SemanticKernel-TextCompletion)
16. [Using custom content decoders](108-dotnet-custom-content-decoders)
17. [Using a custom web scraper to fetch web pages](109-dotnet-custom-webscraper)
18. [Generating answers with Anthropic LLMs](110-dotnet-anthropic)
19. [Hybrid Search with Azure AI Search](111-dotnet-azure-ai-hybrid-search)
20. [Writing and using a custom ingestion handler](201-dotnet-serverless-custom-handler)
21. [Running a single asynchronous pipeline handler as a standalone service](202-dotnet-custom-handler-as-a-service)
22. [Test project using KM package from nuget.org](203-dotnet-using-core-nuget)
23. [Integrating Memory with ASP.NET applications and controllers](204-dotnet-ASP.NET-MVC-integration)
24. [Sample code showing how to extract text from files](205-dotnet-extract-text-from-docs)
25. [.NET configuration and logging](206-dotnet-configuration-and-logging)
26. [Expanding chunks retrieving adjacent partitions](207-dotnet-expanding-chunks-on-retrieval)
27. [Using local models via LM Studio](208-dotnet-lmstudio)
8. [Customizing RAG and summarization prompts](101-dotnet-custom-Prompts)
9. [Custom partitioning/text chunking options](102-dotnet-custom-partitioning-options)
10. [Using a custom embedding/vector generator](103-dotnet-custom-EmbeddingGenerator)
11. [Using custom LLMs](104-dotnet-custom-LLM)
12. [Using LLama](105-dotnet-serverless-llamasharp)
13. [Summarizing documents, using synthetic memories](106-dotnet-retrieve-synthetics)
14. [Using Semantic Kernel LLM connectors](107-dotnet-SemanticKernel-TextCompletion)
15. [Using custom content decoders](108-dotnet-custom-content-decoders)
16. [Using a custom web scraper to fetch web pages](109-dotnet-custom-webscraper)
17. [Generating answers with Anthropic LLMs](110-dotnet-anthropic)
18. [Hybrid Search with Azure AI Search](111-dotnet-azure-ai-hybrid-search)
19. [Writing and using a custom ingestion handler](201-dotnet-serverless-custom-handler)
20. [Running a single asynchronous pipeline handler as a standalone service](202-dotnet-custom-handler-as-a-service)
21. [Test project using KM package from nuget.org](203-dotnet-using-core-nuget)
22. [Integrating Memory with ASP.NET applications and controllers](204-dotnet-ASP.NET-MVC-integration)
23. [Sample code showing how to extract text from files](205-dotnet-extract-text-from-docs)
24. [.NET configuration and logging](206-dotnet-configuration-and-logging)
25. [Expanding chunks retrieving adjacent partitions](207-dotnet-expanding-chunks-on-retrieval)
26. [Using local models via LM Studio](208-dotnet-lmstudio)
27. [Intent Detection](211-dotnet-WebClient-Intent-Detection)
28. [Fetching data from Discord](301-discord-test-application)

0 comments on commit 55b5f0a

Please sign in to comment.