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

source nodes are added to every chunk of stream response #732

Open
shiyuangu opened this issue Apr 18, 2024 · 3 comments
Open

source nodes are added to every chunk of stream response #732

shiyuangu opened this issue Apr 18, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@shiyuangu
Copy link

Hi all, I want to retrieve the source nodes from a stream response of ContextChatEngine.chat. When I look at the code, I observe that each chunk of the stream response has the source nodes attached to it in a duplicate manner. Is it a bug or a feature intentionally designed? What's the recommended way to extract the source codes from a streaming response? Thank you!

(r: ChatResponseChunk) => new Response(r.delta, requestMessages.nodes),

@johannesstricker
Copy link

The way I've done it now is to only extract the source nodes when processing the first chunk of the stream 🤷

@himself65 himself65 added the bug Something isn't working label Apr 19, 2024
@himself65
Copy link
Member

Thanks for the feedback. This might be a bug, I'm working on to support getting all context during the Iterator

@marcusschiesser
Copy link
Collaborator

@shiyuangu this is how create-llama is currently handling the source nodes inside of a stream: https://github.com/run-llama/create-llama/blob/1ad25451a69e10183200dfaf4c7a8d6c8f800543/templates/types/streaming/nextjs/app/api/chat/llamaindex-stream.ts#L42

@himself65 so your idea is to remove the source nodes out of the stream and instead move them to some response context that can be read while streaming and that can contain more information? Sounds great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants