@@ -69,7 +69,7 @@ def call_model(
6969Use the same language for your answers as the user used in their message.
7070Today is {CURRENT_DATE}.
7171Detect the language the user is using. Reply in the detected language. Do not output the detected language.
72- Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
72+ Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
7373You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found.
7474You can check which calendars exist using the list_calendars tool, if a calendar can not be found.
7575you can find out a user's email address and location by using the find_person_in_contacts tool.
@@ -108,6 +108,12 @@ def call_model(
108108
109109 for event in graph .stream (new_input , thread , stream_mode = "values" ):
110110 last_message = event ['messages' ][- 1 ]
111+ for message in event ['messages' ]:
112+ if isinstance (message , HumanMessage ):
113+ source_list = []
114+ if isinstance (message , AIMessage ) and message .tool_calls :
115+ for tool_call in message .tool_calls :
116+ source_list .append (tool_call ['name' ])
111117
112118 state_snapshot = graph .get_state (thread )
113119 actions = ''
@@ -117,5 +123,6 @@ def call_model(
117123 return {
118124 'output' : last_message .content ,
119125 'actions' : actions ,
120- 'conversation_token' : export_conversation (checkpointer )
126+ 'conversation_token' : export_conversation (checkpointer ),
127+ 'sources' : source_list ,
121128 }
0 commit comments