Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

EmbedData has the same class and instance attributes #137

Unanswered
pramodith asked this question in Q&A
EmbedData has the same class and instance attributes #137
Apr 14, 2025 * 3 comments
Return to top
Discussion options

pramodith
Apr 14, 2025

Describe the bug
The EmbedData class has the same class and instance attributes, its not clear to me if there's a reason behind this further more trying to create an instance of the class throws an error.

https://github.com/StarlightSearch/EmbedAnything/blob/edf3086852d6dd003fac56ff9de09adfde57af13/python/python/embed_anything/_embed_anything.pyi#L308C1-L324C1

To Reproduce

ed = EmbedData(embedding=[0.1, 2.4], text="hi", metadata={})

raises the error:

TypeError: No constructor defined for EmbedData

Expected behavior
An instance of EmbedData is created.
Screenshots

You must be logged in to vote

Replies: 3 comments

Comment options

akshayballal95
Apr 14, 2025
Maintainer

Well, there is no reason for the same class and instance attribute, but class instantiation will indeed not work from the python side as of now as there is no contractor that is defined in Rust for this python class.

This can be added but would this be necessary? Because the idea is to generate the embeddings using the dedicated embedding methods to get the output as EmbedData.

You must be logged in to vote
0 replies
Comment options

sonam-pankaj95
Apr 14, 2025
Maintainer

Hi @pramodith ,

there are dedicated functions to generate embeddings from sources in python, like embed_file, embed_query. Because all the methods to actually generate the embeddings are in rust, you can access them through these dedicated functions.

And the pyi file is a stub file, it's just for docs. It's just like an interface. Because we used pyo3 bindings.

You must be logged in to vote
0 replies
Comment options

pramodith
Apr 14, 2025
Author

Thanks for the context folks, closing the issue since you've clarified my confusion.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #133 on April 21, 2025 13:04.