Unify scientific RAG sources with Semantic Scholar references#24
Open
shaiananvari8 wants to merge 1 commit into
Open
Unify scientific RAG sources with Semantic Scholar references#24shaiananvari8 wants to merge 1 commit into
shaiananvari8 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the open Algora bounty for
[ISAAC-497] Implement an enhanced RAG Pipeline for Scientific/Research Workflows./claim #45
Bounty reference: https://algora.io/isaac/bounties/clq18zr98000ejs0gt0nv7gwu
Summary
/api/inject-documentsingest optional Semantic Scholar reference JSON alongside uploaded PDFs, preserving paper IDs, authors, years, venues, DOI/URL data, page/chunk metadata, and stable citation keys.contextandsourcesfrom/api/fetch-documents, with bounded retrieval count, method/input validation, andCHROMA_PATHsupport.Why this helps ISAAC-497
The bounty calls out unifying uploaded documents with saved references from Semantic Scholar. The current main branch only stores uploaded PDF chunks and formats raw Chroma rows. This PR keeps the existing Chroma/LangChain architecture but gives the pipeline a mixed-source evidence contract so scientific answers can cite both user documents and reference metadata consistently.
Validation
From
ui/:npx vitest run __tests__/scientific-sources.test.ts --reporter verbose npx vitest run --reporter verbose npx tsc --noEmit --pretty false npm run lint -- --file pages/api/fetch-documents.ts --file pages/api/inject-documents.ts --file pages/api/rag-chat.ts --file utils/server/scientific-sources.ts --file __tests__/scientific-sources.test.ts npm run lint npm run buildResults: