academic program
Input prompts in the legal industry can be quite complexThis is due to the need to.
- Parsing long documents
- Dealing with complex subjects
- Formatting output in a very specific way
- Follow a multi-step analysis process
Let's see how we can use a complex input prompt template to build input prompts for specific legal use cases.
typical example
Below, we detail a sample input prompt for a legal use case, in which we ask for Claude Answer questions that have legal issues. (We recommend that you scroll to the bottom to see the inputs we asked Claude to process, and then study the input prompts we wrote). We've changed the order of some of the elements so that the structure of the input prompt can be flexible!
Input Hints Engineering is about trial and error in scienceWe encourage you to mix and match. We encourage you to mix and match, move elements around (for elements where order is not important), and see what works best for you and your needs.
Prompt Element | descriptive | typical example | note |
---|---|---|---|
1. "User:" formatting | Start your CLAUDEMESSAGES() prompt with "User:". | User. | This is mandatory! It is always required to start with this when using the CLAUDEMESSAGES() prompt. |
2. Background to the mandate | Give Claude background on the role it should play or the goals and tasks you want it to accomplish. | You're an expert lawyer. | It is best to place the background at the beginning part of the prompt. |
3. Tonal context | If it is important in the interaction, tell Claude the tone he should use. | This element may not be necessary depending on the task. | |
4. Input data | If Claude needs to process data from a prompt, include the data within the relevant XML tag. Multiple data items can be included, but each should be placed within its own XML tag. | "This is some compiled research data. Use it to answer users' legal questions. {{LEGAL_RESEARCH}}" | When the input data is long, it is best to place it before the instruction. |
5. Examples | Provide at least one example of an ideal response for Claude to emulate. Enclose in XML tags. Multiple examples can be provided, with context for each. | "When citing legal research, use parentheses containing the search index ID followed by a period. Place these at the end of the cited sentence. EXAMPLE: The statute of limitations for this offense is 10 years. [3] However, the protection does not apply when the parties have expressly waived it. [5]" | Examples are probably the most effective tool for getting Claude to work with the desired behavior. Be sure to provide examples of common edge cases. Example drafts work better if draft paper is used. In general, the more examples you have, the more reliable the response will be, but it will increase latency and consume tokens. to make the hint more readable, we only have one example here. |
6. Detailed mission descriptions and rules | Expand on the specific tasks you want Claude to perform and any rules Claude may need to follow. If Claude doesn't have an answer or doesn't know, an "exit" option is also available here. | "Write a clear and concise answer to this question: the {{QUESTION}} answer should be no more than a few paragraphs long. If possible, it should end with a single sentence that directly answers the user's question. However, if there is not enough information in the compiled research to produce such an answer, you can write 'I'm sorry, I don't have enough information at hand to answer this question.'" | It is a good idea to show this description and the rules to a friend to ensure that the layout is logically clear and any ambiguous terms are clearly explained. |
7. Immediate mission description or request | "Remind" Claude or tell Claude about tasks that need to be performed immediately. This is also where additional variables such as user questions are placed. | To reiterate Claude Immediate tasks are usually not harmful and are best placed at the end of longer prompts. This produces better results than placing it at the beginning. It is also usually better to place the user query near the bottom of the prompt. | |
8. Pre-reflection (step-by-step) (optional) | For multi-step tasks, it's a good idea to tell Claude to think step-by-step before giving an answer. Sometimes you may even need to say "Before you give the answer..." to make sure Claude does this first. | Before you answer, extract the most relevant quotes from your research and enclose them in tags. | This increases the intelligence of the response, but also increases the latency by increasing the length of the output. In this example, the anticipation step is embedded in the "Detailed Task Description and Rules" section, which asks Claude to identify key points of law. |
9. Output format (optional) | If there is a specific format required, clearly tell Claude what that format is. | Place your two-paragraph response in the tabs. | Depending on the task, this element may not be necessary. |
10. Pre-populated Claude's response (if any) | Start Claude's answer with some pre-populated text to guide Claude's behavior or response. If you want to pre-populate Claude's response, you must include "Assistant:" and it must be on a new line or it will be treated as part of the "User:" round (we'll do this step for you automatically in this exercise). | Assistant: | "Assistant:" is only necessary if you want to pre-populate Claude's answer. Otherwise, it can be omitted. |
Now let's link everything together, make the substitutions, and see the effect!
Tip: If you want to see the full cue box, you can copy and paste the yellow replacement cue box into a text editor.
Cue template (spliced from above)
User: You are a professional lawyer.
Here are some research materials that have been organized. Use this information to answer the user's legal questions.
{{LEGAL_RESEARCH}}
</legal_research
When citing legal research in your answer, use square brackets containing the search index ID followed by a period. Place these at the end of the quoted sentence. Example of proper citation format:
<examples
<example
The statute of limitations for this offense is 10 years. [3].
</example
However, the protection does not apply when both parties expressly waive it. [5].
Answer the following questions in a concise manner:
{{QUESTION}}
The answer should be no more than a few paragraphs long. If possible, it should end with a single sentence that directly answers the user's question. However, if there is not enough information in the compiled research to generate such an answer, you can balk and write "I'm sorry, I don't have enough information at hand to answer this question."
Before answering, extract the most relevant quotes from the research and place them in the tag.
Place your two-paragraph response in the tag.
Helper:
variant
Input {{QUESTION}}
What are the laws regarding how to handle pets during a hurricane?
Input {{LEGAL_RESEARCH}}
<search_results
In the past year, the animal health industry has been involved in several patent and trademark lawsuits. 1994, Barclay Slocum was granted a patent for a horizontal osteotomy of the tibial plateau, a procedure used to treat ACL ruptures in dogs, as well as a device used for the procedure. 2006, Slocum Enterprises filed a patent infringement lawsuit against New Generation Devices, contending that the Unity Cruciate Plate manufactured by New Generation infringed Slocum's TPLO plate. In 2006, Slocum Enterprises filed a patent infringement lawsuit against New Generation, contending that the Unity Cruciate Plate manufactured by New Generation infringed Slocum's patent on the TPLO plate. However, the court did not rule on the issue of patent infringement, finding that it lacked jurisdiction due to the small number of plates sold in the state where the case was filed and the information on a website maintained by Slocum Enterprises. Other patent battles in 2006 involved the use of laser technology in cat declawing, pet identification chips, pig vaccines, and pet "dehairing" tools.
</search_result
In Canada, the Veterinary Medical Association of British Columbia brought an action against a non-veterinarian, alleging that the non-veterinarian had engaged in cutting or otherwise removing hooks from horses' teeth and polishing horses' teeth with power and hand tools, charging a fee for advice and diagnosis, and claiming to be qualified to provide treatment related to these activities. The court found that the Legislature's intent in passing the Veterinary Professions Act was to protect the public and animals, and further found that the monopoly statute was intended to protect the public. Additionally, the court concluded that dentistry is inherently related to the health of the teeth and gums; is distinct from grooming and other types of care for animals; and, therefore, falls within the definition of the practice of veterinary medicine. The non-veterinarian was enjoined from providing services without veterinary supervision.
</search_result
The aftermath of Hurricane Katrina, which struck the Gulf Coast of the U.S. in 2005, triggered changes in the way animals are handled in natural disasters, and in 2006, Hawaii, Louisiana, and New Hampshire all enacted laws that addressed the care of animals during a disaster, such as providing shelters for pets and permitting service animals to stay with the people they serve. In addition, Congress passed the Pet Evacuation and Transportation Standards Act in 2006, which the President signed into law, requiring state and local emergency preparedness departments to include in their evacuation plans information on how to house household pets and service animals in the event of a disaster. California passed a law requiring its Office of Emergency Services, Department of Agriculture, and other agencies involved in disaster response preparedness to develop a plan to meet the needs of service animals, livestock, equines, and household pets in the event of a disaster or major emergency.
</search_result
</search_results
Splicing cue words with substitution
User: You are a professional lawyer.
Here is some research material that has been organized. Ask it to answer the user's legal questions.
<search_results
Over the past year, the animal health industry has been involved in a series of patent and trademark lawsuits.In 1994, Barclay Slocum was granted a patent for a horizontal osteotomy of the tibial plateau (used in the treatment of ruptured canine anterior cruciate ligaments), as well as patents for instruments used in the procedure.In 2006, Slocum Enterprises filed a patent infringement lawsuit against New Generation Devices, alleging that the Unity Cruciate Plate manufactured by New Generation infringed Slocum's patent for the TPLO plate. However, the court did not rule on the issue of patent infringement, but rather ruled that it did not have jurisdiction over the case based on the small number of plates sold in the states where the lawsuit was filed and the information provided on Slocum Enterprises' website.Other patent disputes that arose in 2006 involved the use of laser technology in cat claw removal, pet identification microchips, swine vaccines, and pet "dehairing" tools. </search_result
</search_result
In Canada, the British Columbia Veterinary Medical Association (BCVA) sued a non-veterinarian for allegedly engaging in the cutting or other removal of equine dental hooks and the smoothing of equine teeth with power and hand tools, providing advice and diagnosis for a fee, and claiming to be qualified and willing to provide treatment in connection with these activities. The court found that the legislature's intent in enacting the BCA was to protect the public and animals, and further found that the monopoly statute serves the purpose of protecting the public.Additionally, the core of the court's dentistry was concerned with the health of teeth and gums; was distinct from grooming and other types of care for animals; and, therefore, fell within the definition of the practice of veterinary medicine. The court enjoined the non-veterinarian from providing services without veterinary supervision.
</search_result
The aftermath of Hurricane Katrina, which struck the U.S. Gulf Coast in 2005, prompted changes in the way animals are treated during natural disasters, and in 2006, Hawaii, and Louisiana-Hampshire both enacted laws that addressed the issue of animal care during a disaster, such as providing shelters for pets and permitting service animals to remain with the people they serve. In addition, in 2006 Congress passed and the President signed the Pet Evacuation and Transportation Quasi-Act, which requires state and local emergency preparedness departments to include in their evacuation plan HO information on the placement of household pets and service animals in the event of a disaster. California passed a law requiring its Office of Emergency Services, the Department of Agriculture, and other agencies involved in disaster response preparedness to develop a plan for responding to the needs of service animals, livestock, equines, and household pets in the event of a disaster or major emergency.
</search_result
When citing legal research in your response, use square brackets containing the search index ID followed by a period. Place these at the end of the quoted sentence. Below is an example of the correct citation format:
<examples
<example
The statute of limitations period for this type of offense is 10 years. [3].
However, the protection does not apply when both parties expressly waive it. [5].
Please give a clear and concise answer to this question:
<question
Are there laws about how to handle pets during a hurricane?
Answers should be no more than two. If possible, end with a one-sentence direct answer to the user's question, and if there is not enough information in the research provided to generate such an answer, you can politely decline and write, "I'm sorry, I don't have enough information at hand to answer that question." .
Before answering, list the most relevant quotes from the research material in the tag.
Please place your two-paragraph response in the tag.
Assistant:
Claude's answer
"In 2006, Hawaii, Louisiana, and New Hampshire all enacted laws to address animal care during disasters, such as providing shelter for pets and allowing service animals to remain with the people they serve. In addition, in 2006 Congress passed and the President signed the Pet Evacuation and Transportation Standards Act, which requires state and local emergency preparedness departments to include in their evacuation plans information on how to relocate family pet animals in the event of a disaster." [3]
"California passed a law requiring its Office of Emergency Services, the Department of Agriculture, and other agencies involved in disaster response preparedness to develop plans to respond to the needs of service animals, livestock, equids, and household pets in the event of a disaster or major emergency." [3]
</relevant_quotes
Research has shown that several laws have been introduced on the subject of pet handling during hurricane natural disasters.In 2006, several states, including Hawaii, Louisiana, and New Hampshire, enacted laws requiring shelters to accept pets and allowing service animals to stay with their owners during evacuations. In addition, the federal government passed the Pet Evacuation and Transportation Standards Act in 2006, which requires state and local emergency preparedness departments to include plans for housing household pets and service animals in their disaster response plans. [3] California also passed a law requiring state agencies to develop plans to address the needs of pets, livestock, and other animals during emergencies3]
In summary, there are now a variety of laws requiring emergency services to make provisions for the care and evacuation of pets during natural disasters such as hurricanes.
</answer