District-Administration-Varanasi / court-judgement

1 stars 3 forks source link

AI Copilot System Design Workflow Documentation (Schema to Draft Editor) #23

Open Grinzypino opened 1 month ago

Grinzypino commented 1 month ago

The draw.io file is present in the main directory for a better view and control over the design made. AI Copilot Working

Grinzypino commented 1 month ago

AI Copilot System Design Workflow Documentation

Overview

This documentation explains the workflow of the system design as depicted in the provided diagram. The process begins by sending a JSON schema path to the /generate_q API endpoint and concludes when the workflow reaches the Draft Editor.

Workflow Steps

  1. Starting Point: JSON Schema Path to /generate_q

    • The workflow starts by sending a JSON schema path to the /generate_q endpoint.
    • API Endpoint: /generate_q
    • Action: This endpoint generates a list of questions based on the provided JSON schema.
  2. Question Generation (/generate_q)

    • This endpoint calls certain functions that call GPT 3.5 Turbo to generate questions for the JSON schema and also creates a current JSON which is initialised with null or empty list values.
    • Output: A set of questions in JSON format, current_json object and a dictionary of expected answers in JSON format.
  3. Question Display and User Interaction

    • The generated questions are converted into Hindi and displayed on a Q&A form for the user to fill out.
    • UI Component: Converts questions to Hindi and presents them to the user.
    • User Action: The user provides answers to the displayed questions in Hindi.
  4. Answer Checking (/check_ans)

    • The user's answers are sent to the /check_ans endpoint.
    • API Endpoint: /check_ans
    • Action: This endpoint checks the user’s answers for correctness.
  5. Reframing Questions (/reframe_q)

    • If the user’s answers are not satisfactory or if additional clarification is needed it returns a dictionary of only those questions and the /reframe_q endpoint is invoked by UI.
    • API Endpoint: /reframe_q
    • Action: This endpoint reframes the questions to elicit better or more detailed responses from the user.
    • The user is then presented with the reframed questions, and the process returns to the answer-checking step.
  6. Draft Generation (/generate_draft)

    • If all questions have been satisfactorily answered then UI recieves an empty dictionary of questions that needed to be reframed and the /generate_draft endpoint is invoked to create a draft document.
    • API Endpoint: /generate_draft
    • Action: This endpoint generates a draft based on the user’s answers.
  7. Draft Editor

    • The generated draft is sent to the Draft Editor for final review and editing.
    • Component: Draft Editor
    • Action: The user can review, edit, and finalize the draft document.

This workflow ensures that the questions derived from a JSON schema are thoroughly answered, checked for correctness, and used to generate a comprehensive draft document, which can then be finalized in the Draft Editor.