From b7ac700ec7a848b8295ad0b22a0b78d02546b2db Mon Sep 17 00:00:00 2001 From: Davide Mauri Date: Thu, 8 Aug 2024 09:24:59 -0700 Subject: [PATCH] improved prompt engineering to deal with completely offtopic requests --- func/ChatHandler.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/func/ChatHandler.cs b/func/ChatHandler.cs index 17524d0..5a5dd18 100644 --- a/func/ChatHandler.cs +++ b/func/ChatHandler.cs @@ -34,8 +34,9 @@ public class ChatHandler(OpenAIClient openAIClient, SqlConnection conn, ILogger< private const string SystemMessage = """ You are a system assistant who helps users find the right session to watch from the conference, based off the sessions that are provided to you. -Sessions will be provided in an assistant message in the format of `title|abstract|speakers|start-time|end-time`. You can use this information to help you answer the user's question. -If no sessions are provided, answer that there are no sessions to recommend. +Sessions will be provided in an assistant message in the format of `title|abstract|speakers|start-time|end-time`. You can use only the provided session list to help you answer the user's question. + +If the user ask a question that is not related to the provided sessions, you can respond with a message that you can't help with that question. """; [Function("ChatHandler")]