fix: added another example

main
Antonio De Lucreziis 9 months ago
parent d0964e06a3
commit 35ca59c6df

@ -9,10 +9,10 @@ import json
OUTPUT_FILE = "results.json"
HTML_EXAMPLE = r"""<p><a href="http://www.crm.sns.it/event/507/" target="_blank" rel="noreferrer noopener">Statistical and Computational Aspects of Dynamics<br></a>Organized by Buddhima Kasun Fernando Akurugodage (Centro di ricerca matematica Ennio De Giorgi &#8211; SNS), Paolo Giulietti, and Tanja Isabelle Schindler (Universität Wien, Austria). Centro De Giorgi &#8211; SNS, Pisa. December 13 &#8211; 16, 2022.</p>"""
HTML_EXAMPLE_1 = r"""<p><a href="http://www.crm.sns.it/event/507/" target="_blank" rel="noreferrer noopener">Statistical and Computational Aspects of Dynamics<br></a>Organized by Buddhima Kasun Fernando Akurugodage (Centro di ricerca matematica Ennio De Giorgi &#8211; SNS), Paolo Giulietti, and Tanja Isabelle Schindler (Universität Wien, Austria). Centro De Giorgi &#8211; SNS, Pisa. December 13 &#8211; 16, 2022.</p>"""
OUTPUT_EXAMPLE = json.dumps({
OUTPUT_EXAMPLE_1 = json.dumps({
"title": "Statistical and Computational Aspects of Dynamics",
"url": "http://www.crm.sns.it/event/507/",
"description": "Organized by Buddhima Kasun Fernando Akurugodage (Centro di ricerca matematica Ennio De Giorgi SNS), Paolo Giulietti, and Tanja Isabelle Schindler (Universität Wien, Austria). Location: Centro De Giorgi - SNS, Pisa.",
@ -21,6 +21,18 @@ OUTPUT_EXAMPLE = json.dumps({
})
HTML_EXAMPLE_2 = r"""<p><em><a href="http://pagine.dm.unipi.it/berselli/meeting2020/" rel="noreferrer noopener" target="_blank">Workshop on Variational problems, PDEs and applications<br/></a></em>Organized by Luigi Berselli, Giuseppe Buttazzo, Matteo Novaga, and Andrea Malchiodi (Scuola Normale Superiore, Pisa). Department of Mathematics, Pisa. January 17 18, 2020.</p>"""
OUTPUT_EXAMPLE_2 = json.dumps({
"title": "Workshop on Variational problems, PDEs and applications",
"url": "http://pagine.dm.unipi.it/berselli/meeting2020/",
"description": "Organized by Luigi Berselli, Giuseppe Buttazzo, Matteo Novaga, and Andrea Malchiodi (Scuola Normale Superiore, Pisa). Location: Department of Mathematics, Pisa.",
"startDate": "2020-01-17",
"endDate": "2020-01-18",
})
def translate_to_json(conference_html: str) -> str:
llm_answer = llm.create_chat_completion(
max_tokens=None,
@ -30,9 +42,13 @@ def translate_to_json(conference_html: str) -> str:
"content": "You are an assistant. Be precise in formatting the output and only output valid JSON using the specificied fields, without including additional fields or comments.",
},
{"role": "user", "content": "INPUT:"},
{"role": "user", "content": HTML_EXAMPLE },
{"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},
{"role": "user", "content": OUTPUT_EXAMPLE_2},
{"role": "user", "content": "INPUT:"},
{"role": "user", "content": conference_html },
{"role": "user", "content": "OUTPUT JSON:"},

Loading…
Cancel
Save