Skip to content

ChatCompletion.LocalSerializerContext

This example assumes using HuggingFace; is in scope and apiKey contains your HuggingFace API key.

1
2
3
4
5
6
using var handler = new ChatCompletionHandler();
using var httpClient = new HttpClient(handler);
using var client = new HuggingFaceInferenceClient("local-key", httpClient: httpClient, disposeHttpClient: false);
IChatClient chatClient = client;

var response = await chatClient.GetResponseAsync("Hello");