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: return actual source nodes with compact and refine response synt… #1554

Merged

Conversation

GunnarHolwerda
Copy link
Contributor

Description of Changes

Updates the Refine responseSynthesizer to return the sourceNodes in the response as the original nodes that were provided to the synthesizer. This persists the behavior of it prior to 0.5.20 and the other synthesizers where EngineResponse.sourceNodes is set to the value of the original source nodes that were provided. With the prior implementation it was returning the packed text chunks which would lose context of the document information.

Fixes: #1552

Copy link

changeset-bot bot commented Dec 7, 2024

🦋 Changeset detected

Latest commit: 0b89cae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@llamaindex/core Patch
@llamaindex/unit-test Patch
@llamaindex/doc Patch
@llamaindex/cloud Patch
@llamaindex/community Patch
llamaindex Patch
@llamaindex/node-parser Patch
@llamaindex/readers Patch
@llamaindex/anthropic Patch
@llamaindex/clip Patch
@llamaindex/deepinfra Patch
@llamaindex/huggingface Patch
@llamaindex/ollama Patch
@llamaindex/openai Patch
@llamaindex/portkey-ai Patch
@llamaindex/replicate Patch
@llamaindex/vercel Patch
@llamaindex/llama-parse-browser-test Patch
docs Patch
@llamaindex/cloudflare-worker-agent-test Patch
@llamaindex/next-agent-test Patch
@llamaindex/nextjs-edge-runtime-test Patch
@llamaindex/next-node-runtime-test Patch
@llamaindex/waku-query-engine-test Patch
@llamaindex/autotool Patch
@llamaindex/experimental Patch
@llamaindex/autotool-01-node-example Patch
@llamaindex/autotool-02-next-example Patch
@llamaindex/groq Patch
@llamaindex/vllm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
legacy-llama-index-ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 10:30pm
llamaindex-ts-doc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 10:30pm

Copy link

vercel bot commented Dec 7, 2024

@GunnarHolwerda is attempting to deploy a commit to the LlamaIndex Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +80 to +89
async getResponse(
query: MessageContent,
nodes: NodeWithScore[],
stream: true,
): Promise<AsyncIterable<EngineResponse>>;
async getResponse(
query: MessageContent,
nodes: NodeWithScore[],
stream: false,
): Promise<EngineResponse>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added these signatures so that I didn't have to do more type jumbling after grabbing the original response and transforming it. If this is not accurate please let me know, but based on my knowledge if stream = true it will always be an AsyncIterable.

@GunnarHolwerda GunnarHolwerda force-pushed the fix_compact_refine_source_nodes branch from bdd6e90 to cfed16d Compare December 7, 2024 18:26
…hesizer

Before we were only returning the packed text chunks in
EngineResponse.sourceNodes for this response synthesizer. This is
different than how every other synthesizer works.
@GunnarHolwerda GunnarHolwerda force-pushed the fix_compact_refine_source_nodes branch from cfed16d to 57eb4e7 Compare December 7, 2024 18:27
Copy link

pkg-pr-new bot commented Dec 7, 2024

Open in Stackblitz

@llamaindex/autotool

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/autotool@1554

@llamaindex/cloud

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/cloud@1554

@llamaindex/community

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/community@1554

@llamaindex/core

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/core@1554

@llamaindex/experimental

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/experimental@1554

@llamaindex/env

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/env@1554

llamaindex

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/llamaindex@1554

@llamaindex/node-parser

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/node-parser@1554

@llamaindex/readers

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/readers@1554

@llamaindex/wasm-tools

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/wasm-tools@1554

@llamaindex/workflow

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/workflow@1554

@llamaindex/anthropic

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/anthropic@1554

@llamaindex/deepinfra

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/deepinfra@1554

@llamaindex/clip

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/clip@1554

@llamaindex/groq

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/groq@1554

@llamaindex/huggingface

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/huggingface@1554

@llamaindex/ollama

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/ollama@1554

@llamaindex/openai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/openai@1554

@llamaindex/portkey-ai

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/portkey-ai@1554

@llamaindex/vercel

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/vercel@1554

@llamaindex/replicate

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/replicate@1554

@llamaindex/vllm

npm i https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/vllm@1554

commit: 0b89cae

@himself65 himself65 merged commit e0f6cc3 into run-llama:main Dec 9, 2024
22 checks passed
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.

Compact Response Synthesizer does not return source nodes
2 participants