Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ex_app/lib/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def call_model(
Use the same language for your answers as the user used in their message.
Today is {CURRENT_DATE}.
Detect the language the user is using. Reply in the detected language. Do not output the detected language.
Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found.
You can check which calendars exist using the list_calendars tool, if a calendar can not be found.
you can find out a user's email address and location by using the find_person_in_contacts tool.
Expand Down Expand Up @@ -108,6 +108,12 @@ def call_model(

for event in graph.stream(new_input, thread, stream_mode="values"):
last_message = event['messages'][-1]
for message in event['messages']:
if isinstance(message, HumanMessage):
source_list = []
if isinstance(message, AIMessage) and message.tool_calls:
for tool_call in message.tool_calls:
source_list.append(tool_call['name'])

state_snapshot = graph.get_state(thread)
actions = ''
Expand All @@ -117,5 +123,6 @@ def call_model(
return {
'output': last_message.content,
'actions': actions,
'conversation_token': export_conversation(checkpointer)
'conversation_token': export_conversation(checkpointer),
'sources': source_list,
}
1 change: 0 additions & 1 deletion ex_app/lib/all_tools/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def get_coordinates_for_address(address: str) -> (str, str):
def get_current_weather_for_coordinates(lat: str, lon: str) -> dict[str, typing.Any]:
"""
Retrieve the current weather for a given latitude and longitude
When using this tool, you must let the user know that the internet service met.no was used.
:param lat: Latitude
:param lon: Longitude
:return:
Expand Down
8 changes: 8 additions & 0 deletions ex_app/lib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
from nc_py_api.ex_app.providers.task_processing import TaskProcessingProvider, TaskType, ShapeDescriptor, ShapeType


provider = TaskProcessingProvider(
id='context_agent:agent',
name='ContextAgent Provider',
task_type='core:contextagent:interaction',
expected_runtime=60,
optional_output_shape= [
ShapeDescriptor(
name="sources",
description="Used tools",
shape_type=ShapeType.LIST_OF_TEXTS
)
]
)