-
Notifications
You must be signed in to change notification settings - Fork 456
/
sentence_similarity.py
28 lines (22 loc) · 1018 Bytes
/
sentence_similarity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Inference code generated from the JSON schema spec in @huggingface/tasks.
#
# See:
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
from .base import BaseInferenceType
@dataclass
class SentenceSimilarityInputData(BaseInferenceType):
sentences: List[str]
"""A list of strings which will be compared against the source_sentence."""
source_sentence: str
"""The string that you wish to compare the other strings with. This can be a phrase,
sentence, or longer passage, depending on the model being used.
"""
@dataclass
class SentenceSimilarityInput(BaseInferenceType):
"""Inputs for Sentence similarity inference"""
inputs: SentenceSimilarityInputData
parameters: Optional[Dict[str, Any]] = None
"""Additional inference parameters"""