aurelio-labs / semantic-router

Superfast AI decision making and intelligent processing of multi-modal data.
https://www.aurelio.ai/semantic-router
MIT License
2.1k stars 216 forks source link

How to include conversation history? #302

Open vdemchenko3 opened 5 months ago

vdemchenko3 commented 5 months ago

Hello!

I'm wondering how to include conversation history into a RouteLayer prediction?

Ideally I'd like to do something like:

rl = RouteLayer(encoder=encoder, routes=routes) route_with_chat_history = rl(user_message, chat_history)

Is this possible?

I see there are two notebooks that attempt this 04-chat-history.ipynb and conversation-topic-splitter.ipynb using the Messages and Conversation classes, but I'm not sure how then to use those messages/conversation in a route selection.

bendykoh commented 4 months ago

Hi @vdemchenko3 did you have any update after this? I am also interested in routing multiple subjects based on a whole chat history

vdemchenko3 commented 4 months ago

No I don't have any updates unfortunately. The best I could find was to use an encoder that is able to handle context to some degree such as the E5 Mistral one.

bendykoh commented 4 months ago

I see, thanks for replying!, looks like I would have to do loops in my conversation turns in order to do some semantic routing for now

sant-sh commented 1 week ago

Do anyone have any solution for feeding the previous chat to the router again?

example: First Question - What time is in New York now? Follow up question - What about Texas?

bendykoh commented 1 week ago

Do anyone have any solution for feeding the previous chat to the router again?

example: First Question - What time is in New York now? Follow up question - What about Texas?

Unfortunately I don't have a solution for you because my eventual solution was to read my conversation line by line

sant-sh commented 1 week ago

thank you @bendykoh

right, even i am thinking to read all the previous conversation line by line and then handle it via router itself.

bendykoh commented 1 week ago

Would be good if there is possibility of that having chat history though :)