Polyglot \ Internals
Request/Response Lifecycle
Learn about the internal request/response lifecycle in Polyglot.
Let’s follow the complete flow of a request through Polyglot:
Request Processing
- Application creates an
Inference
object - Application calls
create()
with parameters Inference
creates anInferenceRequest
.Inference
dispatches theInferenceRequested
eventInference
passes the request to the driver- Driver uses request adapter to create HTTP request
- Request adapter uses body formatter and message formatter
- Driver sends the HTTP request
Inference
returns anInferenceResponse
object.
Response Processing
- Application accesses the
InferenceResponse
object content, e.g. viaresponse()
method. InferenceResponse
calls the driver to read and parse the response.- Driver uses a response adapter to extract content into appropriate fields of
LLMResponse
object InferenceResponse
dispatches theLLMResponseReceived
event- Result
LLMResponse
object is returned to the application