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

cohere[patch]: update embeddings and rerank #5928

Conversation

Anirudh31415926535
Copy link
Contributor

This PR makes the model parameter mandatory for CohereEmbeddings class and the CohereRerank class.
Along with that, adds a embed method for the CohereEmbeddings class, and some minor improvements and docs updates.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 28, 2024
Copy link

vercel bot commented Jun 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2024 7:08pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Jul 9, 2024 7:08pm

@dosubot dosubot bot added the auto:improvement Medium size change to existing code to handle new use-cases label Jun 28, 2024
@@ -27,7 +27,7 @@ const docs = [

Copy link

Choose a reason for hiding this comment

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

Hey team, I've flagged a change in the cohereRerank instantiation that accesses an environment variable via process.env. Please review this change to ensure it aligns with our environment variable handling practices.

@@ -28,7 +28,7 @@ const docs = [
const cohereRerank = new CohereRerank({
Copy link

Choose a reason for hiding this comment

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

Hey team, just a heads up that I've flagged a change in the cohereRerank instantiation that sets the apiKey property using an environment variable. This is for your review to ensure it aligns with our best practices for handling environment variables.

@@ -20,6 +20,7 @@ const documents = [
test("CohereRerank can indeed rerank documents with compressDocuments method", async () => {
Copy link

Choose a reason for hiding this comment

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

Hey there! I've reviewed the code and noticed that the addition in this PR references an environment variable via process.env. I've flagged this for your review to ensure it aligns with the project's requirements. Let me know if you have any questions!

@@ -70,8 +75,16 @@ export class CohereEmbeddings
token: apiKey,
});
this.model = fieldsWithDefaults?.model ?? this.model;

if (!this.model) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would prefer to just make this a required param and ship a new minor version release along with your tool calling stuff

this.batchSize = fieldsWithDefaults?.batchSize ?? this.batchSize;
this.inputType = fieldsWithDefaults?.inputType;
this.embeddingTypes =
fieldsWithDefaults?.embeddingTypes ?? this.embeddingTypes;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to remove inputType from CohereEmbeddingsParams as well?

@jacoblee93
Copy link
Collaborator

Thanks, see comments!

Let's gear up for a minor version release along with your other PR.

@jacoblee93 jacoblee93 added the in progress PRs that are in progress but not ready to merge label Jul 2, 2024
@jacoblee93 jacoblee93 changed the title feat: update embeddings and rerank cohere[patch]: update embeddings and rerank Jul 9, 2024
@jacoblee93 jacoblee93 added lgtm PRs that are ready to be merged as-is and removed in progress PRs that are in progress but not ready to merge labels Jul 9, 2024
@jacoblee93 jacoblee93 merged commit c2d3472 into langchain-ai:main Jul 9, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases lgtm PRs that are ready to be merged as-is size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants