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] reset back to previous JS api, keeping other improvements #2714

Merged
merged 10 commits into from
Sep 9, 2024

Conversation

jeffchuber
Copy link
Contributor

@jeffchuber jeffchuber commented Aug 23, 2024

Description of changes

Upon further discussion - we decided we preferred the object-oriented JS API given our design constraints.

This PR reverts the api to the previous design while keeping the other improvements introduced in #2542

Test plan

Existing JS client test coverage

Documentation Changes

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

Yes

Copy link

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)

@@ -46,7 +47,7 @@ export class ChromaClient {
/**
* @ignore
*/
private api: DefaultApi & ConfigOptions;
public api: DefaultApi & ConfigOptions;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has to be public for the Collection object to use it.

we could pass the api object to Collection - but i like the idea that if you change some client settings, that all Collection objects created through that client will start using these settings.

Copy link
Contributor

Choose a reason for hiding this comment

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

I worry a little that this could confuse users who see this pop up in their autocomplete, but I don't think there's a great solution besides making a third wrapper class over api. Not a blocking issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea - there is a way to pseudo-hide it using some typescript f****ery - but I think that is worse and less maintainable. what about renaming it to something like _InternalApi?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah underscoring seems like a good option for now

@@ -102,7 +103,7 @@ export class ChromaClient {
}

/** @ignore */
private init(): Promise<void> {
init(): Promise<void> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this also can no longer be private.

@jeffchuber
Copy link
Contributor Author

jeffchuber commented Aug 23, 2024

@codetheweb my todos (not blocking your review)

  • ensure docs generation from the code works and looks good
  • figure out why that linter didnt pass and caused a failed test

@@ -46,7 +47,7 @@ export class ChromaClient {
/**
* @ignore
*/
private api: DefaultApi & ConfigOptions;
public api: DefaultApi & ConfigOptions;
Copy link
Contributor

Choose a reason for hiding this comment

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

I worry a little that this could confuse users who see this pop up in their autocomplete, but I don't think there's a great solution besides making a third wrapper class over api. Not a blocking issue.

Copy link

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

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

@jeffchuber jeffchuber merged commit 7be79ec into main Sep 9, 2024
135 checks passed
@jeffchuber jeffchuber deleted the jeff/js-client-refactor branch September 9, 2024 21:25
spikechroma pushed a commit that referenced this pull request Sep 12, 2024
## Description of changes

Upon further discussion - we decided we preferred the object-oriented JS
API given our design constraints.

This PR reverts the api to the previous design while keeping the other
improvements introduced in
#2542

## Test plan
Existing JS client test coverage

## Documentation Changes
*Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the [docs
repository](https://github.com/chroma-core/docs)?*

Yes
spikechroma pushed a commit that referenced this pull request Sep 12, 2024
Upon further discussion - we decided we preferred the object-oriented JS
API given our design constraints.

This PR reverts the api to the previous design while keeping the other
improvements introduced in
#2542

Existing JS client test coverage

*Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the [docs
repository](https://github.com/chroma-core/docs)?*

Yes
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