Why sampling?
As we said at the beginning, the server wants to delegate some problems to the client and, specifically, to the client’s LLM. So, what problems can an LLM help with that the server can’t? There are lots of examples if you think about it: generating product descriptions, abstracts, tags, and more.
Let’s look into the sample flow first so we understand how the interaction happens at a high level.
Sampling flow
When performing sampling, the following participants are involved:
- User: The user is usually involved in two places, as the originator of the initial action, and even as the human in the loop, accepting or modifying the sample request.
- Server: The server is the participant sending out a sample request. This request is usually sent out from a server feature, such as a tool call, reading of a resource, or a request from a prompt template.
- Client: The client’s job is to receive the sample request and show...
 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                