mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 20:06:54 +08:00
chore: extract retrival method literal values into enum (#5060)
This commit is contained in:
15
api/core/rag/retrieval/retrival_methods.py
Normal file
15
api/core/rag/retrieval/retrival_methods.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class RetrievalMethod(str, Enum):
|
||||
SEMANTIC_SEARCH = 'semantic_search'
|
||||
FULL_TEXT_SEARCH = 'full_text_search'
|
||||
HYBRID_SEARCH = 'hybrid_search'
|
||||
|
||||
@staticmethod
|
||||
def is_support_semantic_search(retrieval_method: str) -> bool:
|
||||
return retrieval_method in {RetrievalMethod.SEMANTIC_SEARCH, RetrievalMethod.HYBRID_SEARCH}
|
||||
|
||||
@staticmethod
|
||||
def is_support_fulltext_search(retrieval_method: str) -> bool:
|
||||
return retrieval_method in {RetrievalMethod.FULL_TEXT_SEARCH, RetrievalMethod.HYBRID_SEARCH}
|
||||
Reference in New Issue
Block a user