-
Notifications
You must be signed in to change notification settings - Fork 121
Add last message query generator #210
Add last message query generator #210
Conversation
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.
@izellevy see one comment
if len(messages) == 0: | ||
raise ValueError("Passed chat history does not contain any messages." | ||
" Please include at least one message in the history.") | ||
return [Query(text=messages[-1].content)] |
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.
Please take the last message which is a UserMessage
(message.role == 'Role.user'
or isinstance()
).
If you go backwards on the messages and can't find a UserMessage
- then raise an error
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.
This sounds a bit weird to me. It's more likely that if the last message is not user message, there is something wrong in the pipeline or usage of this class, so IMO it's better to raise an error here instead of silently do something that might not be expected by the user
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.
I see your point @igiloh-pinecone but agree with @acatav. Maybe I can raise if the history is empty or the last message is not a user message @igiloh-pinecone wdyt?
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.
LGTM
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.
LGTM
Since Anyscale don't support function calling for now
…e_query_generator
…n LLM Otherwise it will error out
Problem
Some LLMs do not support function calls. We need a basic query generator for this kind of APIs.
Solution
Add a super basic query generator that takes the last message and returns the message as is as a query.
Type of Change
Test Plan
Added necessary unit tests.