From 6d217fb81eeae230f33f3e9c3ea329e1c3c7767c Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 15 Jan 2024 22:16:36 -0300 Subject: [PATCH] Add optional parameter 'k' to BingSearchAPIWrapperComponent constructor --- .../langflow/components/utilities/BingSearchAPIWrapper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/components/utilities/BingSearchAPIWrapper.py b/src/backend/langflow/components/utilities/BingSearchAPIWrapper.py index abe10d5bf..22443d021 100644 --- a/src/backend/langflow/components/utilities/BingSearchAPIWrapper.py +++ b/src/backend/langflow/components/utilities/BingSearchAPIWrapper.py @@ -1,4 +1,5 @@ +from typing import Optional from langflow import CustomComponent # Assuming `BingSearchAPIWrapper` is a class that exists in the context @@ -18,6 +19,7 @@ class BingSearchAPIWrapperComponent(CustomComponent): "display_name": "Bing Subscription Key", "password": True, }, + "k": {"display_name": "Number of results", "advanced": True}, # 'k' is not included as it is not shown (show=False) } @@ -25,10 +27,11 @@ class BingSearchAPIWrapperComponent(CustomComponent): self, bing_search_url: str, bing_subscription_key: str, + k: Optional[int] = 10, ) -> BingSearchAPIWrapper: # 'k' has a default value and is not shown (show=False), so it is hardcoded here return BingSearchAPIWrapper( bing_search_url=bing_search_url, bing_subscription_key=bing_subscription_key, - k=10 + k=k )