-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Search] [Playground]Improve follow up question flow #189848
Changes from all commits
72832c8
f0d3b87
16082d4
4ab7ae9
07a7860
6a35192
7f96976
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,13 @@ class ConversationalChainFn { | |
context: RunnableSequence.from([(input) => input.question, retrievalChain]), | ||
question: (input) => input.question, | ||
}, | ||
RunnableLambda.from((inputs) => { | ||
data.appendMessageAnnotation({ | ||
type: 'search_query', | ||
question: inputs.question, | ||
}); | ||
return inputs; | ||
}), | ||
RunnableLambda.from(clipContext(this.options?.rag?.inputTokensLimit, prompt, data)), | ||
RunnableLambda.from(registerContextTokenCounts(data)), | ||
prompt, | ||
|
@@ -236,6 +243,10 @@ class ConversationalChainFn { | |
type: 'prompt_token_count', | ||
count: getTokenEstimateFromMessages(msg), | ||
}); | ||
data.appendMessageAnnotation({ | ||
type: 'search_query', | ||
question, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a tweak - the question const here is always the last message submission which isn't the question used for the search. We use the LLM model to transform the question when theres more than 1 message. You want to modify the chain to capture the question. The runnable sequence runs each function in succession. For example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}); | ||
} | ||
}, | ||
// callback for prompt based models (Bedrock uses ActionsClientLlm) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you keep this space for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with adding a space at the end of sentence in 4ab7ae9. With this I think we can avoid adding extra space in next line but rather included as part of sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The challenge here is if the translation strings starts to remove the space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted to original in 6a35192