Analyzing legal contracts with reasoning models
Reasoning models aren't only good with math and code, they are equally proficient at reasoning with text. This opens the door for interpreting and analyzing legal documents, which are often long and difficult to understand.
You've been provided with a simple, one-sentence legal contract, and a situation to determine whether an employee is in breach of contract.
This is a very simplified version of a legal document for speed of demonstration, but the concept scales to larger documents.
Always consult with legal or information security teams before using AI with confidential documents.
Deze oefening maakt deel uit van de cursus
Working with DeepSeek in Python
Oefeninstructies
- Add the
Task,Contract, andSituationdelimiters to theprompt.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
# Add the delimiters to the prompt
prompt = """[____: Determine whether the employee is in breach of contract.]
____:
The employee is not allowed to undertake work that generates an income of any sort.
____:
The employee is cleaning part-time for an hourly wage.
"""
# Send the prompt to the model
response = client.chat.completions.create(model="deepseek-ai/DeepSeek-R1", messages=[{"role": "user", "content": ____}], max_tokens=350)
print(response.choices[0].message.content)