AI एजेंट · पाठ

संरचित रिपोर्ट निर्माण

टेम्पलेट-आधारित रिपोर्ट: कार्यकारी सारांश, निष्कर्ष, प्रमाण और सुझाव।

पाठ 3, कुल 4 में से13 चरण

संरचित रिपोर्ट निर्माण, CoddyKit पर AI एजेंट का एक निःशुल्क पाठ है। यह 4 में से 3वाँ पाठ है। आप नीचे पूरा पाठ निःशुल्क पढ़ सकते हैं—फिर अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर के साथ ब्राउज़र में इसका व्यावहारिक अभ्यास कर सकते हैं। यह AI एजेंट सीखने के मार्ग का हिस्सा है और आपकी प्रगति वेब तथा CoddyKit ऐप पर सिंक होती रहती है। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।

तथ्यों से पढ़ने योग्य प्रतिवेदन तक

केवल तथ्यों की सूची देने वाले शोध एजेंट का उपयोग करना कठिन होता है। निर्णय लेने वालों को संरचित प्रतिवेदन चाहिए: कार्यकारी सारांश, पृष्ठभूमि अनुभाग, मुख्य निष्कर्ष, साक्ष्य और सिफारिशें।

इस पाठ में सत्यापित तथ्यों से अनुभाग-दर-अनुभाग पेशेवर प्रतिवेदन तैयार करना सिखाया गया है।

प्रतिवेदन का खाका

प्रतिवेदन की संरचना पहले से निर्धारित करें। LLM एक समय में एक अनुभाग का संश्लेषण करता है, जिससे हर अनुभाग केंद्रित रहता है और दोहराव से बचा जाता है।

REPORT_SECTIONS = [
    'executive_summary',
    'background',
    'key_findings',
    'evidence',
    'recommendations',
    'sources'
]

SECTION_PROMPTS = {
    'executive_summary': 'Write a 2-3 sentence executive summary of the key findings. Business audience.',
    'background':        'Provide background context for the research topic (3-5 sentences).',
    'key_findings':      'List 3-5 key findings as bullet points, each with one supporting fact.',
    'evidence':          'Summarize the evidence for each finding with inline source citations.',
    'recommendations':   'Based on the findings, provide 2-4 actionable recommendations.',
    'sources':           'List all sources cited in the report, formatted as numbered URLs.'
}

if __name__ == '__main__':
    print('Report sections:', REPORT_SECTIONS)
    for section in REPORT_SECTIONS:
        print(f'{section}: {SECTION_PROMPTS[section]}')

एक समय में एक अनुभाग तैयार करना

पूरे प्रतिवेदन को एक ही प्रॉम्प्ट में तैयार करना अविश्वसनीय होता है—LLM तथ्यों और संरचना का ध्यान खो देता है। पहले के अनुभागों को संदर्भ के रूप में देते हुए प्रतिवेदन को अनुभाग-दर-अनुभाग तैयार करें।

import openai

client = openai.OpenAI(api_key='YOUR_OPENAI_KEY')

def generate_section(section_name: str, question: str,
                     facts: list[dict], prior_sections: dict) -> str:
    facts_text = '\n'.join(
        f'- {f["fact"]} (source: {f["source"]})' for f in facts[:25]
    )
    prior_text = '\n\n'.join(
        f'## {k.replace("_"," ").title()}\n{v}'
        for k, v in prior_sections.items()
    )
    prompt = (
        f'Research question: "{question}"\n\n'
        f'Verified facts:\n{facts_text}\n\n'
        f'Report so far:\n{prior_text}\n\n'
        f'Now write the "{section_name}" section.\n'
        f'Instructions: {SECTION_PROMPTS[section_name]}'
    )
    resp = client.chat.completions.create(
        model='gpt-4o',
        messages=[{'role': 'user', 'content': prompt}]
    )
    return resp.choices[0].message.content

प्रतिवेदन को क्रमिक रूप से बनाना

सभी अनुभागों पर क्रम से काम करें और संचित संदर्भ देते जाएँ। हर अनुभाग पहले आ चुकी सामग्री से परिचित रहता है, जिससे प्रतिवेदन में सामंजस्य बना रहता है और उसके भीतर विरोधाभासों से बचा जाता है।

def build_report(question: str, facts: list[dict]) -> dict:
    report = {}
    sections_to_generate = [s for s in REPORT_SECTIONS if s != 'sources']

    for section in sections_to_generate:
        print(f'Generating section: {section}...')
        report[section] = generate_section(
            section_name=section,
            question=question,
            facts=facts,
            prior_sections={k: v for k, v in report.items()}
        )

    # Sources section: generate citation list from fact URLs
    unique_sources = list(dict.fromkeys(f['source'] for f in facts))
    report['sources'] = '\n'.join(
        f'{i+1}. {url}' for i, url in enumerate(unique_sources[:20])
    )

    return report

पाठ-अंतर्गत संदर्भ शामिल करना

तैयार किए गए अनुभागों में तथ्यों के संदर्भों को स्रोत सूची से जुड़ी क्रमांकित संदर्भ-सूचनाओं से बदलें। इससे हर दावे का स्रोत खोजा जा सकता है।

import re

def inject_citations(section_text: str, facts: list[dict]) -> str:
    source_index = {}  # url -> int
    for i, fact in enumerate(facts):
        url = fact['source']
        if url not in source_index:
            source_index[url] = len(source_index) + 1

    annotated = section_text
    for fact in facts:
        if fact['fact'] in annotated:
            num = source_index[fact['source']]
            annotated = annotated.replace(
                fact['fact'],
                f'{fact["fact"]} [{num}]',
                1  # replace first occurrence only
            )
    return annotated

if __name__ == '__main__':
    demo_text = 'Revenue grew 12% last quarter. The team also launched two new products.'
    demo_facts = [{'fact': 'Revenue grew 12% last quarter', 'source': 'https://example.com/report'}]
    print(inject_citations(demo_text, demo_facts))

मार्कडाउन के रूप में प्रारूपित करना

प्रतिवेदन के अनुभागों को मार्कडाउन के रूप में प्रस्तुत करें। इससे परिणाम को HTML या PDF में बदला जा सकता है या Notion अथवा Confluence जैसे उपकरणों में सीधे दिखाया जा सकता है।

def render_markdown(report: dict, title: str) -> str:
    section_titles = {
        'executive_summary': 'Executive Summary',
        'background':        'Background',
        'key_findings':      'Key Findings',
        'evidence':          'Evidence',
        'recommendations':   'Recommendations',
        'sources':           'Sources'
    }
    lines = [f'# {title}', '']
    for key in REPORT_SECTIONS:
        if key in report:
            lines.append(f'## {section_titles[key]}')
            lines.append('')
            lines.append(report[key])
            lines.append('')
    return '\n'.join(lines)

# Usage:
# md = render_markdown(report, 'Causes of Inflation in 2024')
# with open('report.md', 'w') as f: f.write(md)

स्रोत लिंक के साथ प्रतिवेदन तैयार करना

वेब के लिए प्रस्तुत करते समय स्रोत यूआरएल को हाइपरलिंक में बदलें। साथ ही प्रतिवेदन तैयार किए जाने की तारीख, स्रोतों की संख्या और सत्यापन दर वाला मेटाडेटा ब्लॉक जोड़ें।

from datetime import date

def render_html_report(report: dict, title: str,
                       facts: list[dict], question: str) -> str:
    meta = (
        f'<p><em>Generated: {date.today()} | '
        f'Sources: {len(set(f["source"] for f in facts))} | '
        f'Research question: {question}</em></p>'
    )
    html_parts = [f'<h1>{title}</h1>', meta]
    section_titles = {
        'executive_summary': 'Executive Summary',
        'background':        'Background',
        'key_findings':      'Key Findings',
        'evidence':          'Evidence',
        'recommendations':   'Recommendations',
        'sources':           'Sources'
    }
    for key in REPORT_SECTIONS:
        if key in report:
            content = report[key].replace('\n', '<br>')
            html_parts.append(f'<h2>{section_titles[key]}</h2><p>{content}</p>')
    return '\n'.join(html_parts)

प्रकाशित करने से पहले गुणवत्ता जाँच

प्रतिवेदन देने से पहले स्वचालित गुणवत्ता जाँच चलाएँ: हर अनुभाग में न्यूनतम शब्द-संख्या, कम-से-कम N संदर्भ, सभी सिफारिशें क्रियावाचक शब्दों में और '[INSERT]' जैसा कोई स्थानापन्न पाठ नहीं।

def quality_check(report: dict) -> list[str]:
    issues = []

    for section in ['executive_summary', 'background', 'key_findings']:
        word_count = len(report.get(section, '').split())
        if word_count < 30:
            issues.append(f'{section} too short: {word_count} words (min 30)')

    if report.get('sources', '').count('http') < 3:
        issues.append('Less than 3 cited sources')

    if '[INSERT]' in str(report) or 'TODO' in str(report):
        issues.append('Report contains placeholder text')

    recs = report.get('recommendations', '')
    if recs and not any(verb in recs.lower()
                        for verb in ['should', 'recommend', 'consider', 'implement']):
        issues.append('Recommendations may not be actionable')

    return issues

if __name__ == '__main__':
    demo_report = {
        'executive_summary': 'Too short.',
        'background': 'Also short.',
        'key_findings': 'Short too.',
        'sources': 'http://a.com',
        'recommendations': 'Looks fine as is.',
    }
    for issue in quality_check(demo_report):
        print('-', issue)

कार्यकारी सारांश: कड़ी सीमाएँ

कार्यकारी सारांश अपने आप में पूर्ण होना चाहिए: केवल इस अनुभाग को पढ़ने वाला व्यक्ति भी मुख्य निष्कर्ष और सुझाई गई कार्रवाई समझ सके। शब्द-सीमा वाला सख्त प्रॉम्प्ट उपयोग करें।

def generate_executive_summary(question: str, facts: list[dict],
                               max_words: int = 80) -> str:
    top_facts = '\n'.join(f'- {f["fact"]}' for f in facts[:10])
    prompt = (
        f'Research question: "{question}"\n\n'
        f'Key facts:\n{top_facts}\n\n'
        f'Write an executive summary in EXACTLY {max_words} words or fewer.\n'
        f'Format: [Main finding]. [Why it matters]. [Recommended action].'
    )
    resp = client.chat.completions.create(
        model='gpt-4o',
        messages=[{'role': 'user', 'content': prompt}]
    )
    return resp.choices[0].message.content

बहु-दर्शक प्रतिवेदन

एक ही शोध के लिए अलग-अलग दर्शकों हेतु अलग प्रतिवेदन शैलियों की आवश्यकता हो सकती है: इंजीनियरों के लिए तकनीकी गहन विश्लेषण, नेतृत्व के लिए कार्यकारी सारांश और गैर-विशेषज्ञों के लिए सरल भाषा में संक्षिप्त विवरण। हर रूपांतर को उसी तथ्य-समूह से तैयार करें।

AUDIENCE_STYLES = {
    'executive':   'Brief, strategic. Avoid jargon. Focus on business impact and decisions.',
    'technical':   'Detailed, precise. Include methodology, caveats, and data sources.',
    'general':     'Plain language. Avoid technical terms. Use analogies where helpful.'
}

def generate_for_audience(facts: list[dict], question: str, audience: str) -> str:
    style = AUDIENCE_STYLES.get(audience, AUDIENCE_STYLES['general'])
    facts_text = '\n'.join(f'- {f["fact"]}' for f in facts[:20])
    prompt = (
        f'Synthesize these facts into a report for a {audience} audience.\n'
        f'Style guide: {style}\n'
        f'Question: "{question}"\n\n'
        f'Facts:\n{facts_text}'
    )
    resp = client.chat.completions.create(
        model='gpt-4o',
        messages=[{'role': 'user', 'content': prompt}]
    )
    return resp.choices[0].message.content

प्रतिवेदनों को सहेजना और संस्करण बनाना

प्रतिवेदनों को समय-चिह्न और शोध प्रश्न के हैश के साथ सहेजें। इससे स्रोतों को अपडेट करके शोध दोबारा चलाने पर प्रतिवेदन के संस्करणों की तुलना की जा सकती है।

import hashlib, json, os
from datetime import datetime, timezone

def save_report(report: dict, question: str, output_dir: str = '/tmp/reports'):
    os.makedirs(output_dir, exist_ok=True)
    q_hash = hashlib.md5(question.encode()).hexdigest()[:8]
    timestamp = datetime.now(timezone.utc).strftime('%Y%m%d_%H%M')
    filename = f'{output_dir}/report_{q_hash}_{timestamp}.json'

    with open(filename, 'w') as f:
        json.dump({
            'question':   question,
            'generated':  timestamp,
            'sections':   report
        }, f, indent=2)
    print(f'Report saved: {filename}')
    return filename

if __name__ == '__main__':
    import tempfile
    demo_dir = tempfile.mkdtemp()
    save_report({'executive_summary': 'AI agent adoption grew significantly in 2026.'},
                'What are the key AI agent trends in 2026?', output_dir=demo_dir)

प्रतिवेदन की संरचना में कौन-सा अनुभाग हमेशा अपने आप में पूर्ण होना चाहिए

प्रतिवेदन की संरचना इस तरह बनाई जाती है कि समय की कमी वाले पाठक पूरा दस्तावेज़ पढ़े बिना भी उपयोगी जानकारी प्राप्त कर सकें। यह समझना महत्वपूर्ण है कि कौन-सा अनुभाग स्वतंत्र रूप से पर्याप्त होना चाहिए।

संरचित प्रतिवेदन तैयार करने का पुनरावलोकन

एक निश्चित खाके (कार्यकारी सारांश → पृष्ठभूमि → मुख्य निष्कर्ष → साक्ष्य → सिफारिशें → स्रोत) का उपयोग करके प्रतिवेदन अनुभाग-दर-अनुभाग तैयार करें। पाठ-अंतर्गत संदर्भ शामिल करें, गुणवत्ता जाँच चलाएँ और उसी तथ्य-समूह से अलग-अलग दर्शकों के लिए शैलियों का समर्थन करें।

संस्करण बनाने के लिए प्रतिवेदनों को हमेशा समय-चिह्न और प्रश्न के हैश के साथ सहेजें।

शुरुआत निःशुल्क

एआई शिक्षक के साथ AI एजेंट सीखें — निःशुल्क

अपने ब्राउज़र में वास्तविक कोड लिखें और चलाएँ, चौबीसों घंटे एआई शिक्षक से तुरंत सहायता पाएँ, और वेब या ऐप पर वहीं से शुरू करें जहाँ आपने छोड़ा था।

पाठ्यक्रम
60
पाठ
239

अक्सर पूछे जाने वाले प्रश्न

क्या “संरचित रिपोर्ट निर्माण” पाठ निःशुल्क है?

हाँ—“संरचित रिपोर्ट निर्माण” का पूरा पाठ यहाँ वेब पर निःशुल्क पढ़ा जा सकता है। इंटरैक्टिव अभ्यास (अंतर्निहित कोड संपादक और 24/7 एआई ट्यूटर) करने और AI एजेंट पाठ्यक्रम का बाकी हिस्सा अनलॉक करने के लिए CoddyKit PRO लें। AI एजेंट पाठ्यक्रम में कुल 4 पाठ शामिल हैं।

“संरचित रिपोर्ट निर्माण” में मैं क्या सीखूँगा?

टेम्पलेट-आधारित रिपोर्ट: कार्यकारी सारांश, निष्कर्ष, प्रमाण और सुझाव। आप ब्राउज़र में सीधे चलाए जाने वाले व्यावहारिक कोड के साथ AI एजेंट का अभ्यास करते हैं, और पाठ पूरा करते समय 24/7 एआई ट्यूटर आपके प्रश्नों के उत्तर देता है।

क्या AI एजेंट शुरू करने के लिए मुझे किसी अनुभव की आवश्यकता है?

पहले के अनुभव की आवश्यकता नहीं है। CoddyKit पर AI एजेंट शुरुआती से लेकर उन्नत शिक्षार्थियों तक सभी के लिए व्यवस्थित किया गया है, इसलिए आप यहीं से या शुरुआत से सीखना शुरू कर सकते हैं और अपनी गति से आगे बढ़ सकते हैं। यह 4 में से 3वाँ पाठ है।

“संरचित रिपोर्ट निर्माण” पाठ पूरा करने में कितना समय लगता है?

CoddyKit का अधिकांश पाठ लगभग 5–10 मिनट में पूरा हो जाता है। हर पाठ छोटा और संवादात्मक है, इसलिए आप लगातार प्रगति करते हैं और वेब या ऐप पर वहीं से सीखना जारी रख सकते हैं जहाँ आपने छोड़ा था।

क्या मैं इस AI एजेंट पाठ में कोड लिख और चला सकता हूँ?

हाँ। हर AI एजेंट पाठ में एक अंतर्निर्मित कोड संपादक शामिल है, जिससे आप सीधे अपने ब्राउज़र में वास्तविक कोड लिख और चला सकते हैं और तुरंत एआई प्रतिक्रिया पा सकते हैं—स्थानीय सेटअप की आवश्यकता नहीं है।

इस पाठ्यक्रम के सभी पाठ

  1. बहु-चरणीय शोध चक्र का डिज़ाइन
  2. स्रोत सत्यापन और संदर्भ-उद्धरण
  3. संरचित रिपोर्ट निर्माण
  4. तथ्य-जाँच और मनगढ़ंत जानकारी की रोकथाम
← AI एजेंट पर वापस जाएँ