From 9a4a08e280b76338a345080fe1acc55bd325e49e Mon Sep 17 00:00:00 2001 From: thepetk Date: Mon, 23 Sep 2024 14:00:22 +0100 Subject: [PATCH] Add bearer auth support to rag Signed-off-by: thepetk --- recipes/natural_language_processing/rag/app/rag_app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/natural_language_processing/rag/app/rag_app.py b/recipes/natural_language_processing/rag/app/rag_app.py index 756e2745..b3591fc1 100644 --- a/recipes/natural_language_processing/rag/app/rag_app.py +++ b/recipes/natural_language_processing/rag/app/rag_app.py @@ -12,6 +12,7 @@ model_service = os.getenv("MODEL_ENDPOINT","http://0.0.0.0:8001") model_service = f"{model_service}/v1" +model_service_bearer = os.getenv("MODEL_ENDPOINT_BEARER") model_name = os.getenv("MODEL_NAME", "") chunk_size = os.getenv("CHUNK_SIZE", 150) embedding_model = os.getenv("EMBEDDING_MODEL","BAAI/bge-base-en-v1.5") @@ -75,7 +76,7 @@ def read_file(file): llm = ChatOpenAI(base_url=model_service, - api_key="EMPTY", + api_key="EMPTY" if model_service_bearer is None else model_service_bearer, model=model_name, streaming=True, callbacks=[StreamlitCallbackHandler(st.container(),