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

fix(ai-help): destructure embedding response properly #9977

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Nov 8, 2023

Summary

Problem

The "Update AI Help index" step of our deployment has been failing.

Solution

Properly destructure the CreateEmbeddingResponse.


Screenshots

Before

 $ ts-node scripts/ai-help.ts update-index
Retrieving all indexed documents...
-> Done.
Determining changed and deleted documents...
-> 1656 of 11955 documents were changed (or added).
-> 26 of 11886 indexed documents were deleted (or moved).
Applying updates...
-> [/en-US/docs/Games] Updating document...
!> [/en-US/docs/Games] Failed to update document. Document has been marked with null checksum to indicate that it needs to be re-generated.
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at createEmbedding (file:///Users/claas/github/mdn/yari/scripts/ai-help.ts:86:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async updateEmbeddings (file:///Users/claas/github/mdn/yari/scripts/ai-help.ts:165:45)
    at async Se.run (/Users/claas/github/mdn/yari/node_modules/@caporal/core/dist/index.js:1:27579)
    at async Te._run (/Users/claas/github/mdn/yari/node_modules/@caporal/core/dist/index.js:1:32257)
-> [/en-US/docs/Learn] Updating document...
!> [/en-US/docs/Learn] Failed to update document. Document has been marked with null checksum to indicate that it needs to be re-generated.
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at createEmbedding (file:///Users/claas/github/mdn/yari/scripts/ai-help.ts:86:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async updateEmbeddings (file:///Users/claas/github/mdn/yari/scripts/ai-help.ts:165:45)
    at async Se.run (/Users/claas/github/mdn/yari/node_modules/@caporal/core/dist/index.js:1:27579)
    at async Te._run (/Users/claas/github/mdn/yari/node_modules/@caporal/core/dist/index.js:1:32257)

After

$ ts-node scripts/ai-help.ts update-index
Retrieving all indexed documents...
-> Done.
Determining changed and deleted documents...
-> 1656 of 11955 documents were changed (or added).
-> 26 of 11886 indexed documents were deleted (or moved).
Applying updates...
-> [/en-US/docs/Games] Updating document...
-> [/en-US/docs/Games] Indexing 4 document sections...
-> [/en-US/docs/Learn] Updating document...
-> [/en-US/docs/Learn] Indexing 6 document sections...

How did you test this change?

Ran yarn ai-help update-index locally with our Supabase Dev project, see above.

@caugner caugner requested a review from a team as a code owner November 8, 2023 16:11
Copy link
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@caugner caugner enabled auto-merge (squash) November 8, 2023 16:13
@caugner caugner merged commit a80a0d6 into main Nov 8, 2023
12 checks passed
@caugner caugner deleted the fix-ai-help-index branch November 8, 2023 16:16
gurezo pushed a commit to gurezo/yari that referenced this pull request Nov 11, 2023
Resolves a `TypeError: undefined is not iterable`.
gurezo pushed a commit to gurezo/yari that referenced this pull request Nov 11, 2023
Resolves a `TypeError: undefined is not iterable`.
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