I don’t know exactly what your is your domain but the problem setup It seems to be similar to NER.
With just 1 sample per class it seems similar to  one-shot NER.
So the most similar thing that I can think about your data is finding some idea in few-shot NER approaches:

  
      

      arXiv.org
  

  
    

Few-Shot Named Entity Recognition: A Comprehensive Study 1

  This paper presents a comprehensive study to efficiently build named entity
recognition (NER) systems when a small number of in-domain labeled data is
available. Based upon recent Transformer-based self-supervised pre-trained
language models (PLMs),...


  

  
    
    
  

  



  
      

      arXiv.org
  

  
    

Few-NERD: A Few-Shot Named Entity Recognition Dataset

  Recently, considerable literature has grown up around the theme of few-shot
named entity recognition (NER), but little published benchmark data
specifically focused on the practical and challenging task. Current approaches
collect existing supervised...