-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
DOC-4199: add TCEs to the combined query page #2838
DOC-4199: add TCEs to the combined query page #2838
Conversation
doctests/query-combined.js
Outdated
normalize: true, | ||
}); | ||
|
||
const embedding = Object.values(vectorOutput?.data); |
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.
will throw an error if vectorOutput
is undefined
(which seems to be an option since you are using .?
)
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.
I don't understand the change you want me to make here.
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.
I never used the @xenova/transformers package, but because you've used the .?
I guess the function returns undefined
in some cases (?)
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.
I dunno. I stole that code from another set of examples.
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.
I think @leibale point is that the pipeline can seemingly return an undefined and then you would be passing an undefined into Object.values(), which will result in an exception.
Now, if this were just to be a test, that probably wouldn't be a huge problem (as the exception would fail the test), but if this is also suppoesd to be documentation on how to use it, perhaps a check for it being undefined with a throw error if it is, would help (and then wouldn't need the ?, as the if undefined check would restrict it away).
just a thought, could be wrong :)
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.
I added a test around vectorOutput and removed the '?' from the assignment as suggested.
…es-for-combined-query-page
…es-for-combined-query-page
pacakges.json doesn't seem to include xenova/transformers. |
Description
Tabbed code examples (TCEs) for the combined query page. Please merge as soon as possible.
Checklist
npm test
pass with this change (including linting)?