mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
community: FlashrankRerank support loading customer client (#23350)
Description: FlashrankRerank Document compressor support loading customer client Issue: #23338 Co-authored-by: gongwn1 <gongwn1@lenovo.com>
This commit is contained in:
parent
f58c40b4e3
commit
b33d2346db
@ -38,6 +38,9 @@ class FlashrankRerank(BaseDocumentCompressor):
|
||||
@root_validator(pre=True)
|
||||
def validate_environment(cls, values: Dict) -> Dict:
|
||||
"""Validate that api key and python package exists in environment."""
|
||||
if "client" in values:
|
||||
return values
|
||||
else:
|
||||
try:
|
||||
from flashrank import Ranker
|
||||
except ImportError:
|
||||
|
Loading…
Reference in New Issue
Block a user