From 4112db57d35ea8bda93632212f9de3eaa03cb9e7 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Thu, 26 Oct 2023 17:43:34 +0200 Subject: [PATCH] Make generation prompt more robust + change default question in front-end --- chains.py | 14 +++++++------- front-end/src/App.svelte | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chains.py b/chains.py index e0d563de..69002d60 100644 --- a/chains.py +++ b/chains.py @@ -175,23 +175,23 @@ def generate_ticket(neo4j_graph, llm_chain, input_question): # Ask LLM to generate new question in the same style questions_prompt = "" for i, question in enumerate(questions, start=1): - questions_prompt += f"{i}. {question[0]}\n" - questions_prompt += f"{question[1]}\n\n" + questions_prompt += f"{i}. \n{question[0]}\n----\n\n" + questions_prompt += f"{question[1][:150]}\n\n" questions_prompt += "----\n\n" gen_system_template = f""" You're an expert in formulating high quality questions. - Can you formulate a question in the same style, detail and tone as the following example questions? + Formulate a question in the same style and tone as the following example questions. {questions_prompt} --- Don't make anything up, only use information in the following question. Return a title for the question, and the question post itself. - Return example: + Return format template: --- - Title: How do I use the Neo4j Python driver? - Question: I'm trying to connect to Neo4j using the Python driver, but I'm getting an error. + Title: This is a new title + Question: This is a new question --- """ # we need jinja2 since the questions themselves contain curly braces @@ -203,7 +203,7 @@ def generate_ticket(neo4j_graph, llm_chain, input_question): system_prompt, SystemMessagePromptTemplate.from_template( """ - Respond in the following format or you will be unplugged. + Respond in the following template format or you will be unplugged. --- Title: New title Question: New question diff --git a/front-end/src/App.svelte b/front-end/src/App.svelte index a5973c66..e55661c4 100644 --- a/front-end/src/App.svelte +++ b/front-end/src/App.svelte @@ -10,7 +10,7 @@ import { generationStore } from "./lib/generation.store"; let ragMode = false; - let question = "How summarize PDFs using langchain?"; + let question = "How can I calculate age from date of birth in Cypher?"; let shouldAutoScroll = true; let input; let senderImages = { bot: botImage, me: meImage };