Add optional parameter 'k' to BingSearchAPIWrapperComponent constructor
This commit is contained in:
parent
3d4a4c1fb5
commit
6d217fb81e
1 changed files with 4 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
from typing import Optional
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
|
|
||||||
# Assuming `BingSearchAPIWrapper` is a class that exists in the context
|
# Assuming `BingSearchAPIWrapper` is a class that exists in the context
|
||||||
|
|
@ -18,6 +19,7 @@ class BingSearchAPIWrapperComponent(CustomComponent):
|
||||||
"display_name": "Bing Subscription Key",
|
"display_name": "Bing Subscription Key",
|
||||||
"password": True,
|
"password": True,
|
||||||
},
|
},
|
||||||
|
"k": {"display_name": "Number of results", "advanced": True},
|
||||||
# 'k' is not included as it is not shown (show=False)
|
# 'k' is not included as it is not shown (show=False)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,10 +27,11 @@ class BingSearchAPIWrapperComponent(CustomComponent):
|
||||||
self,
|
self,
|
||||||
bing_search_url: str,
|
bing_search_url: str,
|
||||||
bing_subscription_key: str,
|
bing_subscription_key: str,
|
||||||
|
k: Optional[int] = 10,
|
||||||
) -> BingSearchAPIWrapper:
|
) -> BingSearchAPIWrapper:
|
||||||
# 'k' has a default value and is not shown (show=False), so it is hardcoded here
|
# 'k' has a default value and is not shown (show=False), so it is hardcoded here
|
||||||
return BingSearchAPIWrapper(
|
return BingSearchAPIWrapper(
|
||||||
bing_search_url=bing_search_url,
|
bing_search_url=bing_search_url,
|
||||||
bing_subscription_key=bing_subscription_key,
|
bing_subscription_key=bing_subscription_key,
|
||||||
k=10
|
k=k
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue