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

[ENH] Update JS client for auto ID generation when add #2757

Closed

Conversation

spikechroma
Copy link

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • ...
  • New functionality
    • ...

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

Copy link
Author

spikechroma commented Sep 2, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @spikechroma and the rest of your teammates on Graphite Graphite

Copy link

github-actions bot commented Sep 2, 2024

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link

github-actions bot commented Sep 2, 2024

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

@spikechroma spikechroma changed the title update js client to have ids optional [ENH] Update JS client for auto ID generation when add Sep 2, 2024
@spikechroma spikechroma marked this pull request as ready for review September 2, 2024 01:18
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 8999e52 to 0bd22d1 Compare September 3, 2024 00:14
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch 2 times, most recently from 8b6579a to e918efe Compare September 3, 2024 04:58
@spikechroma spikechroma force-pushed the 08-21-generate_ids branch 3 times, most recently from 5ee28b8 to 6a394a1 Compare September 10, 2024 01:26
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch 2 times, most recently from 223c5e3 to 3b7f57c Compare September 10, 2024 17:08
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 3b7f57c to 0e0243e Compare September 10, 2024 17:54
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 0e0243e to 9a606f2 Compare September 10, 2024 18:01
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 9a606f2 to b36d182 Compare September 10, 2024 18:26
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch 3 times, most recently from 7df8bc4 to 258bc1b Compare September 10, 2024 20:07
Copy link
Contributor

@codetheweb codetheweb left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +135 to +152
const recordSet = arrayifyParams(reqParams);
const { ids, embeddings, documents } = recordSet;

if (!ids) {
throw new Error("ids cannot be undefined");
}

validateIDs(ids);

if (documents) {
recordSet.embeddings = await computeEmbeddings(
embeddingFunction,
embeddings,
documents,
);
}

return recordSet as MultiRecordOperationParams;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const recordSet = arrayifyParams(reqParams);
const { ids, embeddings, documents } = recordSet;
if (!ids) {
throw new Error("ids cannot be undefined");
}
validateIDs(ids);
if (documents) {
recordSet.embeddings = await computeEmbeddings(
embeddingFunction,
embeddings,
documents,
);
}
return recordSet as MultiRecordOperationParams;
const recordSet: MultiRecordOperationParams = arrayifyParams(reqParams);
const { ids, embeddings, documents } = recordSet;
if (!ids) {
throw new Error("ids cannot be undefined");
}
validateIDs(ids);
if (documents) {
recordSet.embeddings = await computeEmbeddings(
embeddingFunction,
embeddings,
documents,
);
}
return recordSet;

Copy link
Author

Choose a reason for hiding this comment

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

arrayifyParams actually gives MultiRecordOperationParamsWithIDsOptional type instead of MultiRecordOperationParams

```
npm install
npm run build
```

### Publishing

First build the package then run `npm publish`
First build the package then run ```npm publish```
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be single backticks?

Copy link
Author

Choose a reason for hiding this comment

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

This is auto generated

@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch 9 times, most recently from 007039e to 1a72e6b Compare September 11, 2024 06:04
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 1a72e6b to 36b17a0 Compare September 11, 2024 06:12
@spikechroma spikechroma force-pushed the 08-21-generate_ids branch 2 times, most recently from 0991ccf to 6e1ff74 Compare September 11, 2024 23:52
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 36b17a0 to 87ba120 Compare September 11, 2024 23:52
@spikechroma spikechroma force-pushed the spike/generate_ids_js_client_update branch from 87ba120 to 499a81c Compare September 12, 2024 00:07
@atroyn atroyn force-pushed the 08-21-generate_ids branch 2 times, most recently from 7a9987e to b338b1e Compare September 13, 2024 23:29
@atroyn atroyn force-pushed the 08-21-generate_ids branch from 8473aa0 to d676e9b Compare October 2, 2024 22:04
@atroyn atroyn force-pushed the spike/generate_ids_js_client_update branch from 499a81c to a3dc87d Compare October 2, 2024 22:04
@atroyn atroyn force-pushed the 08-21-generate_ids branch from d676e9b to b726474 Compare October 2, 2024 22:45
@atroyn atroyn force-pushed the spike/generate_ids_js_client_update branch from a3dc87d to 77aeac9 Compare October 2, 2024 22:45
@atroyn atroyn closed this Oct 2, 2024
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.

3 participants