arvind6599 commited on
Commit
12afc0e
·
1 Parent(s): 8d3082a

Made the instructions nicer

Browse files
Files changed (1) hide show
  1. app.py +157 -135
app.py CHANGED
@@ -330,159 +330,181 @@ def build_interface():
330
  Constructs the Gradio interface with a submission button and single-submission mechanism.
331
  """
332
  with gr.Blocks() as demo:
333
- gr.Markdown("# Applicant Task: Target Company & Law Firm Identification")
334
- gr.Markdown("## Identifying Parties, Law Firms, and Target Company Presence")
335
-
336
- # General description
337
  gr.Markdown("""
338
- This task involves processing a user query to determine the relevance to the intended task, followed by analyzing textual data to extract information about law firms representing parties (Buyer, Seller, and Third Parties) and verifying the presence of a target company.
339
 
340
- The system is designed to sequentially leverage three LLM functions:
341
-
342
- **Step 1:** LLM1 determines if the user's query mentions any target company.
343
- - If no target company is found, LLM1 responds with a message wrapped in `<user_message></user_message>` XML tags to inform the user that the query is irrelevant to this task.
344
- - If the query contains a target company, LLM1 moves forward with a formatted acknowledgment of the identified target company.
345
-
346
- **Step 2:** LLM2 examines four separate paragraphs independently. For each paragraph, it extracts specific information about:
347
- - The Buyer's representative law firm.
348
- - The Seller's representative law firm.
349
- - Any third-party law firm present.
350
- - Whether the target company is mentioned in the paragraph.
351
- Each paragraph's results are formatted and concatenated for the next step.
352
-
353
- **Step 3:** LLM3 compiles the information from all analyzed paragraphs and outputs a structured JSON object with the following keys:
354
-
355
- ```json
356
- {
357
- "buyer_firm": "string",
358
- "seller_firm": "string",
359
- "third_party": "string",
360
- "contains_target_firm": boolean
361
- }
362
- ```
363
-
364
- The goal is to identify the representative law firms of involved parties and determine if the target company is mentioned, ensuring the results are structured and accurate.
365
-
366
- **Key Considerations:**
367
- - The output must adhere to the prescribed JSON format for the final step.
368
- - Ensure the system can accurately extract and classify relevant information from the input paragraphs.
369
- """)
370
 
371
- # Example Inputs and Outputs in an Accordion
372
- with gr.Accordion("Example Workflow", open=False):
373
- gr.Markdown("""
374
-
375
- User Query:
376
- "Is Kirkland present in the agreement?"
377
-
378
- Document Provided:
379
-
380
- Paragraph 1:
381
-
382
- This Stock and Asset Purchase Agreement is entered into as of October 28, 2021, among Purolite Corporation, a Delaware corporation, along with Stefan E. Brodie and Don B. Brodie (collectively referred to as the Sellers), and Ecolab Inc., a Delaware corporation, as the Purchaser. Additionally, Gibson, Dunn & Crutcher LLP, as an independent third-party representative, is engaged for specific advisory roles outlined in this Agreement.
383
-
384
- Paragraph 2:
385
-
386
- This Agreement shall be governed by and construed in accordance with the internal laws of the State of Delaware, without giving effect to any choice or conflict of law provision. Each clause within this Agreement shall be interpreted independently, and the invalidity of one clause shall not affect the enforceability of the remaining provisions. Headings are for convenience only and shall not affect the interpretation of this Agreement. Nothing herein shall be construed as limiting or waiving any rights or obligations under applicable law unless expressly stated.
387
-
388
- Paragraph 3:
389
-
390
- Such notices, demands, and other communications shall be directed to the Parties at their respective addresses. One Party may be contacted at:
391
- 1 Ecolab Place
392
- St. Paul, Minnesota 55102
393
- Attention: General Counsel
394
- with a copy (which shall not constitute notice) to:
395
- Shearman & Sterling LLP
396
- 599 Lexington Avenue
397
- New York, New York 10022
398
- Attention: Adam Miller
399
- Another Party may be reached at:
400
- Purolite Corporation
401
- 2201 Renaissance Boulevard
402
- King of Prussia, Pennsylvania 19406
403
- Attention: Stefan E. Brodie; Howard Brodie
404
- with a copy (which shall not constitute notice) to:
405
- Cleary Gottlieb Steen & Hamilton LLP
406
- One Liberty Plaza
407
- New York, New York 10006
408
- Attention: John Reynolds; Sarah Lee
409
- Additional communications relating to the role of the third-party representative shall be directed to:
410
- Gibson, Dunn & Crutcher LLP
411
- 200 Park Avenue
412
- New York, New York 10166
413
- Attention: Jane Smith
414
-
415
- Paragraph 4:
416
-
417
- All references to the singular include the plural and vice versa, and all references to any gender include all genders. The Parties agree that any ambiguities in the language of this Agreement shall not be construed against either Party. Section headings used in this Agreement are for reference only and shall not affect the meaning or interpretation of any provision.
418
-
419
- Expected Steps and Outputs:
420
- Step 1 (LLM1):
421
 
422
- If no target company is identified:
423
- Output: <user_message>Query is not relevant to the intended task.</user_message>
424
 
425
- If a target company is identified:
426
- Output: "The target company is Kirkland & Ellis LLP."
427
 
 
428
 
429
- Step 2 (LLM2 for Paragraphs):
430
- Paragraph Example:
 
 
431
 
432
- This Stock and Asset Purchase Agreement is entered into as of October 28, 2021, among Purolite Corporation, a Delaware corporation, along with Stefan E. Brodie and Don B. Brodie (collectively referred to as the Sellers), and Ecolab Inc., a Delaware corporation, as the Purchaser. Additionally, Gibson, Dunn & Crutcher LLP, as an independent third-party representative, is engaged for specific advisory roles outlined in this Agreement.
433
-
434
- Example Output:
435
-
436
- Buyer: Ecolab Inc.
437
- Buyer Representative: Not stated
438
- Seller: Purolite Corporation
439
- Seller Representative: Not stated
440
- Third-Party Representation: Advisory roles, Gibson, Dunn & Crutcher LLP
441
- Target Company Mentioned: No
442
-
443
-
444
- Step 3 (LLM3 Final Output):
445
- Compiled JSON:
446
- {
447
- "buyer_firm": "Shearman & Sterling LLP",
448
- "seller_firm": "Cleary Gottlieb Steen & Hamilton LLP",
449
- "third_party": "Gibson, Dunn & Crutcher LLP",
450
- "contains_target_firm": false
451
- }
452
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
 
454
  # Challenge instructions and testing guidance
455
  with gr.Accordion("Task Instructions and Testing", open=False):
456
  gr.Markdown("""
457
- - Design prompts that ensure proper interaction between the three LLM systems, with each step contributing to the final output.
458
- - Ensure strict adherence to JSON formatting requirements (e.g., no extra characters that may cause JSON parsing errors).
459
- - Test extensively to verify accurate law firm and target company identification.
460
-
461
- **Output Requirements:**
462
- - Ensure final LLM3 JSON output has the following keys:
463
- - `"buyer_firm"`
464
- - `"seller_firm"`
465
- - `"third_party"`
466
- - `"contains_target_firm"`
467
- - Values must be accurately extracted or classified based on LLM2's parsed data.
468
-
469
- **Hints for Crafting System Prompts:**
470
- - Explicitly specify formatting requirements at each step.
471
- - Clarify the task definitions and expected classifications in each system prompt for LLM1, LLM2, and LLM3.
472
- - Test using diverse sample data for robustness.
473
-
474
- """)
 
 
475
 
476
  gr.Markdown("""
477
- Enter your name and email below, as listed in your CV, and submit your designed prompts.
 
478
 
479
- You can only submit once, so validate your system prompts thoroughly using mock queries and example data before final submission.
480
 
481
- Good Luck!
482
 
483
- Remember: Focus on clarity, accuracy, and structured responses to achieve a high score!
484
- """)
485
 
 
 
 
486
 
487
  email_input = gr.Textbox(label="Email", placeholder="[email protected]")
488
  name_input = gr.Textbox(label="First Name, Last Name", placeholder="John, Smith")
 
330
  Constructs the Gradio interface with a submission button and single-submission mechanism.
331
  """
332
  with gr.Blocks() as demo:
 
 
 
 
333
  gr.Markdown("""
334
+ # Applicant Task: Target Company & Law Firm Identification
335
 
336
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
+ ## Identifying Parties, Law Firms, and Target Company Presence
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
340
+ ---
 
341
 
342
+ This task involves processing a user query to determine the relevance to the intended task, followed by analyzing textual data to extract information about law firms representing parties (Buyer, Seller, and Third Parties) and verifying the presence of a target company.
 
343
 
344
+ The system is designed to sequentially leverage three LLM functions:
345
 
346
+ ### Step 1: LLM1
347
+ - Determines if the user's query mentions any target company.
348
+ - If no target company is found, LLM1 responds with a message wrapped in `<user_message></user_message>` XML tags to inform the user that the query is irrelevant to this task.
349
+ - If the query contains a target company, LLM1 moves forward with a formatted acknowledgment of the identified target company.
350
 
351
+ ### Step 2: LLM2
352
+ - Examines four separate paragraphs independently.
353
+ - For each paragraph, extracts:
354
+ - Buyer's representative law firm
355
+ - Seller's representative law firm
356
+ - Any third-party law firm present
357
+ - Whether the target company is mentioned in the paragraph
358
+ - Each paragraph's results are formatted and concatenated for the next step.
359
+
360
+ ### Step 3: LLM3
361
+ - Compiles the information from all analyzed paragraphs and outputs a structured JSON object:
362
+
363
+ ```json
364
+ {
365
+ "buyer_firm": "string",
366
+ "seller_firm": "string",
367
+ "third_party": "string",
368
+ "contains_target_firm": boolean
369
+ }
370
+ ```
371
+
372
+ The goal is to identify the representative law firms of involved parties and determine if the target company is mentioned, ensuring the results are structured and accurate.
373
+
374
+ ---
375
+
376
+ **Key Considerations:**
377
+ - The output must adhere to the prescribed JSON format for the final step.
378
+ - Ensure the system can accurately extract and classify relevant information from the input paragraphs.
379
+ """)
380
+
381
+ # Example Inputs and Outputs in an Accordion
382
+ with gr.Accordion("Example Workflow", open=False):
383
+ gr.Markdown("""
384
+ **User Query:**
385
+ ```
386
+ Is Kirkland present in the agreement?
387
+ ```
388
+
389
+ **Document Provided:**
390
+
391
+ **Paragraph 1:**
392
+ ```
393
+ This Stock and Asset Purchase Agreement is entered into as of October 28, 2021, among Purolite Corporation, a Delaware corporation, along with Stefan E. Brodie and Don B. Brodie (collectively referred to as the Sellers), and Ecolab Inc., a Delaware corporation, as the Purchaser. Additionally, Gibson, Dunn & Crutcher LLP, as an independent third-party representative, is engaged for specific advisory roles outlined in this Agreement.
394
+ ```
395
+
396
+ **Paragraph 2:**
397
+ ```
398
+ This Agreement shall be governed by and construed in accordance with the internal laws of the State of Delaware, without giving effect to any choice or conflict of law provision. Each clause within this Agreement shall be interpreted independently, and the invalidity of one clause shall not affect the enforceability of the remaining provisions. Headings are for convenience only and shall not affect the interpretation of this Agreement. Nothing herein shall be construed as limiting or waiving any rights or obligations under applicable law unless expressly stated.
399
+ ```
400
+
401
+ **Paragraph 3:**
402
+ ```
403
+ Such notices, demands, and other communications shall be directed to the Parties at their respective addresses. One Party may be contacted at:
404
+ 1 Ecolab Place
405
+ St. Paul, Minnesota 55102
406
+ Attention: General Counsel
407
+ with a copy (which shall not constitute notice) to:
408
+ Shearman & Sterling LLP
409
+ 599 Lexington Avenue
410
+ New York, New York 10022
411
+ Attention: Adam Miller
412
+ Another Party may be reached at:
413
+ Purolite Corporation
414
+ 2201 Renaissance Boulevard
415
+ King of Prussia, Pennsylvania 19406
416
+ Attention: Stefan E. Brodie; Howard Brodie
417
+ with a copy (which shall not constitute notice) to:
418
+ Cleary Gottlieb Steen & Hamilton LLP
419
+ One Liberty Plaza
420
+ New York, New York 10006
421
+ Attention: John Reynolds; Sarah Lee
422
+ Additional communications relating to the role of the third-party representative shall be directed to:
423
+ Gibson, Dunn & Crutcher LLP
424
+ 200 Park Avenue
425
+ New York, New York 10166
426
+ Attention: Jane Smith
427
+ ```
428
+
429
+ **Paragraph 4:**
430
+ ```
431
+ All references to the singular include the plural and vice versa, and all references to any gender include all genders. The Parties agree that any ambiguities in the language of this Agreement shall not be construed against either Party. Section headings used in this Agreement are for reference only and shall not affect the meaning or interpretation of any provision.
432
+ ```
433
+
434
+ ---
435
+
436
+ **Expected Steps and Outputs:**
437
+
438
+ **Step 1 (LLM1):**
439
+ - If no target company is identified:
440
+ ```
441
+ <user_message>Query is not relevant to the intended task.</user_message>
442
+ ```
443
+ - If a target company is identified:
444
+ ```
445
+ The target company is Kirkland & Ellis LLP.
446
+ ```
447
+
448
+ **Step 2 (LLM2 for Paragraphs):**
449
+ - Example Output:
450
+ ```
451
+ Buyer: Ecolab Inc.
452
+ Buyer Representative: Not stated
453
+ Seller: Purolite Corporation
454
+ Seller Representative: Not stated
455
+ Third-Party Representation: Advisory roles, Gibson, Dunn & Crutcher LLP
456
+ Target Company Mentioned: No
457
+ ```
458
+
459
+ **Step 3 (LLM3 Final Output):**
460
+ - Compiled JSON:
461
+ ```json
462
+ {
463
+ "buyer_firm": "Shearman & Sterling LLP",
464
+ "seller_firm": "Cleary Gottlieb Steen & Hamilton LLP",
465
+ "third_party": "Gibson, Dunn & Crutcher LLP",
466
+ "contains_target_firm": false
467
+ }
468
+ ```
469
+ """)
470
 
471
  # Challenge instructions and testing guidance
472
  with gr.Accordion("Task Instructions and Testing", open=False):
473
  gr.Markdown("""
474
+ ---
475
+ **Task Instructions:**
476
+ - Design prompts that ensure proper interaction between the three LLM systems, with each step contributing to the final output.
477
+ - Ensure strict adherence to JSON formatting requirements (e.g., no extra characters that may cause JSON parsing errors).
478
+ - Test extensively to verify accurate law firm and target company identification.
479
+
480
+ **Output Requirements:**
481
+ - Ensure final LLM3 JSON output has the following keys:
482
+ - `"buyer_firm"`
483
+ - `"seller_firm"`
484
+ - `"third_party"`
485
+ - `"contains_target_firm"`
486
+ - Values must be accurately extracted or classified based on LLM2's parsed data.
487
+
488
+ **Hints for Crafting System Prompts:**
489
+ - Explicitly specify formatting requirements at each step.
490
+ - Clarify the task definitions and expected classifications in each system prompt for LLM1, LLM2, and LLM3.
491
+ - Test using diverse sample data for robustness.
492
+ ---
493
+ """)
494
 
495
  gr.Markdown("""
496
+ ---
497
+ ### Submission Instructions
498
 
499
+ Enter your name and email below, as listed in your CV, and submit your designed prompts.
500
 
501
+ You can only submit once, so validate your system prompts thoroughly using mock queries and example data before final submission.
502
 
503
+ **Good Luck!**
 
504
 
505
+ _Remember: Focus on clarity, accuracy, and structured responses to achieve a high score!_
506
+ ---
507
+ """)
508
 
509
  email_input = gr.Textbox(label="Email", placeholder="[email protected]")
510
  name_input = gr.Textbox(label="First Name, Last Name", placeholder="John, Smith")