You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a prepare: Optional[bool] = None flag to Chat.answer(). If omitted, i.e. prepare is None, we can check self._prepared and call self.prepare if required. This skips the need for the user to call Chat.prepare() explicitly and streamlines the UX. Note that if Make Chat.prepare idempotent #480 is accepted, we can make the flag prepare: bool = True.
I'm a little on the fence on this one, but I'm going to propose it anyway to see what others think of it: add a __acall__() method to Chat that either defers to or completely replaces Chat.answer().
This would simplify the snippet from above even further to
chat=Rag().chat(...)
message=awaitchat(...)
The text was updated successfully, but these errors were encountered:
I propose three improvements:
Remove the context manager for a
Chat
ragna/ragna/core/_rag.py
Lines 402 to 409 in 7071cf4
It was somewhat quirky to begin with, because we only had enter but not exit logic. But after Add metadata filter handling for builtin source storages #456 we have regular use cases where we don't want to call
await chat.prepare()
.Add a
prepare: Optional[bool] = None
flag toChat.answer()
. If omitted, i.e.prepare is None
, we can checkself._prepared
and callself.prepare
if required. This skips the need for the user to callChat.prepare()
explicitly and streamlines the UX. Note that if Make Chat.prepare idempotent #480 is accepted, we can make the flagprepare: bool = True
.The points above would transform
into
__acall__()
method toChat
that either defers to or completely replacesChat.answer()
.This would simplify the snippet from above even further to
The text was updated successfully, but these errors were encountered: