Skip to content
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

Unable to declare a Vector-Field for a JsonModel #656

Open
MarkusPorti opened this issue Sep 17, 2024 · 2 comments
Open

Unable to declare a Vector-Field for a JsonModel #656

MarkusPorti opened this issue Sep 17, 2024 · 2 comments

Comments

@MarkusPorti
Copy link

The Bug

I'm trying to declare a Field as a Vector-Field by setting the vector_options on the Field.
Pydantic is then forcing me to annotate the field with a proper type.
But with any possible type for a vector, I always get errors.

The one that I think should definitly work is list[float], but this results in
AttributeError: type object 'float' has no attribute '__origin__'.

Example

class Group(JsonModel):
    articles: List[Article]
    tender_text: str = Field(index=False)
    tender_embedding: list[float] = Field(
        index=True,
        vector_options=VectorFieldOptions(
            algorithm=VectorFieldOptions.ALGORITHM.FLAT,
            type=VectorFieldOptions.TYPE.FLOAT32,
            dimension=3,
            distance_metric=VectorFieldOptions.DISTANCE_METRIC.COSINE
        ))

No Documentation for Vector-Fields?

There seems to be no documentation about this feature.
I just found a merge-request which describes some features a bit, but there is no example, test or any documentation about this.

@sethbuff
Copy link

sethbuff commented Oct 5, 2024

I'm running into the same thing. It looks like they want you to type it as tender_embedding: list[list[float]] but even with that, I'm having issues getting any reasonable results when searching.

@sethbuff
Copy link

sethbuff commented Oct 5, 2024

@Pwuts or @chayim could one of you provide a working example of how to use the vector field? Or potentially just some tests that can be referenced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants