Sentence Similarity
	
	
	
	
	sentence-transformers
	
	
	
	
	PyTorch
	
	
	
	
	Transformers
	
	
	
		
	
	English
	
	
	
	
	t5
	
	
	
	
	text-embedding
	
	
	
	
	embeddings
	
	
	
	
	information-retrieval
	
	
	
	
	beir
	
	
	
	
	text-classification
	
	
	
	
	language-model
	
	
	
	
	text-clustering
	
	
	
	
	text-semantic-similarity
	
	
	
	
	text-evaluation
	
	
	
	
	prompt-retrieval
	
	
	
	
	text-reranking
	
	
	
	
	feature-extraction
	
	
	
	
	English
	
	
	
	
	Sentence Similarity
	
	
	
	
	natural_questions
	
	
	
	
	ms_marco
	
	
	
	
	fever
	
	
	
	
	hotpot_qa
	
	
	
	
	mteb
	
	
	
		
	
	
		Eval Results
	
	
	
		
	
	text-generation-inference
	
	
	| from typing import Dict, List, Any | |
| from InstructorEmbedding import INSTRUCTOR | |
| class EndpointHandler(): | |
| def __init__(self, path=""): | |
| self.model = INSTRUCTOR(path) | |
| def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]: | |
| instruction = data.get("instruction", "") | |
| document = data.get("document", "") | |
| embedding = self.model.encode([[instruction, document]]).flatten() | |
| return [ | |
| { | |
| "embedding": embedding, | |
| "instruction": instruction, | |
| "document": document | |
| } | |
| ] |