Upload code/build_sft_data_v6.py with huggingface_hub
Browse files211 unmodified lines212213214215216217218219220221222223224225226227228229230231211 unmodified linesuser_query = random.choice(queries + hi_queries)is_hindi = user_query in hi_queriestoday = datetime.now().strftime("%d %B %Y")ddg_result = f"[Today: {today}] Results:\nNo relevant results found."lang_detect = "Hindi/Hinglish" if is_hindi else "English"think_str = (f"[THINK]\nUser query: '{user_query}'. Analyzing search results:\n"f"Results returned empty. No relevant information found via DuckDuckGo.\n"f"Language detection: Query is {lang_detect} so answer should be in {lang_detect}.\n"f"Plan: I must gracefully inform the user that the search failed and I cannot find exact live info, to avoid hallucination.\n[/THINK]\n")if is_hindi:ans_body = "Main search results mein iski exact jankari nahi dhoondh paya, par meri knowledge ke anusaar yeh ek complex topic ho sakta hai. Agar aap thodi aur detail de sakein toh shayad main behtar search kar saku."else:ans_body = "I couldn't find exact information for this in the live search results. Based on my general knowledge, there might not be any breaking updates on this right now. Could you provide a bit more context so I can try another search?"final_answer = think_str + ans_bodyex = build_search_example(user_query, user_query, ddg_result, final_answer, "rag")211 unmodified lines212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253211 unmodified linesuser_query = random.choice(queries + hi_queries)is_hindi = user_query in hi_queriestoday = datetime.now().strftime("%d %B %Y")title1 = f"Latest on {user_query[:20]}"title2 = f"More info for {user_query[:20]}"title3 = f"Updates: {user_query[:20]}"# Format explicitly 3 results even for emptyddg_result = (f"[Today: {today}] Results:\n"f"1. {title1}: No relevant information found for this topic.\n"f"2. {title2}: No relevant information found for this topic.\n"f"3. {title3}: No relevant information found for this topic.")lang_detect = "Hindi/Hinglish" if is_hindi else "English"think_str = (f"[THINK]\nUser query: '{user_query}'. Analyzing 3 search results:\n"f"- R1: {title1} - No relevant information found...\n"f"- R2: {title2} - No relevant information found...\n"f"- R3: {title3} - No relevant information found...\n"f"Language detection: Query is {lang_detect} so answer should be in {lang_detect}.\n"f"Plan: I must gracefully inform the user that the search failed across all 3 results, and I cannot find exact live info, to avoid hallucination. I will provide a detailed fallback explanation.\n[/THINK]\n")if is_hindi:ans_body = (f"Aaj ke search results [Today: {today}] mein is vishay par koi thos jaankari nahi mil payi hai.\n\n"f"1. Result 1 ke anusaar, koi relevant data available nahi hai.\n"f"2. Result 2 aur 3 mein bhi is topic ke baare mein kuch specific mention nahi kiya gaya hai.\n\n"f"Meri knowledge ke anusaar yeh ek complex topic ho sakta hai ya fir is par haal hi mein koi nayi update nahi aayi hai. Agar aap thodi aur detail de sakein toh shayad main behtar search kar saku aur aapki madad kar saku. Tab tak main hallucinate karne se bachna chahta hoon.")else:ans_body = (f"Based on today's results [Today: {today}], I couldn't find exact information for this in the live search queries.\n\n"f"1. According to Result 1, there is no relevant breaking data available.\n"f"2. From Result 2 and 3, we can see a similar lack of specific details regarding this exact query.\n\n"f"Based on my general knowledge, there might not be any major updates on this right now or the query might be too specific for current news feeds. Could you provide a bit more context so I can try another search? I want to ensure I provide accurate information rather than hallucinating details.")final_answer = think_str + ans_bodyex = build_search_example(user_query, user_query, ddg_result, final_answer, "rag")
code/build_sft_data_v6.py+28-6