community: FlashrankRerank support loading customer client (#23350)

Description: FlashrankRerank Document compressor support loading
customer client
Issue: #23338

Co-authored-by: gongwn1 <gongwn1@lenovo.com>
pull/23073/head
wenngong 3 months ago committed by GitHub
parent f58c40b4e3
commit b33d2346db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save