Skip to content

Commit 2d67a5a

Browse files
committed
[DERCBOT-1609] Add chat history on RAG prompt
1 parent 16806fd commit 2d67a5a

File tree

6 files changed

+153
-93
lines changed

6 files changed

+153
-93
lines changed

bot/admin/web/src/app/rag/rag-settings/models/engines-configurations.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@ import {
2727
PromptDefinitionFormatter
2828
} from '../../../shared/model/ai-settings';
2929

30-
export const QuestionCondensingDefaultPrompt: string = `Given a chat history and the latest user question which might reference context in the chat history, formulate a standalone question which can be understood without the chat history. Do NOT answer the question, just reformulate it if needed and otherwise return it as is.`;
30+
export const QuestionCondensingDefaultPrompt: string = `You are a helpful assistant that reformulates questions.
31+
32+
You are given:
33+
- The conversation history between the user and the assistant
34+
- The most recent user question
35+
36+
Your task:
37+
- Reformulate the user’s latest question into a clear, standalone query.
38+
- Incorporate relevant context from the conversation history.
39+
- Do NOT answer the question.
40+
- If the history does not provide additional context, keep the question as is.
41+
42+
Return only the reformulated question.`;
3143

3244
export const QuestionAnsweringDefaultPrompt: string = `# TOCK (The Open Conversation Kit) chatbot
3345

bot/engine/src/main/kotlin/engine/config/RAGAnswerHandler.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ private val technicalErrorMessage = property(
4747
name = "tock_gen_ai_orchestrator_technical_error",
4848
defaultValue = "Technical error :( sorry!")
4949

50-
// TODO MASS: Doit on enlever le champ NO_RAG_SENTENCE et la story associée de la config RAG (sudio Tock)?
51-
// TODO MASS: Il faudra changer tout les prompts
5250

5351
object RAGAnswerHandler : AbstractProactiveAnswerHandler {
5452

gen-ai/orchestrator-client/src/main/kotlin/ai/tock/genai/orchestratorclient/responses/models.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package ai.tock.genai.orchestratorclient.responses
1818

1919

2020
data class ChunkSentences(
21-
val chunk: Int,
22-
val sentences: List<String> = emptyList(),
21+
val chunk: String? = null,
22+
val sentences: List<String>? = emptyList(),
2323
val reason: String? = null,
2424
)
2525

gen-ai/orchestrator-core/src/main/kotlin/ai/tock/genai/orchestratorcore/models/llm/OllamaLLMSetting.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ data class OllamaLLMSetting<T>(
2828
}
2929
}
3030

31-
// TODO MASS : Check Compile + TU (car dernier commit)

gen-ai/orchestrator-server/src/main/python/server/src/gen_ai_orchestrator/models/rag/rag_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class Footnote(Source):
5353
identifier: str = Field(description='Footnote identifier', examples=['1'])
5454

5555
class ChunkSentences(BaseModel):
56-
chunk: int
57-
sentences: List[str] = []
56+
chunk: Optional[str] = None
57+
sentences: Optional[List[str]] = None
5858
reason: Optional[str] = None
5959

6060
class LLMAnswer(BaseModel):

0 commit comments

Comments
 (0)