2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ChatGPTボットはメンションしなくたって返事してくれるもんさ

Posted at

ChatGPTを使ったチャットボットは面白いけどいちいちメンションするのめんどくさいじゃないですか。普通の人間みたく返信するかどうか本人に考えさせましょ。こんな感じで。

2023-04-23_14h16_52.png

プログラムはこんな。過去の履歴を突っ込んで返信する必要があればYESと返させます。

    def should_reply(self, messages):
        prompt = ""
        for m in messages:
            prompt += f"{m['user']}:{m['text']}\n"
        prompt += f"\nあなたは{self.bot_id}というチャットAIでこれまでこのように会話をしてきました。会話に返信する必要があると思う場合はYESと答えてください。お礼を言われた場合も返信する必要があるためYESと答えてください。"
        answer = get_chatgpt(user_content=prompt, temperature=TEMPERATURE_STRICT)
        return "YES" in answer
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?