fixed: Ai responded with LLM even if answer was found in dataset
Browse files30 unmodified lines31323334353637383940414230 unmodified linesdataset_response = search_dataset(user_input)if dataset_response:# Add user and assistant responses to the chat historychat_history.append({"role": "user", "content": user_input})chat_history.append({"role": "assistant", "content": "You are a heplfull chatbot who specializes in Cisco switch and router configurations" + assistant_response})return chat_history# Generate the response from the LLMoutputs = pipeline(user_input, max_new_tokens=512)# Generate the assistant's response30 unmodified lines31323334353637383940414230 unmodified linesdataset_response = search_dataset(user_input)if dataset_response:# Add user and assistant responses to the chat history from dataset matchchat_history.append({"role": "user", "content": user_input})chat_history.append({"role": "assistant", "content": dataset_response})return chat_history # Return early to avoid generating a response from the LLM# If no match found in dataset, generate the response from the LLMoutputs = pipeline(user_input, max_new_tokens=512)# Generate the assistant's response
Main.py+4-4