From 7ee2822ec264881bb4938d221f33ecfef07314d0 Mon Sep 17 00:00:00 2001 From: Rajendra Kadam Date: Sat, 22 Jun 2024 02:34:00 +0530 Subject: [PATCH] community: Fix TypeError in PebbloRetrievalQA (#23170) **Description:** Fix "`TypeError: 'NoneType' object is not iterable`" when the auth_context is absent in PebbloRetrievalQA. The auth_context is optional; hence, PebbloRetrievalQA should work without it, but it throws an error at the moment. This PR fixes that issue. **Issue:** NA **Dependencies:** None **Unit tests:** NA --------- Co-authored-by: Chester Curme --- .../langchain_community/chains/pebblo_retrieval/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/community/langchain_community/chains/pebblo_retrieval/base.py b/libs/community/langchain_community/chains/pebblo_retrieval/base.py index 2be7dd6878..6097c5b29c 100644 --- a/libs/community/langchain_community/chains/pebblo_retrieval/base.py +++ b/libs/community/langchain_community/chains/pebblo_retrieval/base.py @@ -129,9 +129,7 @@ class PebbloRetrievalQA(Chain): "prompt_time": prompt_time, "user": auth_context.user_id if auth_context else "unknown", "user_identities": auth_context.user_auth - if "user_auth" in dict(auth_context) - else [] - if auth_context + if auth_context and hasattr(auth_context, "user_auth") else [], } qa_payload = Qa(**qa)