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

Refactor OpenAIEmbeddings #14334

Merged

Conversation

mehmetbutgul
Copy link
Contributor

Refactor OpenAIEmbeddings annotator

Description

Refactor OpenAIEmbeddings
1- Supported escape chars that break the Open AI json content.
2- Changed the output annotator type. DOCUMENT --> SENTENCE_EMBEDDINGS
NOTE: This approach is the reverse of the backward compatibility
3- Added metadata which comes from the document column to output embeddings
4- Added Python unit test class
5- Added a new submodule to support saving/loading the annotator
NOTE: The new submodule will fix saving/loading the annotator

Motivation and Context

How Has This Been Tested?

Tested via Python and Scala locally.
Additionally, I added new unit tests that cover my changes.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Code improvements with no or little impact
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING page.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

DevinTDHa and others added 4 commits May 24, 2024 10:26
* SPARKNLP-1036: Fix dev python kernel names

* SPARKNLP-1036: Bump transformers version

* SPARKNLP-1036: Fix Colab buttons

* SPARKNLP-1036: Pin onnx version for compatibility

* SPARKNLP-1036: Upgrade Spark version

* SPARKNLP-1036: Minor Fixes

* SPARKNLP-1036: Clean Metadata

* SPARKNLP-1036: Add/Adjust Documentation

- Note for supported Spark Version of Annotators
- added missing Documentation for BGEEmbeddings
@mehmetbutgul
Copy link
Contributor Author

I created my branch from the master, So, There are some other commits, too.

from pyspark.sql import DataFrame
from pyspark.sql import SparkSession

class OpenAIEmbeddingsTestCase(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add @pytest.mark.slow annotation on top of class definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @danilojsl,
I have added the @pytest.mark.slow annotation with my new commit and updated the documentation.
e4a7c1a

@maziyarpanahi maziyarpanahi merged commit 09dc500 into release/540-release-candidate Jun 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants