IHttpClientService
Last updated
Last updated
The in Wisej.AI is utilized whenever an HTTP request is necessary, such as when interacting with LLM providers, vector databases, web searches, and other external services.
For instance, here's how the WebSearchServiceBase
class utilizes the IHttpClientService
:
The sample code above class creates an instance of the service and utilizes the SetHandler()
method to enable decompression. It also employs the AddDefaultHeader()
method to configure the authentication method and API key. Extending from WebSearchServiceBase
, the BingWebSearchService
class uses the GetAsync()
method on the service instance to perform its operations.
This service acts as an intermediary between the application code utilizing it and the HttpClient
instance. This design enables developers to implement their own version of IHttpClientService
, allowing them to intercept and customize all HTTP interactions as needed.
The default implementation of IHttpClientService
is in and leverages an instance of System.Net.Http.HttpClient
to handle HTTP requests.