From 50b6a30647ec1a77160512f65eed4dc86689c14b Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Thu, 1 Feb 2024 19:23:43 +0100 Subject: [PATCH] fix: added another example without link --- main.py | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index ef42eb4..df7723d 100755 --- a/main.py +++ b/main.py @@ -15,7 +15,7 @@ HTML_EXAMPLE_1 = r"""

Geometric Representation Theory. ICM Satellite Conference
Organized by Tomoyuki Arakawa (RIMS, Kyoto, Japan), Joel Kamnitzer (University of Toronto, Japan), Hiraku Nakajima (Kavli IPMU, Japan), Markus Reineke (Ruhr-Universität Bochum), Francesco Sala, and Vera Serganova (University of California Berkeley, USA). Online. June 27 – July 2, 2022.

""" + + +OUTPUT_EXAMPLE_3 = json.dumps({ + "title": "Geometric Representation Theory. ICM Satellite Conference", + "url": None, + "description": "Organized by Tomoyuki Arakawa (RIMS, Kyoto, Japan), Joel Kamnitzer (University of Toronto, Japan), Hiraku Nakajima (Kavli IPMU, Japan), Markus Reineke (Ruhr-Universität Bochum), Francesco Sala, and Vera Serganova (University of California Berkeley, USA).\n\nLocation: Online", + "startDate": "2022-06-27", + "endDate": "2022-07-02", +}) + + def translate_to_json(conference_html: str) -> str: llm_answer = llm.create_chat_completion( max_tokens=None, @@ -41,17 +53,25 @@ def translate_to_json(conference_html: str) -> str: "role": "system", "content": "You are an assistant helping a developer converting raw text data to JSON. Be precise in formatting the output and only output valid JSON using the specificied fields, without including any additional fields or comments", }, - {"role": "user", "content": "INPUT:"}, - {"role": "user", "content": HTML_EXAMPLE_1 }, - {"role": "user", "content": "OUTPUT JSON:"}, - {"role": "user", "content": OUTPUT_EXAMPLE_1}, - {"role": "user", "content": "INPUT:"}, - {"role": "user", "content": HTML_EXAMPLE_2 }, - {"role": "user", "content": "OUTPUT JSON:"}, - {"role": "user", "content": OUTPUT_EXAMPLE_2}, - {"role": "user", "content": "INPUT:"}, - {"role": "user", "content": conference_html }, - {"role": "user", "content": "OUTPUT JSON:"}, + # Example 1 + { "role": "user", "content": "INPUT:" }, + { "role": "user", "content": HTML_EXAMPLE_1 }, + { "role": "user", "content": "OUTPUT JSON:" }, + { "role": "user", "content": OUTPUT_EXAMPLE_1 }, + # Example 2 + { "role": "user", "content": "INPUT:" }, + { "role": "user", "content": HTML_EXAMPLE_2 }, + { "role": "user", "content": "OUTPUT JSON:" }, + { "role": "user", "content": OUTPUT_EXAMPLE_2 }, + # Example 3 + { "role": "user", "content": "INPUT:" }, + { "role": "user", "content": HTML_EXAMPLE_3 }, + { "role": "user", "content": "OUTPUT JSON:" }, + { "role": "user", "content": OUTPUT_EXAMPLE_3 }, + # Actual item to process + { "role": "user", "content": "INPUT:" }, + { "role": "user", "content": conference_html }, + { "role": "user", "content": "OUTPUT JSON:" }, ], )