BoxcarsAI / boxcars

Building applications with composability using Boxcars with LLM's. Inspired by LangChain.
MIT License
430 stars 39 forks source link

Anyway to create conversation? #73

Closed eltoob closed 1 year ago

eltoob commented 1 year ago

Hi, I am trying to figure out a good way to create a conversation. Can I do boxcar.conduct("Give me a list of my last 10 customers") -> Spits out a sql response

And then add to the conversation, remove the users with a @gmail.com email address.

francis commented 1 year ago

Not quite yet (see lower for a possible approach that might work), but this is what we are working towards.

Currently, if you are using a ConversationPrompt, the conversations get added to as the question is processed, but not kept when an answer is returned. As one option, I was considering just letting the conversation evolve when you continue to use a boxcar. However, a downside to this approach is that it will chew threw more tokens as the conversation gets longer.

The second idea is to remember the last result and pass that in as context for the next question. This might be easier to implement. To generalize this, it could be a memory concept that can be modified as needed.

To simulate what you want in the current version, try something like the following: custs = boxcar.conduct("Give me a list of my last 10 customers").to_answer to_delete = boxcars.conduct("Filter this list of customers with gmail.com email address: #{custs.to_json}).to_answer boxcars.conduct("remove these customers: #{to_delete.to_json}) ...

eltoob commented 1 year ago

Yes, I think a cool option moving forward would be to allow to pass a flag when calling a boxcar to save context. Or also would be interesting to add a buffer as langchain does https://python.langchain.com/en/latest/modules/memory/types/buffer.html

francis commented 1 year ago

👍