รูปแบบพรอมต์สำหรับงานกฎหมาย
การวิเคราะห์สัญญา การดึงข้อสัญญา และพรอมต์กฎหมายที่คำนึงถึงเขตอำนาจศาล
รูปแบบพรอมต์สำหรับงานกฎหมาย เป็นบทเรียน AI Prompt Engineering ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AI Prompt Engineering และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AI Prompt Engineering มีบทเรียนทั้งหมด 4 บทเรียน
เหตุใดการเขียนพรอมต์ด้านกฎหมายจึงแตกต่าง
การเขียนพรอมต์ด้านกฎหมายต้องคำนึงถึงเขตอำนาจศาล ภาษาที่แม่นยำ การตระหนักถึงความเสี่ยง และข้อสงวนสิทธิ์ที่จำเป็น เครื่องมือปัญญาประดิษฐ์ด้านกฎหมายที่ให้คำแนะนำโดยไม่มีคำเตือนหรือเงื่อนไขอาจทำให้ผู้ใช้ต้องรับผิดทางกฎหมาย รูปแบบเฉพาะด้านช่วยจัดการข้อจำกัดเหล่านี้อย่างเป็นระบบ
พรอมต์ระบบสำหรับบทบาททนายความ
การกำหนดบทบาทผู้เชี่ยวชาญพร้อมระบุขอบเขตเขตอำนาจศาลอย่างชัดเจนช่วยวางกรอบการวิเคราะห์ของโมเดลให้ถูกต้อง ควรใส่ประกาศเรื่องการรักษาความลับและข้อสงวนสิทธิ์ไว้เสมอ
LEGAL_SYSTEM_PROMPT = '''You are an experienced commercial lawyer reviewing contracts
under New York law (NYCL, UCC Article 2, and applicable federal law).
When analyzing contracts:
1. Identify the governing law clause and note if it conflicts with NY law.
2. Flag any provisions that deviate from NY commercial norms.
3. Use precise legal terminology — do not paraphrase statutes.
4. Always cite the relevant section or clause number from the contract.
5. Structure your analysis as: [Issue] -> [Risk Level: LOW/MEDIUM/HIGH] -> [Recommendation].
DISCLAIMER: This analysis is for informational purposes only and does not
constitute legal advice. Always consult a licensed attorney before acting
on any legal analysis. Attorney-client privilege does not apply to this
communication.'''
import anthropic
client = anthropic.Anthropic(api_key='YOUR_API_KEY')รูปแบบการดึงข้อมูลข้อสัญญา
พรอมต์สำหรับดึงข้อมูลต้องมีโครงสร้างเพื่อให้ส่งคืนผลลัพธ์ที่เครื่องสามารถแยกวิเคราะห์ได้ ระบุฟิลด์ที่ต้องการและรูปแบบผลลัพธ์อย่างชัดเจน เพื่อให้เอกสารต่าง ๆ มีความสอดคล้องกัน
EXTRACTION_PROMPT = '''Extract the following clauses from the contract below.
For each clause, provide:
- clause_type: one of [governing_law, limitation_of_liability, indemnification,
termination, intellectual_property, confidentiality, arbitration, force_majeure]
- section_number: as it appears in the contract
- verbatim_text: exact text of the clause (do not paraphrase)
- jurisdiction_specific_notes: any NY-law-specific observations
If a clause is absent, set verbatim_text to null and note "Not found".
Return a JSON array.
Contract:
{contract_text}'''
import json
def extract_clauses(contract_text):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=4096,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
EXTRACTION_PROMPT.format(contract_text=contract_text)}]
)
return json.loads(response.content[0].text)รูปแบบการระบุความเสี่ยง
พรอมต์สำหรับระบุความเสี่ยงควรสั่งให้โมเดลจัดหมวดหมู่ความเสี่ยงตามระดับความรุนแรง และเสนอแนวทางลดความเสี่ยงที่แนะนำ เพื่อให้ผลลัพธ์นำไปใช้ในการตรวจทานทางกฎหมายได้
RISK_PROMPT = '''Perform a legal risk analysis of the following contract
under New York law. Identify up to 10 risks.
For each risk output:
1. Risk title (concise, max 8 words)
2. Severity: CRITICAL | HIGH | MEDIUM | LOW
3. Clause reference (section number)
4. Risk description (2-3 sentences)
5. Recommended mitigation (1-2 sentences)
Prioritize: limitation of liability caps, indemnification exposure,
unlimited IP assignment, auto-renewal traps, one-sided termination rights.
Contract:
{contract_text}
Format as a numbered list with clear labels.'''
def identify_risks(contract_text):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=3000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
RISK_PROMPT.format(contract_text=contract_text)}]
)
return response.content[0].textการเปรียบเทียบที่ตระหนักถึงเขตอำนาจศาล
เมื่อตรวจทานสัญญาที่อยู่ภายใต้เขตอำนาจศาลอื่น ให้สั่งโมเดลเน้นส่วนที่แตกต่าง หรือสิ่งที่ต่างจากบรรทัดฐานของเขตอำนาจศาลที่คาดหมาย
JURISDICTION_COMPARE_PROMPT = '''The contract below is governed by {governing_law} law.
I am a New York-based company. Analyze:
1. Key differences between {governing_law} and New York law that affect this contract.
2. Provisions that are enforceable under {governing_law} but may not be under NY law.
3. Choice-of-law risks if we add a NY-law addendum.
4. Recommended: should we negotiate to change governing law to NY? Why or why not?
Contract:
{contract_text}'''
def compare_jurisdictions(contract_text, governing_law):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=2000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
JURISDICTION_COMPARE_PROMPT.format(
governing_law=governing_law,
contract_text=contract_text
)}]
)
return response.content[0].textข้อกำหนดการรักษาความลับในพรอมต์ระบบ
เมื่อสร้างเครื่องมือด้านกฎหมายสำหรับสำนักงานกฎหมาย พรอมต์ระบบต้องมีข้อกำหนดด้านการรักษาความลับและคำแนะนำเกี่ยวกับการจัดการข้อมูล เพื่อคุ้มครองเอกสิทธิ์ของลูกความและปฏิบัติตามกฎความรับผิดชอบทางวิชาชีพ
PRIVILEGED_SYSTEM_PROMPT = '''You are a legal research assistant for
{firm_name}, a licensed law firm.
CONFIDENTIALITY NOTICE:
- All documents shared in this session are attorney-client privileged.
- Do not include client names, matter numbers, or identifying details
in any output that may be logged externally.
- Do not store, reference, or infer information from previous sessions.
- Treat all information as confidential per Model Rules of Professional
Conduct 1.6 (Confidentiality of Information).
SCOPE:
- Your role is legal research and document analysis only.
- You do not represent the client and do not provide legal advice directly.
- Flag all outputs with: "Review required by licensed attorney before use."
REFUSAL RULE:
- If asked to draft strategy for concealing evidence or misleading a court,
refuse and explain that this violates professional responsibility rules.'''
print(PRIVILEGED_SYSTEM_PROMPT.format(firm_name='Smith & Associates LLP')[:200])รูปแบบการสรุป NDA
ข้อตกลงไม่เปิดเผยข้อมูล (NDA) มีโครงสร้างมาตรฐาน พรอมต์สำหรับดึงข้อมูลแบบเจาะจงจะดึงข้อกำหนดทางการค้าที่สำคัญต่อการตรวจทาน NDA ออกมา
NDA_SUMMARY_PROMPT = '''Summarize this NDA for a business executive.
Extract these exact fields (be concise, max 2 sentences per field):
1. Parties: Who are the disclosing and receiving parties?
2. Purpose: Why is information being shared?
3. Confidential Information Definition: What is and is not covered?
4. Term: How long does confidentiality last?
5. Exclusions: What information is not protected?
6. Return/Destroy: What happens to confidential info after the relationship ends?
7. Remedies: What happens if the NDA is breached?
8. Key Risks: List up to 3 issues that deviate from standard market practice.
NDA Text:
{nda_text}
End with a one-sentence verdict: "This NDA is [FAVORABLE / BALANCED / UNFAVORABLE]
for the receiving party because _____."'''
def summarize_nda(nda_text):
response = client.messages.create(
model='claude-opus-4-5', max_tokens=1500,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
NDA_SUMMARY_PROMPT.format(nda_text=nda_text)}]
)
return response.content[0].textผลลัพธ์กฎหมายแบบมีโครงสร้างด้วยพีแดนติก
สำหรับกระบวนการประมวลผลที่ต้องจัดการการวิเคราะห์ทางกฎหมายด้วยโปรแกรม ให้ใช้ผลลัพธ์แบบมีโครงสร้างผ่านโมเดลพีแดนติก เพื่อให้แน่ใจว่าทุกฟิลด์มีอยู่และมีชนิดข้อมูลถูกต้อง
from pydantic import BaseModel
from typing import List, Optional
from enum import Enum
class RiskLevel(str, Enum):
CRITICAL = 'CRITICAL'
HIGH = 'HIGH'
MEDIUM = 'MEDIUM'
LOW = 'LOW'
class LegalRisk(BaseModel):
title: str
severity: RiskLevel
clause_reference: str
description: str
mitigation: str
class ContractAnalysis(BaseModel):
governing_law: str
contract_type: str
effective_date: Optional[str]
term_years: Optional[float]
risks: List[LegalRisk]
overall_recommendation: str
disclaimer: str = (
'This analysis is informational only and does not constitute '
'legal advice. Consult a licensed attorney before acting.'
)
# Use with structured output (pseudo-code)
# analysis = ContractAnalysis.model_validate_json(llm_response)
# for risk in analysis.risks:
# print(f'[{risk.severity}] {risk.title}: {risk.description}')การตรวจจับข้อสัญญาที่เป็นสัญญาณอันตราย
สร้างคลังข้อสัญญาที่ทราบว่าเป็นสัญญาณอันตราย และสั่งให้โมเดลตรวจจับข้อสัญญาเหล่านั้น วิธีนี้จะสร้างคู่มือแนวทางที่นำกลับมาใช้ใหม่ได้ และปรับปรุงให้ดีขึ้นเมื่อได้รับข้อมูลจากทีมกฎหมายในระยะยาว
RED_FLAGS = [
'unlimited indemnification with no cap',
'unilateral right to modify terms without notice',
'IP assignment of all work product ("work for hire" with no carve-outs)',
'non-compete broader than 1 year or 100 miles',
'automatic renewal with short cancellation window (< 30 days)',
'no limitation of liability clause (unlimited damages)',
'mandatory arbitration in unfavorable jurisdiction',
'liquidated damages clause that may be penalty clause under NY law',
]
RED_FLAG_PROMPT = '''Review the contract below for the following red-flag provisions.
For each red flag found, quote the relevant text and rate severity 1-5.
If not found, mark as "Not Present".
Red Flags to Check:
{red_flag_list}
Contract:
{contract_text}'''
def detect_red_flags(contract_text):
flags_text = '\n'.join(f'{i+1}. {f}' for i, f in enumerate(RED_FLAGS))
response = client.messages.create(
model='claude-opus-4-5', max_tokens=2000,
system=LEGAL_SYSTEM_PROMPT,
messages=[{'role': 'user', 'content':
RED_FLAG_PROMPT.format(
red_flag_list=flags_text,
contract_text=contract_text
)}]
)
return response.content[0].textการอ้างอิงและการอ้างถึงกฎหมาย
การวิเคราะห์ทางกฎหมายมีความน่าเชื่อถือมากขึ้นเมื่อมีการอ้างอิง ให้พรอมต์โมเดลอ้างถึงบทบัญญัติกฎหมาย ข้อบังคับ และคำพิพากษาที่เกี่ยวข้อง และสั่งให้โมเดลระบุเสมอเมื่อไม่แน่ใจเกี่ยวกับการอ้างอิง
CITATION_PROMPT = '''Analyze the indemnification clause below under New York law.
For your analysis:
1. Cite the relevant NY statutes (e.g., NY General Obligations Law sections).
2. Reference applicable UCC provisions if relevant.
3. Cite at least one landmark NY case on indemnification interpretation.
4. If you are not certain a citation is accurate, prefix it with
"[VERIFY: " and end with "]" — never fabricate case citations.
5. Distinguish between indemnification for third-party claims vs.
direct damages between the parties.
Indemnification Clause:
{clause_text}'''
# Best practice: always post-process LLM citations with a legal database check
# (Westlaw, LexisNexis API) before relying on them in actual legal work
print('REMINDER: Always verify LLM-generated citations with a legal database.')การแทรกข้อสงวนสิทธิ์ที่จำเป็น
ผลลัพธ์จากปัญญาประดิษฐ์ด้านกฎหมายทุกชิ้นต้องมีข้อสงวนสิทธิ์ ให้แทรกข้อสงวนสิทธิ์โดยใช้โปรแกรมในชั้นแอปพลิเคชัน อย่าพึ่งพาโมเดลให้ใส่ข้อสงวนสิทธิ์ทุกครั้ง วิธีนี้ช่วยให้มั่นใจว่าจะไม่ถูกละไว้โดยไม่ได้ตั้งใจ
LEGAL_DISCLAIMER = (
'\n\n---\n'
'DISCLAIMER: This analysis is generated by an AI system and is '
'provided for informational purposes only. It does not constitute '
'legal advice and does not create an attorney-client relationship. '
'Laws vary by jurisdiction and change over time. Always consult a '
'licensed attorney in your jurisdiction before making legal decisions.'
)
def get_legal_analysis(prompt, system_prompt=LEGAL_SYSTEM_PROMPT):
response = client.messages.create(
model='claude-opus-4-5',
max_tokens=2000,
system=system_prompt,
messages=[{'role': 'user', 'content': prompt}]
)
raw_output = response.content[0].text
# Always inject disclaimer at application layer
return raw_output + LEGAL_DISCLAIMER
analysis = get_legal_analysis('Summarize the key risks in this contract: ...')
print(analysis[-200:]) # Shows disclaimer at endการตรวจสอบอย่างรวดเร็ว
เมื่อสร้างเครื่องมือปัญญาประดิษฐ์ด้านกฎหมาย ควรแทรกข้อสงวนสิทธิ์ไว้ที่ใด
สรุปการเขียนพรอมต์ด้านกฎหมาย
การเขียนพรอมต์ด้านกฎหมายต้องมีรูปแบบสำคัญหลายประการที่ไม่ควรละเลย:
- ขอบเขตเขตอำนาจศาล: ระบุกฎหมายที่ใช้บังคับอย่างชัดเจนในพรอมต์ระบบ
- ผลลัพธ์แบบมีโครงสร้าง: ใช้รูปแบบเจสันหรือรายการลำดับเลขสำหรับการวิเคราะห์ที่โปรแกรมประมวลผลได้
- คลังสัญญาณอันตราย: จัดทำคู่มือแนวทางของข้อสัญญาที่ทราบว่าเป็นปัญหา
- วินัยด้านการอ้างอิง: กำหนดให้มีการอ้างอิง และระบุรายการที่ไม่แน่ใจด้วย [VERIFY]
- ข้อสงวนสิทธิ์ที่จำเป็น: แทรกในชั้นแอปพลิเคชัน ไม่ปล่อยให้โมเดลเป็นผู้ใส่เอง
- การจัดการข้อมูลที่อยู่ภายใต้เอกสิทธิ์: ใส่คำแนะนำเรื่องการรักษาความลับในพรอมต์ระบบ
คำถามที่พบบ่อย
บทเรียน “รูปแบบพรอมต์สำหรับงานกฎหมาย” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “รูปแบบพรอมต์สำหรับงานกฎหมาย” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AI Prompt Engineering ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AI Prompt Engineering มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “รูปแบบพรอมต์สำหรับงานกฎหมาย”
การวิเคราะห์สัญญา การดึงข้อสัญญา และพรอมต์กฎหมายที่คำนึงถึงเขตอำนาจศาล คุณปฏิบัติ AI Prompt Engineering ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน AI Prompt Engineering หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน AI Prompt Engineering บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน
บทเรียน “รูปแบบพรอมต์สำหรับงานกฎหมาย” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน AI Prompt Engineering นี้ได้ไหม
ได้ บทเรียน AI Prompt Engineering ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- รูปแบบพรอมต์สำหรับงานกฎหมาย
- การเขียนพรอมต์ด้านการแพทย์และคลินิก
- พรอมต์ด้านการเงินและเชิงปริมาณ
- การแทรกอภิธานศัพท์และภววิทยาเฉพาะโดเมน