-
Notifications
You must be signed in to change notification settings - Fork 306
Improve all samples with cache-awareness, add 4 new samples, fix SDK versions, and prepare repo for public sharing #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leestott
wants to merge
15
commits into
microsoft:main
Choose a base branch
from
leestott:samples/improve-and-add-new-samples
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b6c9e49
Improve samples with cache-awareness, add 4 new samples, fix SDK vers…
leestott 78206d0
Update
leestott 0f5e7a9
fix: address review feedback - thread safety, README accuracy, TF-IDF…
leestott acf06fc
fix: address round-3 review issues — env vars, event loop, Cancellati…
leestott 050fbed
update
leestott e373a2b
update
leestott 10d78b3
Update
leestott 26908ec
update
leestott 16cfcac
Update
leestott bf1b5ca
update
leestott a60d8e0
update
leestott 0a82b17
update
leestott c6c1cab
update
leestott 781c743
Update
leestott 8e60d15
update
leestott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,14 @@ | ||
| # TODO: The maintainer of this repo has not yet edited this file | ||
|
|
||
| **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? | ||
|
|
||
| - **No CSS support:** Fill out this template with information about how to file issues and get help. | ||
| - **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps. | ||
| - **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide. | ||
|
|
||
| *Then remove this first heading from this SUPPORT.MD file before publishing your repo.* | ||
|
|
||
| # Support | ||
|
|
||
| ## How to file issues and get help | ||
| ## How to file issues and get help | ||
|
|
||
| This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
| issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
| This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
| issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
| feature request as a new Issue. | ||
|
|
||
| For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE | ||
| FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER | ||
| CHANNEL. WHERE WILL YOU HELP PEOPLE?**. | ||
| For help and questions about using Foundry Local, please refer to the [documentation](docs/README.md) | ||
| and the [samples](samples/) in this repository. | ||
|
|
||
| ## Microsoft Support Policy | ||
| ## Microsoft Support Policy | ||
|
|
||
| Support for this **PROJECT or PRODUCT** is limited to the resources listed above. | ||
| Support for Foundry Local is limited to the resources listed above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
samples/cs/whisper-transcription/Health/FoundryHealthCheck.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
|
||
| namespace WhisperTranscription; | ||
|
|
||
| public class FoundryHealthCheck : IHealthCheck | ||
| { | ||
| private readonly FoundryModelService _modelService; | ||
|
|
||
| public FoundryHealthCheck(FoundryModelService modelService) | ||
| { | ||
| _modelService = modelService; | ||
| } | ||
|
|
||
| public async Task<HealthCheckResult> CheckHealthAsync( | ||
| HealthCheckContext context, | ||
| CancellationToken cancellationToken = default) | ||
| { | ||
| try | ||
| { | ||
| var model = await _modelService.GetModelAsync(); | ||
| return HealthCheckResult.Healthy($"Model available: {model.Id}"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| return HealthCheckResult.Unhealthy("Foundry Local unavailable", ex); | ||
| } | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
samples/cs/whisper-transcription/Middleware/ErrorHandlingMiddleware.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| using System.Net; | ||
| using System.Text.Json; | ||
|
|
||
| namespace WhisperTranscription; | ||
|
|
||
| public class ErrorHandlingMiddleware | ||
| { | ||
| private readonly RequestDelegate _next; | ||
| private readonly ILogger<ErrorHandlingMiddleware> _logger; | ||
|
|
||
| public ErrorHandlingMiddleware(RequestDelegate next, ILogger<ErrorHandlingMiddleware> logger) | ||
| { | ||
| _next = next; | ||
| _logger = logger; | ||
| } | ||
|
|
||
| public async Task InvokeAsync(HttpContext context) | ||
| { | ||
| try | ||
| { | ||
| await _next(context); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, "Unhandled exception"); | ||
| context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; | ||
| context.Response.ContentType = "application/json"; | ||
| var payload = JsonSerializer.Serialize(new { error = ex.Message }); | ||
| await context.Response.WriteAsync(payload); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.