源代码位于 llama-index-packs/llama-index-packs-fuzzy-citation/llama_index/packs/fuzzy_citation/base.py
get_modules
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138 | class FuzzyCitationEnginePack(BaseLlamaPack):
def __init__(
self, query_engine: BaseQueryEngine, threshold: int = DEFAULT_THRESHOLD
) -> None:
"""Init params."""
try:
from thefuzz import fuzz # noqa: F401
except ImportError:
raise ImportError(
"Please run `pip install thefuzz` to use the fuzzy citation engine."
)
self.query_engine = FuzzyCitationQueryEngine(
query_engine=query_engine, threshold=threshold
)
def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"query_engine": self.query_engine,
"query_engine_cls": FuzzyCitationQueryEngine,
}
def run(self, query_str: str, **kwargs: Any) -> RESPONSE_TYPE:
"""Run the pipeline."""
return self.query_engine.query(query_str)
|
获取模块。
get_modules() -> Dict[str, Any]
run
get_modules
| def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"query_engine": self.query_engine,
"query_engine_cls": FuzzyCitationQueryEngine,
}
|
运行流水线。
run(query_str: str, **kwargs: Any) -> RESPONSE_TYPE
返回顶部
get_modules
| def run(self, query_str: str, **kwargs: Any) -> RESPONSE_TYPE:
"""Run the pipeline."""
return self.query_engine.query(query_str)
|