HSLiu-Initial / CtrlA

This includes the original implementation of CtrlA: Adaptive Retrieval-Augmented Generation via Inherent Control.
Apache License 2.0
68 stars 9 forks source link

bm25 and bge is not implement? #1

Open oujieww opened 1 month ago

oujieww commented 1 month ago

hi,

i want to run the code, but find: bm25 return none, i find the code: def wiki_search(query, size=10): pass

does it mean that the function is not implement? where can I find it?

HSLiu-Initial commented 1 month ago

Hello! Both our retrievers (BM25 and BGE) are deployed on the server using Flask, as mentioned in the Retriever Setup section of the README. We have provided the code for deployment and usage. We will upload a more complete version of the code later, including a retriever for local use and implementations for some multi-hop datasets.

oujieww commented 1 month ago

@HSLiu-Initial thank you so much for your reply!

yeah! i find the deployment and usage demo for retriever. The code i am looking for is the usage function in expriments. Looking forward to your subsequent code, thank you.

HSLiu-Initial commented 1 month ago

@oujieww Sorry for not getting back to you sooner. You can refer to the two functions below and replace the URL part with the URL of your deployed service, such as http://0.0.0.0:6970/bm25.

def retrieve_bge(query, top_k, use_prefix=True): d = { "query": query, "top_k": top_k, "use_prefix": use_prefix, } args = { "url": "", # Your URL "data": json.dumps(d, ensure_ascii=False).encode("utf-8"), "proxies": {"http": None, "https": None}, } x = requests.post(**args) time.sleep(0.5) return x.json()

def wiki_search(query, size=10): d = {"query": query, "size": size} args = { "url": "", # Your URL "data": json.dumps(d), "proxies": {"http": None, "https": None}, } time.sleep(0.5) x = requests.post(**args) return x.json()["results_text"]

oujieww commented 1 month ago

Thank you so much, thank you for your patient guidance