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

fix: correct issue with handling float32 #4312

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

irshadmb
Copy link
Contributor

Error building Component Pinecone: Invalid type for variable '0'. Required value type is float and passed type was float64 at ['values'][0]

Fixed the issue by forcing float32

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 29, 2024
@irshadmb irshadmb changed the title Error Pinecone #4281 fix: correct issue with handling float32 Oct 29, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Oct 29, 2024
@ogabrielluiz
Copy link
Contributor

Hey @irshadmb

Could you update your code to create the class outside the Component, please? This is supported after #4316

@irshadmb
Copy link
Contributor Author

@ogabrielluiz sure, will go through reference code and will do the changes

@irshadmb irshadmb marked this pull request as draft October 30, 2024 07:48
@irshadmb irshadmb marked this pull request as ready for review October 30, 2024 07:48
@irshadmb irshadmb marked this pull request as draft October 30, 2024 07:49
@irshadmb irshadmb marked this pull request as ready for review October 30, 2024 07:53
@irshadmb
Copy link
Contributor Author

@ogabrielluiz updated and merged the code. Can you please review

@irshadmb irshadmb mentioned this pull request Oct 30, 2024
@irshadmb irshadmb marked this pull request as draft October 31, 2024 06:19
@irshadmb irshadmb marked this pull request as ready for review October 31, 2024 06:19
Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now. Could you test it to make sure the changes are valid?

@ogabrielluiz ogabrielluiz linked an issue Nov 5, 2024 that may be closed by this pull request
Copy link
Contributor Author

@irshadmb irshadmb Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogabrielluiz - Its giving following error:

Error building Component: Float32Embeddings.init() got an unexpected keyword argument '_code'
Traceback (most recent call last):
File "/mnt/d/github/langflow/src/backend/base/langflow/custom/utils.py", line 395, in build_custom_component_template
has_template_config = hasattr(custom_component, "template_config")
File "/mnt/d/github/langflow/src/backend/base/langflow/custom/custom_component/custom_component.py", line 408, in template_config
self._template_config = self.build_template_config()
File "/mnt/d/github/langflow/src/backend/base/langflow/custom/custom_component/base_component.py", line 97, in build_template_config
component_instance = cc_class(_code=self._code)
TypeError: Float32Embeddings.init() got an unexpected keyword argument '_code'

I will refactor it, after that it is working. Please do a review and mark as reviewed. As, code is tested.

@irshadmb
Copy link
Contributor Author

irshadmb commented Nov 6, 2024

@ogabrielluiz - I have made some re-arranging of code. Then it has started working. I have done the commit. Also code is tested now:

image

irshadmb and others added 4 commits November 6, 2024 08:22
Error building Component Pinecone: Invalid type for variable '0'. Required value type is float and passed type was float64 at ['values'][0]

Fixed the issue by forcing float32
Linit Recommendation Handled
ogabrielluiz and others added 3 commits November 6, 2024 08:22
Streamline the Float32Embeddings class by removing unnecessary parent linkage and consolidating the embedding logic, ensuring consistent float32 output for embeddings.
Co-Authored-By: Gabriel Luiz Freitas Almeida <[email protected]>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 6, 2024
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) November 6, 2024 11:23
@ogabrielluiz ogabrielluiz merged commit ed69253 into langflow-ai:main Nov 6, 2024
28 of 36 checks passed
joaoguilhermeS pushed a commit that referenced this pull request Nov 7, 2024
* Update pinecone.py

Error building Component Pinecone: Invalid type for variable '0'. Required value type is float and passed type was float64 at ['values'][0]

Fixed the issue by forcing float32

* [autofix.ci] apply automated fixes

* Linit Recommendation Handled

Linit Recommendation Handled

* [autofix.ci] apply automated fixes

* refactor: Simplify Float32Embeddings implementation

Streamline the Float32Embeddings class by removing unnecessary parent linkage and consolidating the embedding logic, ensuring consistent float32 output for embeddings.

* refactor: Re-arranging the code.

Co-Authored-By: Gabriel Luiz Freitas Almeida <[email protected]>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Pinecone
2 participants