fix: correct argument for cohere_api_key
This commit is contained in:
parent
dc259c7d57
commit
659793fcee
1 changed files with 3 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ from langflow.schema import Data
|
||||||
|
|
||||||
class CohereRerankComponent(LCVectorStoreComponent):
|
class CohereRerankComponent(LCVectorStoreComponent):
|
||||||
display_name = "Cohere Rerank"
|
display_name = "Cohere Rerank"
|
||||||
description = "Rerank documents using the Cohere API."
|
description = "Rerank documents using the Cohere API and a retriever."
|
||||||
icon = "Cohere"
|
icon = "Cohere"
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|
@ -38,13 +38,13 @@ class CohereRerankComponent(LCVectorStoreComponent):
|
||||||
|
|
||||||
def build_base_retriever(self) -> Retriever:
|
def build_base_retriever(self) -> Retriever:
|
||||||
cohere_reranker = CohereRerank(
|
cohere_reranker = CohereRerank(
|
||||||
api_key=self.api_key, model=self.model, top_n=self.top_n, user_agent=self.user_agent
|
cohere_api_key=self.api_key, model=self.model, top_n=self.top_n, user_agent=self.user_agent
|
||||||
)
|
)
|
||||||
retriever = ContextualCompressionRetriever(base_compressor=cohere_reranker, base_retriever=self.retriever)
|
retriever = ContextualCompressionRetriever(base_compressor=cohere_reranker, base_retriever=self.retriever)
|
||||||
return retriever
|
return retriever
|
||||||
|
|
||||||
async def search_documents(self) -> List[Data]:
|
async def search_documents(self) -> List[Data]:
|
||||||
retriever = self.build_base_retriever()
|
retriever: ContextualCompressionRetriever = self.build_base_retriever()
|
||||||
documents = await retriever.ainvoke(self.search_query)
|
documents = await retriever.ainvoke(self.search_query)
|
||||||
data = self.to_data(documents)
|
data = self.to_data(documents)
|
||||||
self.status = data
|
self.status = data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue