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 <chester.curme@gmail.com>
This commit is contained in:
Rajendra Kadam 2024-06-22 02:34:00 +05:30 committed by GitHub
parent 3b7b933aa2
commit 7ee2822ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)