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
| <form> | |
| <SmartComboBox Url="api/list-toys" @bind-Value=@toy /> | |
| </form> | |
| @code { | |
| string? toy; | |
| } |
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
| var embedder = app.Services.GetRequiredService<LocalEmbedder>(); | |
| var toys = embedder.EmbedRange(["lightsaber", "soccer ball", "rc truck"]); | |
| app.MapSmartComboBox("/api/list-toys", | |
| request => | |
| { | |
| LocalEmbedder embedder = request.HttpContext.RequestServices.GetRequiredService<LocalEmbedder>(); | |
| return embedder.FindClosest(request.Query, toys); | |
| }); |
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
| public class CustomInferenceBackend(IConfiguration configuration) : IInferenceBackend | |
| { | |
| private readonly OpenAIInferenceBackend openAIInferenceBackend = new OpenAIInferenceBackend(configuration); | |
| public async Task<string> GetChatResponseAsync(ChatParameters options) | |
| { | |
| var resp = await openAIInferenceBackend.GetChatResponseAsync(options); | |
| return resp; | |
| } | |
| } |
OlderNewer