InformationLiteracySupportTool / lib /fact_summarizer.py
fukufuk
Update application file
59947d3
raw
history blame contribute delete
728 Bytes
from openai import OpenAI
FACT_MESSAGE_FORMAT = """あなたはニュース記事に含まれる意見に惑わされず「事実のみ」をまとめる読解サポーターです。以下の文章をもとに確実に言えることを5つ箇条書きで答えてください。
### 文章
{}
### 回答"""
def fact_summarizer(client: OpenAI, sentence: str, model_name='gpt-4o-mini-2024-07-18'):
message = FACT_MESSAGE_FORMAT.format(sentence)
response = client.chat.completions.create(
messages=[
{
"role": "user",
"content": message
}
],
model=model_name,
temperature=0
)
return response.choices[0].message.content