Trait HTTPProvider
Source pub trait HTTPProvider<M: ModelInfo>: Send + Sync {
// Required methods
fn accept(&self, model: M, chat: &Chat) -> Result<Request>;
fn parse(&self, raw_response_text: String) -> Result<Message>;
}
Expand description
An HTTPProvider can take a chat and turn it into an http request.
Converts a chat into an HTTP request
§Errors
Returns an error if the chat cannot be converted to a request, for example
if the provider configuration is invalid or if serialization fails.
Parses a raw HTTP response into a message
§Errors
Returns an error if the response cannot be parsed, for example if the
response is not valid JSON or if it contains an error status.