Skip to content

Commit

Permalink
Make generation prompt more robust
Browse files Browse the repository at this point in the history
+ change default question in front-end
  • Loading branch information
oskarhane committed Oct 26, 2023
1 parent ed5d1a0 commit 4112db5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 4112db5

Please sign in to comment.