Spaces:
Runtime error
Runtime error
Download SemanticKernel/Filters/FoodCheckFunctionFilter.cs from yashW2022/FoodHealthCheckerHF: direct link, hf CLI and curl.
- Browser
- Download file 602 Bytes
-
https://huggingface.co/spaces/yashW2022/FoodHealthCheckerHF/resolve/main/SemanticKernel/Filters/FoodCheckFunctionFilter.cs
- Command line
-
hf download hf://spaces/yashW2022/FoodHealthCheckerHF/SemanticKernel/Filters/FoodCheckFunctionFilter.cs
-
curl -L -o FoodCheckFunctionFilter.cs https://huggingface.co/spaces/yashW2022/FoodHealthCheckerHF/resolve/main/SemanticKernel/Filters/FoodCheckFunctionFilter.cs
602 Bytes
| using Microsoft.SemanticKernel; | |
| namespace FoodHealthChecker.SemanticKernel.Filters | |
| { | |
| //TODO - Update to use filters plugin | |
| public class FoodCheckFunctionFilter : IFunctionInvocationFilter | |
| { | |
| public async Task OnFunctionInvocationAsync(FunctionInvocationContext context, Func<FunctionInvocationContext, Task> next) | |
| { | |
| try | |
| { | |
| await next(context); | |
| } | |
| catch (Exception ex) | |
| { | |
| context.Result = new FunctionResult(context.Function, "Function call failed"); | |
| } | |
| } | |
| } | |
| } | |