-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MetadataFilter in LanceDB #461
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blakerosenthal Tests and lint / format CI is failing. I'll review the test when everything is green otherwise.
@pmeier Thanks for all the comments. Ran into a couple quirks with LanceDB's |
Yes. If you have code like this from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ragna import Rag
def foo() -> Rag:
from ragna import Rag
return Rag() it looks like this should work. Running
The reason is that Python evaluates the annotations at definition. For example from ragna import Rag
def foo() -> Rag:
return Rag()
print(foo.__annotations__)
And since at definition in the top script, the That being said, there is an easy solution for it: turn the annotation into a string. from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ragna import Rag
def foo() -> "Rag":
from ragna import Rag
return Rag()
print(foo.__annotations__)
Now ragna/ragna/core/_components.py Lines 73 to 75 in 2066dcd
Finally, because it is a little tedious to always stringify the annotations, there is a shortcut. If you from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ragna import Rag
def foo() -> Rag:
from ragna import Rag
return Rag()
print(foo.__annotations__) And this is what I did in 4a3b32e. |
@blakerosenthal I've added the following changes in be943a7:
I'm merging this for velocity, but please do take a look if anything is unclear or a follow-up PR is needed. |
Add metadata filter to lancedb storage