quivr icon indicating copy to clipboard operation
quivr copied to clipboard

[Prompt Customization] AAUser, I can set my brain's prompt

Open gozineb opened this issue 1 year ago • 6 comments

The user with Edit rights on the brain can edit the prompt.

Have a base level prompt ; 'This is the user's prompt, take that into consideration' Inject the input user's prompt.

Next:

Have two types of prompts: 'QuestionPromopt' -> How to proceede about getting the question 'AnswerPrompt' -> How you answer the question (in which style)

Ability to share prompts

gozineb avatar Jul 03 '23 12:07 gozineb

can i work on it

shivvamm avatar Jul 08 '23 19:07 shivvamm

Sure @shivvamm,I was planning on starting this in 2 weeks but it would be great to have your contribution. The idea is to have in the frontend, a prompt text area where the user can enter his own personal prompt instead of the one that is currently injected in the backend. A custom prompt should be attached to a brain Entity. You will need to update the brains table too. Feel free to ping me if you want to discuss the tech strategy before starting working on it.

gozineb avatar Jul 11 '23 14:07 gozineb

Yes aure i want to know about the details to approach this

shivvamm avatar Jul 11 '23 14:07 shivvamm

Hi @gozineb , thank you for including me in this project. I'm excited to contribute! Before I start working on it, I would appreciate a follow-up discussion to clarify a few details and understand the tech strategy better. Could you please provide more information on how the frontend and backend are currently structured? Additionally, it would be helpful to know what technologies and frameworks are being used. This will allow me to plan my approach accordingly. Once I have a better understanding, I'll be ready to start working on implementing the feature. Please let me know how and when we can schedule a discussion. Thank you!

shivvamm avatar Jul 13 '23 11:07 shivvamm

Hi @shivvamm, thanks for your interesting in the project:

  • Backend: fastapi + python + supabase (SQL)
    • [] Custom prompts should be stored in the brain table: you would need to update the tables.sql and add a migration to include this new column
    • [] add an endpoint to add/update the custom prompt in the brain : Post on /brain -> see 'router' and 'api' folder in backend
    • [] add tests
    • [] add the custom prompt when the question is asked: question_generator in QABaseBrainPicking and _construct_prompt in OpenAIFunctionsBrainPicking
  • Fronted: next + react in typescript
    • [] Add an area where prompt can be customized in front -> You could do that in the settings for now for example
    • [] Use the activeBrain to call endpoint to update prompt
    • [] Add tests to your new components.

You can look take a look at how to contribute in the docs. We haven't fully detailed the backend and frontend architectures as it is still an on going work. Will get to that ASAP.

Don't hesitate to dive into the codebase & put your technical strategy here (even with your gray areas) and I will take the time to review it before you start :)

gozineb avatar Jul 13 '23 15:07 gozineb

sure @gozineb :)

shivvamm avatar Jul 13 '23 17:07 shivvamm

想用中文回答问题,如何设置prompt模板?

beifeng777 avatar Jul 17 '23 08:07 beifeng777

Hi.

Just wanted to respond in order to show my support for this feature. I'm looking forward to this!

mj321 avatar Jul 18 '23 08:07 mj321

Hi @shivvamm. have you started working on this ? If not, will be starting on this next week !

gozineb avatar Jul 24 '23 12:07 gozineb

Hey @gozineb I was going to start I was just thinking we have to separate the prompt make it a global entity and then edit it

shivvamm avatar Jul 24 '23 13:07 shivvamm

@gozineb I'll push the changes till tomorrow

shivvamm avatar Jul 24 '23 13:07 shivvamm

Hi @shivvamm, @mamadoudicko will start working on this today. Have you been able to push your PR ?

gozineb avatar Aug 01 '23 07:08 gozineb

Hi @shivvamm, @mamadoudicko will start working on this today. Have you been able to push your PR ?

Not yet you can work on it I'm still figuring out but thanks for giving me a chance

shivvamm avatar Aug 01 '23 07:08 shivvamm

Hi, I think it has been added to main branch. I tried it, but seems like it doesn't work well. Can I increase weightage to this prompt? If I use system prompt standalone to openAI API, it works differently.

kunalgoyal9 avatar Aug 10 '23 07:08 kunalgoyal9

Hi @kunalgoyal9, feel free to creatre an issue with the proposed change ! Thank you for your interest 😀 I will be closing this one as it is done.

gozineb avatar Aug 29 '23 12:08 gozineb

Thanks to all who worked on this. Much appreciated.

mj321 avatar Aug 29 '23 13:08 mj321