Essentials
Inference Class
How to use the Inference class in Polyglot for LLM requests
The Inference
class is the primary interface for making requests to LLM providers in Polyglot. It provides methods for creating and sending requests, managing connections, and processing responses.
Creating an Inference Instance
Key Methods
The Inference
class provides several key methods:
create()
: Sends a request to the LLM providerwithConnection()
: Specifies which connection to usewithConfig()
: Sets a custom configurationwithHttpClient()
: Specifies a custom HTTP clientwithDebug()
: Enables or disables debug modewithCachedContext()
: Sets cached context for improved performance