azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

Edit prompt template

Open anderl80 opened this issue 2 years ago • 3 comments

Could you please add a quick example how to replace the prompt template?

anderl80 avatar Apr 19 '23 17:04 anderl80

look into app/backend/approaches for each approach you have prompt

example for chatreadretrieveread.py

completion = openai.Completion.create( engine=self.chatgpt_deployment, prompt=prompt, temperature=overrides.get("temperature") or 0.7, max_tokens=1024, n=1, stop=["<|im_end|>", "<|im_start|>"])

itmilos avatar May 21 '23 08:05 itmilos

Thanks @itmilos, yeah already tweaked the chatreadretrieveread.py for my demos and presentations. Makes sense. However, there's this "developer's settings" section, where you can override the prompt template within the application. All my approaches didn't work, so I too went the way like you suggested and edited the code and then re-deployed the application.

anderl80 avatar May 25 '23 10:05 anderl80

@anderl80 here you can take this PR as example https://github.com/Azure-Samples/azure-search-openai-demo/pull/54 and use it to reproduce for other settings

also there is Override prompt template in latest version so you can sync with main on this repo

itmilos avatar May 25 '23 17:05 itmilos

There was an issue with the UI for overriding the prompt which I just fixed and merged in pr #606 so you can change temporarily there, or change permanently in the approaches files.

pamelafox avatar Sep 08 '23 17:09 pamelafox