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

Feat(embeddings): Embeddable derive macro #59

Merged
merged 52 commits into from
Oct 18, 2024

Conversation

marieaurore123
Copy link
Contributor

@marieaurore123 marieaurore123 commented Oct 15, 2024

TODO: RENAME Embeddable trait to ToEmbedabble, ToEmbedTargets, Extract, ExtractEmbeddable, ...

This PR accomplishes:

  • Defines Embeddable trait which selects the portions of a struct that need ot be embedded. The embeddable() method returns a OneOrMany object which returns either one or many items to embed.
  • Write custom macro that derives the Embeddable trait for any user-defined object

@marieaurore123 marieaurore123 changed the title Feat(embeddings)/derive macro Feat(embeddings): Embeddable derive macro Oct 15, 2024
@cvauclair
Copy link
Contributor

cvauclair commented Oct 16, 2024

@garance-buricatu can you split the PR into two: 1) a PR that removes DocumentEmbeddings, adds the Embeddable trait.. anything not related to the macro; and 2) a PR specifically for the derive macro implementation?

That would make it much easier to review. Thank you!

pub fn rest(&self) -> Vec<T> {
self.rest.clone()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I created the methods one and many to create objects of type OneOrMany instead of doing
impl From<T> for OneOrMany<T> and impl From<Vec<T>> for OneOrMany<T> because these are conflicting. See my comment below for why I would use impl From<Vec<T>> for OneOrMany<T> instead of impl TryFrom<Vec<T>> for OneOrMany<T>.

Copy link
Contributor

@cvauclair cvauclair left a comment

Choose a reason for hiding this comment

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

Not done reviewing, but there's a lot of stuff to change so here is the first part

rig-core/Cargo.toml Outdated Show resolved Hide resolved
rig-core/src/embeddings/mod.rs Outdated Show resolved Hide resolved
rig-core/examples/rag_dynamic_tools.rs Outdated Show resolved Hide resolved
rig-core/examples/rag.rs Outdated Show resolved Hide resolved
rig-core/examples/calculator_chatbot.rs Outdated Show resolved Hide resolved
rig-core/src/embeddings/embeddable.rs Outdated Show resolved Hide resolved
rig-core/src/embeddings/embeddable.rs Show resolved Hide resolved
rig-core/src/embeddings/embeddable.rs Outdated Show resolved Hide resolved
rig-core/src/embeddings/embeddable.rs Outdated Show resolved Hide resolved
rig-core/src/embeddings/embeddable.rs Outdated Show resolved Hide resolved
rig-core/tests/embeddable_macro.rs Show resolved Hide resolved
rig-core/rig-core-derive/src/basic.rs Outdated Show resolved Hide resolved
rig-core/rig-core-derive/src/basic.rs Outdated Show resolved Hide resolved
rig-core/rig-core-derive/src/custom.rs Outdated Show resolved Hide resolved
rig-core/rig-core-derive/src/custom.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@cvauclair cvauclair left a comment

Choose a reason for hiding this comment

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

Excellent! Just a tiny change to the OneOrMany error definition and then you can merge :)

rig-core/src/one_or_many.rs Outdated Show resolved Hide resolved
@marieaurore123 marieaurore123 merged commit 4039cf6 into feat/embeddings-overhaul Oct 18, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants