[Bug]: No similarity score returns when calling HTTP/Python API of [Converse with chat assistant]
Is there an existing issue for the same bug?
- [x] I have checked the existing issues.
RAGFlow workspace code commit ID
main
RAGFlow image version
main
Other environment information
docker with win11
Actual behavior
I just flow the steps to build a RAG chat assistant ,but it never output the similarity score, a lot of issues about this bug remains. Other parts of chunks are all okay , I searched a lot about this issue ,but I can not find out why . Whether I use a rerank or not , the test of knowledge base is always with similarity scores , but when calling API , no similarity.
Expected behavior
No response
Steps to reproduce
just call the chat assistant with a knowledge base
Additional information
No response
Could you paste some of your test code and the corresponding response here?
Hello @KevinHuSh , I am facing the same issue. Version 0.17.0-slim. Here is the code:
# questions: List[str], session: <ragflow_sdk.modules.session.Session>
chat_config = {
name = name, dataset_ids = dataset_ids, llm=Chat.LLM(rag=True, res_dict={"model_name":chat, temperature": 0.1, "top_p": 0.3, presence_penalty":0.2, "frequency_penalty":0.7, "max_tokens": 512}, prompt=Chat.Prompt(rag=True,res_dict={similarity_threshold":0.2,"keywords_similarity_weight": 0.7,"top_n":8,"variables": [{"key": "knowledge", "optional": True}],"rerank_model":"","top_k": 1024,"empty_response": None,"opener": "Hello, how can I help you today?", "show_quote": True, "prompt": "You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' Answers need to consider chat history. Here is the knowledge base:{knowledge}The above is the knowledge base."
}
assistant = rag_object.create_chat(**chat_config)
session = assistant.create_session()
respuesta = {}
for question in questions:
for ans in session.ask(question, stream=False):
respuesta['Respuesta'] = ans.content
respuesta['Chunks'] = ans.reference
respuesta['Pregunta'] = question
respuestas_preguntas.append(respuesta)
The response is below. You can see how there is no similiarity info included.
Hello @KevinHuSh , I am facing the same issue. Version 0.17.0-slim. Here is the code:
questions: List[str], session: <ragflow_sdk.modules.session.Session>
chat_config = { name = name, dataset_ids = dataset_ids, llm=Chat.LLM(rag=True, res_dict={"model_name":chat, temperature": 0.1, "top_p": 0.3, presence_penalty":0.2, "frequency_penalty":0.7, "max_tokens": 512}, prompt=Chat.Prompt(rag=True,res_dict={similarity_threshold":0.2,"keywords_similarity_weight": 0.7,"top_n":8,"variables": [{"key": "knowledge", "optional": True}],"rerank_model":"","top_k": 1024,"empty_response": None,"opener": "Hello, how can I help you today?", "show_quote": True, "prompt": "You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' Answers need to consider chat history. Here is the knowledge base:{knowledge}The above is the knowledge base." } assistant = rag_object.create_chat(**chat_config) session = assistant.create_session() respuesta = {} for question in questions: for ans in session.ask(question, stream=False): respuesta['Respuesta'] = ans.content respuesta['Chunks'] = ans.reference respuesta['Pregunta'] = question respuestas_preguntas.append(respuesta) The response is below. You can see how there is no similiarity info included.
hello,Which IDE are you using? I also want to conveniently view the complete structure and values of objects in the editor
hello,Which IDE are you using? I also want to conveniently view the complete structure and values of objects in the editor
Hi! Sorry for late response. Is VSCode, and the way to visualize the variables is to use the debugger.
OK,I got it
tornado.deng @.***
We are facing this issue too unfortunately
Edit: No similarity score when messages are retrieved via sessions directly. Will make a separate issue on this