Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] Conversational Retrieval QA Chain behaves different on flowise and embed website

Open emrahtoy opened this issue 1 year ago • 8 comments

Describe the bug The chain behaves and replies differently on both sides.

To Reproduce Create Conversational Retrieval QA Chain chat flow based on the template or created yourself. I used a text file document with an in-memory vector store.

  1. Limit your prompt within the border of the document or use the default prompt which works same way. I also added my own prompt.
  2. Test your chat flow on Flowise editor chat panel.
  3. Say "Merhaba" or "Hello" ( merhaba means hello in turkish language )
  4. Do the same thing on your website with an embedded Flowise chat panel.
  5. Also forgets the language I limited. ( you can use the document and prompt I added below )

Expected behavior Both should give the same answers regarding to the document given Flowise editor chat panel works as expected and relies on variables i set on chat model. The embedded website panel does not care about the content of the document and gives answers unrelated to the prompt and doesn't care about variables I set on the chat model. Also forgets about prompted language even though I strictly limit it.

Screenshots Ekran görüntüsü 2023-06-14 224100 Ekran görüntüsü 2023-06-14 224123

Document ( 1500 chunk default variables on character text splitter ) YTU Startup House.txt

Prompt I want you to act as an officer working at Yıldız Technical University. Your name is Ahmet. Stay within the boundaries of the document. Reply, answer, write, and talk in Turkish only. When something irrelevant is asked or said reply "Size Yıldız Teknik Üniversitesi Startup House hakkında yardımcı olmak için buradayım." shortly in Turkish and then redirect people to the boundaries of the document politely. Be helpful and do not give long answers. Never break character.

emrahtoy avatar Jun 14 '23 19:06 emrahtoy

Logs are giving kind of a hint about behavioral difference.

embed.log flowsiePanel.log

emrahtoy avatar Jun 14 '23 20:06 emrahtoy

@HenryHengZJ how can I debug components?

emrahtoy avatar Jun 18 '23 07:06 emrahtoy

Logs show that the Embed version is jumping the "[1:chain:ConversationalRetrievalQAChain > 2:chain:StuffDocumentsChain]" step.

To me, it should have got both the text ( in base64 format ) and the chain data from chat flow data requested from the database.

emrahtoy avatar Jun 18 '23 12:06 emrahtoy

@HenryHengZJ how can I debug components?

you can put console log in the component file

I tried it there it seems to behave same for me: Flowise Chat: image

Embedded Chat: image

HenryHengZJ avatar Jun 19 '23 19:06 HenryHengZJ

So strange, I tried again and have had different results. I will clean everything and try again.

emrahtoy avatar Jun 20 '23 08:06 emrahtoy

@HenryHengZJ it is still happening. Plus son that there are new bugs... embed gets 401 unauthorized error at first but then receives stream ( probably over websocket ) and API requests causes another error ( when you have a brand new flow and trigger it over API at the first time )

I still see the difference I mentioned before in the logs. I am trying really hard to use flowise with our products but keep facing with the new bugs. I would like to contribute more but I am seriously in need of help to learn how to debug this project end to end ( by debug I don't mean console.log.. I mean debug points where I can see call stack, etc.. )

emrahtoy avatar Jun 20 '23 09:06 emrahtoy

@emrahtoy do you have some projects in mind that have good debug points where we can take reference from?

when error happens, logs like this should be able to tell you where the error is from: image

HenryHengZJ avatar Jun 21 '23 18:06 HenryHengZJ

Any kind of log only gives information about the error and maybe call-stack at limited deep. On the other hand, debugging with a debug point gives you the state of the app and information on the variables inside the current context.

For example, you have no idea what was the json string giving the error above. If you could set a debug point on line 43 of the PromptTemplate.js file then you could see the JSON string because the application flow would stop at that point right before the error happens. Most probably you are not going to able to do that because of the structure of the mono repo and how modules connected to each other in development mode.

You are using distribution packages of flowise-ui and flowise-components in the server module, this is where the "yarn link" comes in handy as it will make it to use the real dist folder inside the workspace. Yet still not enough. At this point, source maps may help as stated here but I couldn't spare enough time to test.

emrahtoy avatar Jun 22 '23 08:06 emrahtoy

Henry and emrahtoy, hope all is well. guys just checking into see if this issue embed issue is resolved? for it doesn't still work. thanks

mibtim avatar Jul 07 '23 05:07 mibtim

@mibtim i believe it is not resolved. I figure out how to debug chains and I will check again today

emrahtoy avatar Jul 07 '23 08:07 emrahtoy

thank you heaps mate, please keep me updated thanks heaps

mibtim avatar Jul 10 '23 07:07 mibtim

@emrahtoy @mibtim see update here - https://github.com/FlowiseAI/Flowise/issues/473

HenryHengZJ avatar Jul 10 '23 16:07 HenryHengZJ

@HenryHengZJ , mate thank heaps and i will have a look. also wanted give you a massive shout out for the amazing work you guys do and for the awesome product. tc

mibtim avatar Jul 11 '23 15:07 mibtim

Hi @emrahtoy @mibtim, once you guys verified that it's working on your side.

kindly help us close the issue. Much appreciated.

chungyau97 avatar Jul 12 '23 09:07 chungyau97

@HenryHengZJ @chungyau97 thank you heaps i think i have to wait for the next release as im using docker/npm. good to hear this is now resolved and thank you heaps for the awesome work you all do.

mibtim avatar Jul 12 '23 13:07 mibtim

@chungyau97 i will do a check tonight and share the result.

emrahtoy avatar Jul 12 '23 14:07 emrahtoy

@HenryHengZJ @chungyau97 It seems like solved. Both Flowise and embed bubble chat are giving the same answers and the logs are identical. Thank you for your efforts, I gladly close this issue 👍

emrahtoy avatar Jul 14 '23 12:07 emrahtoy