Closed pmeier closed 3 months ago
This seems fine to me. What would be the behaviour if no corpus name is passed?
What would be the behaviour if no corpus name is passed?
Sorry, forgot to mention that. IMO the behavior should be "author defined". Meaning, the author should put in some behavior for the use case of the user not supplying a corpus name.
For our builtin source storages, we can simply continue to use the "global" corpus:
If we at some point support #191, the behavior would change to "global corpus for the given embedding model".
What should happen if a user wants to chat over multiple corpuses in a single chat?
Should a user be allowed to pass a list of corpus names when instantiating a Chat
class?
https://github.com/Quansight/ragna/blob/2066dcdeb949060873a8552449b848b245e0e985/ragna/core/_rag.py#L148-L156
Fixed in #490.
Initial discussion started in https://github.com/Quansight/ragna/pull/460#discussion_r1692061693. There we decided to just go with a
corpus_name: Optional[str]
as chat parameter. Same for LanceDB in #461.However, we likely and up needing a handle for this outside of a chat as well. Think listing the available corpora, or listing the available metadata of a corpus. And if the the
corpus_name
is a fixed parameter for these endpoints, we should do the same for the protocol methods as well.Thus, I propose we change the signatures from
to
def store(self, corpus_name: Optional[str], documents: list[Document])
def retrieve(self, corpus_name: Optional[str], metadata_filter: MetadataFilter, prompt: str)
Downside to this is that calling
SourceStorage.store
andSourceStorage.retrieve
manually will be more annoying, since thecorpus_name
no longer has a default. But we are not optimizing for this workflow so I'm ok with this compromise.