Add k parameter to SearxSearchWrapper build method
This commit is contained in:
parent
a7196ec774
commit
01b386fe5b
1 changed files with 9 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict
|
||||||
|
from langchain_community.utilities.searx_search import SearxSearchWrapper
|
||||||
class SearxSearchWrapperComponent(CustomComponent):
|
class SearxSearchWrapperComponent(CustomComponent):
|
||||||
display_name = "SearxSearchWrapper"
|
display_name = "SearxSearchWrapper"
|
||||||
description = "Wrapper for Searx API."
|
description = "Wrapper for Searx API."
|
||||||
|
|
@ -13,15 +13,17 @@ class SearxSearchWrapperComponent(CustomComponent):
|
||||||
"multiline": True,
|
"multiline": True,
|
||||||
"value": '{"Authorization": "Bearer <token>"}'
|
"value": '{"Authorization": "Bearer <token>"}'
|
||||||
},
|
},
|
||||||
|
"k": {
|
||||||
|
"display_name": "k",
|
||||||
|
"advanced": True,
|
||||||
|
"field_type": "int",
|
||||||
|
"value": 10
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
|
k: Optional[int] = 10,
|
||||||
headers: Optional[Dict[str, str]] = None,
|
headers: Optional[Dict[str, str]] = None,
|
||||||
):
|
):
|
||||||
if headers is None:
|
return SearxSearchWrapper(headers=headers,k=k)
|
||||||
headers = {"Authorization": "Bearer <token>"}
|
|
||||||
# Placeholder for actual SearxSearchWrapper instantiation
|
|
||||||
# Since the actual SearxSearchWrapper class is not available,
|
|
||||||
# it is assumed that it would be instantiated here with headers as an argument.
|
|
||||||
pass
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue