[draft] Vector search#388
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Code Review
This pull request introduces AI embedding generation and caching capabilities. It adds a new EMBEDDING type to the GraphQL schema, implements a createEmbedding utility using Google Vertex AI with support for media chunking, and includes comprehensive tests. Feedback focuses on a breaking change in the createAIResponse utility that affects existing callers, the lack of handling for concurrent 'LOADING' states which could lead to redundant API calls, and opportunities to improve performance by parallelizing media chunk processing and reusing AI clients. Additionally, the AIEmbedding GraphQL type should include the text field to expose error messages.
| if ( | ||
| cached && | ||
| cached.status === 'SUCCESS' && | ||
| Array.isArray(cached.embeddings) && | ||
| cached.embeddings.length > 0 | ||
| ) { | ||
| return cached.embeddings as EmbeddingChunk[]; | ||
| } |
There was a problem hiding this comment.
The current logic only returns cached embeddings if the status is SUCCESS. If an embedding is currently being generated (status: 'LOADING'), this code will proceed to call createAIResponse, which likely creates a duplicate loading record and starts a redundant generation process. It should instead wait for the existing process to complete.
| fields: { | ||
| ...commonAiResponseFields, | ||
| }, |
There was a problem hiding this comment.
770f044 to
cbfc471
Compare
No description provided.