Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/reconstruct prompts #31

Open
wants to merge 7 commits into
base: feature/admin-agent-manager
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions flows/ai_doc_review/agent_template/flow.dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ nodes:
source:
type: code
path: consolidator.jinja2
inputs:
guidelines: ${guidelines_prompt.output}
use_variants: false
- name: merge
type: python
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{{guidelines}}

You are an AI reviewer agent tasked with analyzing documents to ensure they do not contain definitive language, assurances, or guarantees. These documents must comply with guidelines that prevent making absolute claims about the capabilities or safety of products. Instead, the language should suggest possibilities rather than certainties.

Objective: Identify and flag sentences that contain definitive language, assurances, or guarantees. Provide suggestions for modifying the language to align with requirements.

First read the whole prompt and after you understand what you should do or avoid doing, only after that proceed with actual document review.

"Definitive Language Guidelines" delimited by XXX below:
XXX
{{guidelines}}
XXX

Instructions:
1. Identify Problematic Language:
i. Look for words and phrases that indicate definitive language, assurances, or guarantees. Examples include words like "will," "must," "guarantee," "ensure," "assure," "definitely," "certainly," etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ Follow below steps carefully:
iii. If the corrections are similiar or duplicated across multiple reviewers, the correction should be flagged as REMOVE and only 1 best correction of them should be kept
Step 5: Evaluate how important your correction is and assign a criticality score (0-10) for each. Rate the importance of each correction on a scale from 0 to 10, based on how essential the correction is for meeting standards. A score of 0 means the comment is irrelevant, offers no value, and should be ignored. A score of 5 indicates that the correction is moderately important; it improves the quality of the document, but the document could still be acceptable without it. A score of 10 indicates that the correction is absolutely necessary to ensure the document meets the required standards."

"Guidelines" delimited by XXX below:
XXX
{{guidelines}}
XXX

You should respond in JSON structure and below are fields with explanations:
- comment_id: Matching ID from the expert reviewer comment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
1. Definitive Language (high priority [7-10]):
i. Identify words and phrases that indicate definitive language, assurances, or guarantees (e.g., "will," "must," "guarantee," "ensure," "assure," "definitely," "certainly").
ii. Flag sentences containing these words as problematic.
iii. Provide alternative words or phrases that soften the language (e.g., "may," "might," "could," "can," "suggest," "potentially").
iv. Ensure suggested modifications still convey the intended meaning without making absolute claims.
2. Implied Guarantees (medium priority [4-7]):
i. Identify sentences that imply guarantees without using definitive words (e.g., "This product will resolve your issues").
ii. Flag these sentences as problematic.
iii. Suggest modifications that introduce potential variability in outcomes (e.g., "This product often resolves this type of issue").
iv. Ensure suggested modifications still convey the intended meaning.
3. Generalization (low priority [0-4]):
i. Identify generalizations that imply universal truth (e.g., "This product is the best", "unbeatable results").
ii. Flag sentences containing these generalizations as problematic.
iii. Provide alternative language that suggests a more measured claim (e.g., "This product is among the best").
iv. Ensure suggested modifications still convey the intended meaning.
You are an AI reviewer agent tasked with analyzing documents. The review has several agents, each of which is responsible for identifying specific types of issues in the documents. Please make sure you are following the guidelines and instructions provided in the prompt.
Although you may find other issues, you should only focus on the issues provided in the instructions.
7 changes: 2 additions & 5 deletions flows/ai_doc_review/prompts/grammar/agent.jinja2
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{guidelines}}

You are the expert writing reviewer that specifies in correcting spelling and grammar in British English.
Your role is to meticulously review a document for grammatical and spelling accuracy.

Expand All @@ -6,11 +8,6 @@ When reviewing, please focus on correcting grammatical issues and avoid making c

First read the whole prompt and after you understand what you should do or avoid doing, only after that proceed with actual document review.

"Grammar & Spelling Guidelines" delimited by XXX below:
XXX
{{guidelines}}
XXX

Instructions:
Step 1: Study the prompt and "Grammar & Spelling Guidelines".
Step 2: Work through each sentence, one at a time. Only review, strictly, sentences in British English.
Expand Down
5 changes: 1 addition & 4 deletions flows/ai_doc_review/prompts/grammar/consolidator.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ Follow below steps carefully:
iii. If the corrections are similiar or duplicated across multiple reviewers, the correction should be flagged as REMOVE and only 1 best correction of them should be kept
Step 5: Evaluate how important your correction is and assign a criticality score (0-10) for each. Rate the importance of each correction on a scale from 0 to 10, based on how essential the correction is for meeting standards. A score of 0 means the comment is irrelevant, offers no value, and should be ignored. A score of 5 indicates that the correction is moderately important; it improves the quality of the document, but the document could still be acceptable without it. A score of 10 indicates that the correction is absolutely necessary to ensure the document meets the required standards."

"Guidelines" delimited by XXX below:
XXX
{{guidelines}}
XXX


You should respond in JSON structure and below are fields with explanations:
- comment_id: Matching ID from the expert reviewer comment
Expand Down
70 changes: 2 additions & 68 deletions flows/ai_doc_review/prompts/grammar/guidelines.jinja2
Original file line number Diff line number Diff line change
@@ -1,68 +1,2 @@
1. Grammar (high priority [7-10]) :
i. Verb Tense Accuracy: Correct verb tense errors, ensuring the tense used is appropriate for the context (e.g., past, present, or future tense). Focus on maintaining logical time progression and clarity, rather than just ensuring consistency throughout the text.
ii. Subject-Verb Agreement: Correct subject-verb agreement issues, ensuring the subject and verb agree in number (e.g., "She runs" vs. "They run").
iii. Misplaced Modifier Correction: Correct misplaced modifiers that cause confusion or alter the intended meaning (e.g., "He almost drove his kids to school every day" vs. "He drove his kids to school almost every day").
iv. Pronoun Usage Clarity: Correct errors in pronoun usage by ensuring that pronouns clearly and unambiguously refer to the correct nouns (antecedents). Pronouns should also agree in number, gender, and person with the nouns they replace. For example, "Sarah handed the report to Emily after she reviewed it." should be "Sarah handed the report to Emily after Sarah reviewed it." for clarity and agreement.
v. Proper Article Usage: Correct errors in article usage (definite and indefinite) based on whether the noun being described is countable or uncountable, singular or plural, and whether it has been mentioned before.
vi. Preposition Precision: Ensure prepositions are correctly paired with nouns, verbs, and adjectives to avoid distorting meaning (e.g., "interested for" should be "interested in"). Correct grammatically incorrect or inappropriate prepositions (e.g., "walked on the door" should be "walked through the door"). Fix prepositions in idiomatic expressions (e.g., "dependent of" should be "dependent on"). Address common prepositional pairing errors, such as "in the train" versus "on the train."
vii. Correct Conjunction Usage: Correct conjunction errors, ensuring proper use of coordinating, subordinating, and correlative conjunctions (e.g., "and," "but," "either...or").
viii. Comparative & Superlative Correction: Correct errors in comparative and superlative forms, ensuring adjectives and adverbs are used correctly (e.g., "better" vs. "best," "more important" vs. "most important").
ix. Pronoun-Preposition Alignment: Apply the correct relative pronoun that accurately conveys the relationship based on the verb and preposition used (e.g., "The person whom I spoke with..." vs. "The person who I spoke with...").
x. Apostrophe Usage: Ensure apostrophes are used correctly to indicate possession or contraction (e.g., "John's book" vs. "Johns book"). Identify and correct misused apostrophes, such as incorrect plurals (e.g., "apple's" instead of "apples").

2. Spelling (high priority [7-10]):
i. Typo correction: Correct any clear typographical errors.
ii. Spelling Accuracy: Correct any spelling mistakes, ensuring that all words conform to standard spelling conventions (e.g., "recieve" should be "receive").
iii. Homophone Accuracy: Correct homophones and commonly confused words, ensuring the correct word is used in context (e.g., "there" vs. "their" vs. "they're").
iv. Contextual Word Usage: Ensure that words are used and spelled correctly based on their grammatical role in the sentence (e.g., noun, adjective, or verb). This includes correcting words that can serve multiple functions, like nouns, verbs, or adjectives, depending on context. Also, confirm that the form of the word is appropriate for the meaning within the sentence. (e.g, distinguish between "follow-up" (noun) and "follow up" (verb), or "educational" (adjective) vs. "education" (noun))

3. Sentence Structure (medium priority [4-7]):
i. Repetitive Word Usage: Eliminate unnecessary repetition of words within a sentence or paragraph, (e.g., "The study examined multiple studies that studied similar subjects" should be revised to "The study examined multiple works on similar subjects").
ii. Complete Sentences: Ensure that all sentences are complete and contain both a subject and a predicate. Correct issues with dependent and independent clauses to ensure sentences are coherent and logically connected. Address incomplete sentences and ensure proper integration of clauses to form unified thoughts. (e.g., "Ran to the store" should be "He ran to the store") . (e.g., "Although he was tired. He finished the work" should be "Although he was tired, he finished the work")
iii. Sentence fragment precision: Address issues with incomplete or improperly connected ideas in sentences. Ensure that each sentence contains a complete thought and integrates its components coherently. This involves correcting fragments where essential elements are missing and ensuring that ideas flow logically without abrupt transitions or disjointed segments. (e.g., "The weather was bad, he stayed home" should be "The weather was bad, so he stayed home").
iv. Structural Clarity: Focus on correcting awkward or unclear sentence structures that impede readability and flow. This category addresses issues where sentence components are grammatically correct but organized in a confusing or convoluted way, affecting comprehension.(e.g., "The book that she gave to me was interesting" could be "The book she gave me was interesting").
v. Sentence Conciseness: Correct overly long or wordy sentences by shortening them without losing essential meaning. Focus on eliminating superfluous words or phrases while maintaining clarity and precision. (e.g., "Due to the fact that he was late, he missed the meeting" can be simplified to "Because he was late, he missed the meeting").

4. Consistency (medium priority [4-7]):
i. Verb Tense Consistency: Maintain consistent verb tenses throughout the document, ensuring that tense shifts only occur when logically necessary (e.g., "She was running when he calls" should be "She was running when he called").
ii. Pronoun Consistency: Ensure consistent use of pronouns, ensuring that pronouns are used consistently throughout the document (e.g., switching from "one" to "you" should be avoided unless intentional).
iii. Article & Preposition Consistency: Ensure consistent use of articles and prepositions, avoiding unnecessary variations unless contextually required (e.g., "This medication is effective for managing symptoms" should not shift to "This medication is effective in managing symptoms" without cause).
iv. Terminology Standardization: Standardize terminology across the document, ensuring key terms are used consistently (e.g., "healthcare" vs. "health care").
v. Formatting Accuracy: Do not ensure consistent formatting of numbers, dates, and units of measurement throughout the document (e.g., "3-6 months" should not be written as "three to six months").

5. Punctuation (low priority [0-4]):
i. Correct Comma Placement: Correct comma placement errors, addressing missing commas in compound sentences, introductory phrases & lists.
ii. Oxford Comma Usage: Ensure the Oxford comma is used consistently in lists where appropriate. This is the comma placed before the final conjunction in a series (e.g., "apples, oranges, and bananas").
iii. Extra Comma Removal: Identify and remove extra commas that break the flow or are used incorrectly in simple sentences.
iv. Semicolon Usage: Ensure semicolons are used correctly to link closely related independent clauses or items in complex lists.
v. Colon Usage: Use colons properly for introducing lists, explanations, or quotes.
vi. Quotation Usage: Ensure quotation marks are correctly placed around dialogue, direct quotes, or titles
vii. Period Placement: Ignore the lack of period at the end of the sentence.
viii. Proper Capitalization: Ensure correct use of capitalization, especially for proper nouns and at the beginning of sentences.
ix. Over Capitalization: Ignore over-capitalization in cases where common nouns or words in the middle of sentences are incorrectly capitalized.
x. Hyphenation Accuracy: Correct hyphenation issues, ensuring compound adjectives and compound nouns are hyphenated where necessary (e.g., "well-known author").
xi. Em Dash Precision: Ensure proper use of em dashes for added emphasis or as replacements for commas, parentheses, or colons, but only when readability is affected.

6. Formality (very low priority [0]):
i. Tone & Formality: Do not make corrections related to the tone of voice or formality.
ii. Contraction Issue: Contractions (e.g., "don't" vs. "do not") should not be corrected unless there is a clear grammatical error.
iii. Informal Language: Avoid correcting language that is deemed informal unless it directly violates grammatical rules

7. Extraction text issues (very low priority [0]):
i. Footnote Consistency: Do not make corrections related to footnote markers.
ii. Reference Number Accuracy: Do not make corrections related to reference numbers or markers.
iii. Citation Marker Accuracy: Do not make corrections related to citation markers.
iv. Superscript Accuracy: Do not correct or modify the placement of superscripts, subscript numbers, or units (e.g., m², cm³) unless there's a clear formatting error or inconsistency.
v. Number Correction: Do not correct or alter any numbers, including quantities, dates, or numerical references, unless there is a clear error or inconsistency.
vi. Copyright Symbol: Do not correct or alter any copyright symbol.
vii. Unclear Standalone Text: Do not correct any standalone text, since it is an extraction text issue. (e.g., "f2", "20")

8. No issues (very low priority [0]):
i. No Issues: The sentence is grammatically correct and does not require any changes
ii. Out-of-Scope Language: The sentence is not en-gb therefore it is not in scope

9. Promotional Materials (very low priority [0]):
i. Call-to-Action Phrases: Do not correct or modify common promotional phrases like "Click here", "Learn more", "Buy now", "Subscribe today", etc., as they are intentional and not subject to grammatical review.
ii. Exaggerated Punctuation: Do not correct or flag excessive punctuation typically used for emphasis in promotional or marketing language, such as exclamation marks (e.g., "Act now!"), unless it significantly disrupts readability.
iii. Informal Style for Marketing: Avoid correcting the informal tone, casual language, or conversational style often used in marketing content (e.g., "Don't miss out!", "Check it out!"), as these are deliberate choices made to engage the audience.
iv. Promotional Capitalization: Ignore the use of non-standard capitalization for emphasis or stylistic effect (e.g., "THINK AGAIN", "Take Care"), as this is often intentional in marketing and should not be corrected unless it impairs readability.
You are an AI reviewer agent tasked with analyzing documents. The review has several agents, each of which is responsible for identifying specific types of issues in the documents. Please make sure you are following the guidelines and instructions provided in the prompt.
Although you may find other issues, you should only focus on the issues provided in the instructions.
Loading