@@ -60,7 +60,14 @@ def test_graphrag_happy_path(
6060 )
6161
6262 llm .invoke .assert_called_once_with (
63- """Context:
63+ [
64+ {
65+ "role" : "system" ,
66+ "content" : "Answer the user question using the provided context." ,
67+ },
68+ {
69+ "role" : "user" ,
70+ "content" : """Context:
6471<Record node={'question': 'In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance'}>
6572<Record node={'question': 'This organ removes excess glucose from the blood & stores it as glycogen'}>
6673
@@ -72,8 +79,8 @@ def test_graphrag_happy_path(
7279
7380Answer:
7481""" ,
75- None ,
76- system_instruction = "Answer the user question using the provided context." ,
82+ } ,
83+ ]
7784 )
7885 assert isinstance (result , RagResultModel )
7986 assert result .answer == "some text"
@@ -148,13 +155,21 @@ def test_graphrag_happy_path_with_neo4j_message_history(
148155 llm .invoke .assert_has_calls (
149156 [
150157 call (
151- input = first_invocation_input ,
152- system_instruction = first_invocation_system_instruction ,
158+ [
159+ {"role" : "system" , "content" : first_invocation_system_instruction },
160+ {"role" : "user" , "content" : first_invocation_input },
161+ ]
153162 ),
154163 call (
155- second_invocation ,
156- message_history .messages ,
157- system_instruction = "Answer the user question using the provided context." ,
164+ [
165+ {
166+ "role" : "system" ,
167+ "content" : "Answer the user question using the provided context." ,
168+ },
169+ {"role" : "user" , "content" : "initial question" },
170+ {"role" : "assistant" , "content" : "answer to initial question" },
171+ {"role" : "user" , "content" : second_invocation },
172+ ]
158173 ),
159174 ]
160175 )
@@ -190,7 +205,14 @@ def test_graphrag_happy_path_return_context(
190205 )
191206
192207 llm .invoke .assert_called_once_with (
193- """Context:
208+ [
209+ {
210+ "role" : "system" ,
211+ "content" : "Answer the user question using the provided context." ,
212+ },
213+ {
214+ "role" : "user" ,
215+ "content" : """Context:
194216<Record node={'question': 'In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance'}>
195217<Record node={'question': 'This organ removes excess glucose from the blood & stores it as glycogen'}>
196218
@@ -202,8 +224,8 @@ def test_graphrag_happy_path_return_context(
202224
203225Answer:
204226""" ,
205- None ,
206- system_instruction = "Answer the user question using the provided context." ,
227+ } ,
228+ ] ,
207229 )
208230 assert isinstance (result , RagResultModel )
209231 assert result .answer == "some text"
@@ -236,7 +258,14 @@ def test_graphrag_happy_path_examples(
236258 )
237259
238260 llm .invoke .assert_called_once_with (
239- """Context:
261+ [
262+ {
263+ "role" : "system" ,
264+ "content" : "Answer the user question using the provided context." ,
265+ },
266+ {
267+ "role" : "user" ,
268+ "content" : """Context:
240269<Record node={'question': 'In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance'}>
241270<Record node={'question': 'This organ removes excess glucose from the blood & stores it as glycogen'}>
242271
@@ -248,8 +277,8 @@ def test_graphrag_happy_path_examples(
248277
249278Answer:
250279""" ,
251- None ,
252- system_instruction = "Answer the user question using the provided context." ,
280+ } ,
281+ ]
253282 )
254283 assert result .answer == "some text"
255284
0 commit comments