-
Notifications
You must be signed in to change notification settings - Fork 754
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
feat(embeddings): Add text embedding feature #376
Conversation
Co-authored-by: Zecheng Zhang <zecheng@alumni.stanford.edu>
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.
Thanks for the great work~
Thanks! I am reviewing this PR. Please wait a bit. |
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.
Thanks @dandansamax. It looks great. Left a few comments.
camel/embeddings/base.py
Outdated
r"""Abstract base class for text embedding functionalities. """ | ||
|
||
@abstractmethod | ||
def embed_texts(self, texts: List[str]) -> List[List[float]]: |
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.
Some embedding models are for images. We may need to consider this. Should we call it embed_queries
?
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.
This base class is designed only for text embedding. For image embedding, we have two options: either create a separate base class specifically for image embedding or make the embed
function's parameter dynamic. This would allow the program to dynamically select the appropriate overridden function during runtime.
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.
Thanks for the fix! Left last comments
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.
Some last minor comments. Please feel free to merge it.
Co-authored-by: Guohao Li <lightaime@gmail.com>
Description
This PR add text embedding support, including a base embedding abstract class and OpenAI embedding APIs.
Motivation and Context
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
You can use the syntax
close #15213
if this solves the issue #15213Types of changes
What types of changes does your code introduce? Put an
x
in all the boxes that apply:Implemented Tasks
Checklist
Go over all the following points, and put an
x
in all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!