From 317f7a0e4e0632cb5f7ba9f5b2deaafd5cda665c Mon Sep 17 00:00:00 2001 From: Yugar-1 Date: Sat, 8 Feb 2025 00:18:18 -0800 Subject: [PATCH 1/2] ChatQnA can support authorized LLM service. Signed-off-by: Yugar-1 --- comps/cores/mega/orchestrator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/comps/cores/mega/orchestrator.py b/comps/cores/mega/orchestrator.py index 97ee2a76b..6933cfc79 100644 --- a/comps/cores/mega/orchestrator.py +++ b/comps/cores/mega/orchestrator.py @@ -25,6 +25,7 @@ logger = CustomLogger("comps-core-orchestrator") LOGFLAG = os.getenv("LOGFLAG", False) +API_KEY_TOKENS = os.getenv("API_KEY_TOKEN", "EMPTY") class OrchestratorMetrics: @@ -259,7 +260,10 @@ async def execute( response = requests.post( url=endpoint, data=json.dumps(inputs), - headers={"Content-type": "application/json"}, + headers={ + "Content-type": "application/json", + "Authorization": f"Bearer {API_KEY_TOKENS}" + }, proxies={"http": None}, stream=True, timeout=1000, From 065ca975c887faadfb9a2ec8faa33ba41879daf5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2025 09:29:19 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- comps/cores/mega/orchestrator.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/comps/cores/mega/orchestrator.py b/comps/cores/mega/orchestrator.py index 6933cfc79..aab8a4ef5 100644 --- a/comps/cores/mega/orchestrator.py +++ b/comps/cores/mega/orchestrator.py @@ -260,10 +260,7 @@ async def execute( response = requests.post( url=endpoint, data=json.dumps(inputs), - headers={ - "Content-type": "application/json", - "Authorization": f"Bearer {API_KEY_TOKENS}" - }, + headers={"Content-type": "application/json", "Authorization": f"Bearer {API_KEY_TOKENS}"}, proxies={"http": None}, stream=True, timeout=1000,