UltraRAG icon indicating copy to clipboard operation
UltraRAG copied to clipboard

is there a way to generate responses through code?

Open alex-l-zhou opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. First of all Happy CNY 😀 I would like to use this tool to generate responses for a list of prompts. The prompts all have the same structure, and they are basically asking the LLM to perform classification. Through the webUI, this cannot be automated (at least not easily).

Describe the solution you'd like I was wondering if there are APIs already in the repo that allow for this. I see that the webUI uses streamlit's cache_resource to maintain states? I'm not too familiar with streamlit. If not, then I need to implement myself; I wanted to make sure before I do so.

alex-l-zhou avatar Jan 29 '25 08:01 alex-l-zhou

Hi there!

The web UI does not currently support custom prompts. If you want to use the workflow directly, it might meet your needs. For example, the VanillaRAG class allows you to pass in a prompt parameter during initialization and querying. You can find the relevant code here:

https://github.com/OpenBMB/UltraRAG/blob/bb833e493a851d5d102213620ea466c17daa9ca5/ultrarag/workflow/ultraragflow/simple_flow.py#L18

https://github.com/OpenBMB/UltraRAG/blob/bb833e493a851d5d102213620ea466c17daa9ca5/ultrarag/workflow/ultraragflow/simple_flow.py#L61

Best regards!

gdw439 avatar Jan 29 '25 12:01 gdw439

@gdw439 got it, thank you for your response!

alex-l-zhou avatar Jan 30 '25 05:01 alex-l-zhou

You can also use the "Evaluation" module of the WebUI. You need to construct prompts into the corresponding format {"id": 0, "query": "xxx", "answer": "xxx", "prediction": "xxxyyy", "instruction":"this is optional key"}

ChenYX24 avatar Jan 30 '25 07:01 ChenYX24