fixed: Ai responded with LLM even if answer was found in dataset
Browse files30 unmodified lines3132333434353637363738393940414230 unmodified lines dataset_response = search_dataset(user_input) if dataset_response: # Add user and assistant responses to the chat history # Add user and assistant responses to the chat history from dataset match chat_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 chat_history.append({"role": "assistant", "content": dataset_response}) return chat_history # Return early to avoid generating a response from the LLM
# Generate the response from the LLM # If no match found in dataset, generate the response from the LLM outputs = pipeline(user_input, max_new_tokens=512) # Generate the assistant's responseMain.py+4-4