nvidia-nat 1.3.0rc2__py3-none-any.whl → 1.3.0rc4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nat/agent/react_agent/register.py +15 -24
- nat/agent/rewoo_agent/register.py +15 -24
- nat/agent/tool_calling_agent/register.py +9 -5
- nat/builder/component_utils.py +1 -1
- nat/builder/function.py +4 -4
- nat/builder/workflow_builder.py +46 -3
- nat/cli/entrypoint.py +9 -1
- nat/data_models/api_server.py +120 -1
- nat/data_models/config.py +1 -1
- nat/data_models/thinking_mixin.py +2 -2
- nat/experimental/test_time_compute/functions/execute_score_select_function.py +1 -1
- nat/experimental/test_time_compute/functions/ttc_tool_wrapper_function.py +2 -2
- nat/front_ends/console/console_front_end_plugin.py +11 -2
- nat/front_ends/fastapi/auth_flow_handlers/http_flow_handler.py +1 -1
- nat/front_ends/fastapi/message_handler.py +65 -40
- nat/front_ends/fastapi/message_validator.py +1 -2
- nat/front_ends/mcp/mcp_front_end_config.py +32 -0
- nat/observability/register.py +16 -0
- nat/runtime/runner.py +1 -2
- nat/runtime/session.py +1 -1
- nat/tool/memory_tools/add_memory_tool.py +3 -3
- nat/tool/memory_tools/delete_memory_tool.py +3 -4
- nat/tool/memory_tools/get_memory_tool.py +3 -3
- nat/utils/type_converter.py +8 -0
- nvidia_nat-1.3.0rc4.dist-info/METADATA +195 -0
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/RECORD +31 -31
- nvidia_nat-1.3.0rc2.dist-info/METADATA +0 -389
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/entry_points.txt +0 -0
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat-1.3.0rc2.dist-info → nvidia_nat-1.3.0rc4.dist-info}/top_level.txt +0 -0
|
@@ -25,6 +25,7 @@ from pydantic import ValidationError
|
|
|
25
25
|
from starlette.websockets import WebSocketDisconnect
|
|
26
26
|
|
|
27
27
|
from nat.authentication.interfaces import FlowHandlerBase
|
|
28
|
+
from nat.data_models.api_server import ChatRequest
|
|
28
29
|
from nat.data_models.api_server import ChatResponse
|
|
29
30
|
from nat.data_models.api_server import ChatResponseChunk
|
|
30
31
|
from nat.data_models.api_server import Error
|
|
@@ -33,6 +34,8 @@ from nat.data_models.api_server import ResponsePayloadOutput
|
|
|
33
34
|
from nat.data_models.api_server import ResponseSerializable
|
|
34
35
|
from nat.data_models.api_server import SystemResponseContent
|
|
35
36
|
from nat.data_models.api_server import TextContent
|
|
37
|
+
from nat.data_models.api_server import UserMessageContentRoleType
|
|
38
|
+
from nat.data_models.api_server import UserMessages
|
|
36
39
|
from nat.data_models.api_server import WebSocketMessageStatus
|
|
37
40
|
from nat.data_models.api_server import WebSocketMessageType
|
|
38
41
|
from nat.data_models.api_server import WebSocketSystemInteractionMessage
|
|
@@ -64,12 +67,12 @@ class WebSocketMessageHandler:
|
|
|
64
67
|
self._running_workflow_task: asyncio.Task | None = None
|
|
65
68
|
self._message_parent_id: str = "default_id"
|
|
66
69
|
self._conversation_id: str | None = None
|
|
67
|
-
self._workflow_schema_type: str = None
|
|
68
|
-
self._user_interaction_response: asyncio.Future[
|
|
70
|
+
self._workflow_schema_type: str | None = None
|
|
71
|
+
self._user_interaction_response: asyncio.Future[TextContent] | None = None
|
|
69
72
|
|
|
70
73
|
self._flow_handler: FlowHandlerBase | None = None
|
|
71
74
|
|
|
72
|
-
self._schema_output_mapping: dict[str, type[BaseModel] | None] = {
|
|
75
|
+
self._schema_output_mapping: dict[str, type[BaseModel] | type[None]] = {
|
|
73
76
|
WorkflowSchemaType.GENERATE: self._session_manager.workflow.single_output_schema,
|
|
74
77
|
WorkflowSchemaType.CHAT: ChatResponse,
|
|
75
78
|
WorkflowSchemaType.CHAT_STREAM: ChatResponseChunk,
|
|
@@ -114,36 +117,58 @@ class WebSocketMessageHandler:
|
|
|
114
117
|
pass
|
|
115
118
|
|
|
116
119
|
elif (isinstance(validated_message, WebSocketUserInteractionResponseMessage)):
|
|
117
|
-
user_content = await self.
|
|
120
|
+
user_content = await self._process_websocket_user_interaction_response_message(validated_message)
|
|
121
|
+
assert self._user_interaction_response is not None
|
|
118
122
|
self._user_interaction_response.set_result(user_content)
|
|
119
123
|
except (asyncio.CancelledError, WebSocketDisconnect):
|
|
120
124
|
# TODO: Handle the disconnect
|
|
121
125
|
break
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
self, user_content: WebSocketUserMessage | WebSocketUserInteractionResponseMessage) -> BaseModel | None:
|
|
127
|
+
def _extract_last_user_message_content(self, messages: list[UserMessages]) -> TextContent:
|
|
125
128
|
"""
|
|
126
|
-
|
|
129
|
+
Extracts the last user's TextContent from a list of messages.
|
|
127
130
|
|
|
128
|
-
:
|
|
129
|
-
|
|
130
|
-
"""
|
|
131
|
+
Args:
|
|
132
|
+
messages: List of UserMessages.
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
Returns:
|
|
135
|
+
TextContent object from the last user message.
|
|
134
136
|
|
|
137
|
+
Raises:
|
|
138
|
+
ValueError: If no user text content is found.
|
|
139
|
+
"""
|
|
140
|
+
for user_message in messages[::-1]:
|
|
141
|
+
if user_message.role == UserMessageContentRoleType.USER:
|
|
135
142
|
for attachment in user_message.content:
|
|
136
|
-
|
|
137
143
|
if isinstance(attachment, TextContent):
|
|
138
144
|
return attachment
|
|
145
|
+
raise ValueError("No user text content found in messages.")
|
|
146
|
+
|
|
147
|
+
async def _process_websocket_user_interaction_response_message(
|
|
148
|
+
self, user_content: WebSocketUserInteractionResponseMessage) -> TextContent:
|
|
149
|
+
"""
|
|
150
|
+
Processes a WebSocketUserInteractionResponseMessage.
|
|
151
|
+
"""
|
|
152
|
+
return self._extract_last_user_message_content(user_content.content.messages)
|
|
139
153
|
|
|
140
|
-
|
|
154
|
+
async def _process_websocket_user_message(self, user_content: WebSocketUserMessage) -> ChatRequest | str:
|
|
155
|
+
"""
|
|
156
|
+
Processes a WebSocketUserMessage based on schema type.
|
|
157
|
+
"""
|
|
158
|
+
if self._workflow_schema_type in [WorkflowSchemaType.CHAT, WorkflowSchemaType.CHAT_STREAM]:
|
|
159
|
+
return ChatRequest(**user_content.content.model_dump(include={"messages"}))
|
|
160
|
+
|
|
161
|
+
elif self._workflow_schema_type in [WorkflowSchemaType.GENERATE, WorkflowSchemaType.GENERATE_STREAM]:
|
|
162
|
+
return self._extract_last_user_message_content(user_content.content.messages).text
|
|
163
|
+
|
|
164
|
+
raise ValueError("Unsupported workflow schema type for WebSocketUserMessage")
|
|
141
165
|
|
|
142
166
|
async def process_workflow_request(self, user_message_as_validated_type: WebSocketUserMessage) -> None:
|
|
143
167
|
"""
|
|
144
168
|
Process user messages and routes them appropriately.
|
|
145
169
|
|
|
146
|
-
:
|
|
170
|
+
Args:
|
|
171
|
+
user_message_as_validated_type (WebSocketUserMessage): The validated user message to process.
|
|
147
172
|
"""
|
|
148
173
|
|
|
149
174
|
try:
|
|
@@ -151,18 +176,15 @@ class WebSocketMessageHandler:
|
|
|
151
176
|
self._workflow_schema_type = user_message_as_validated_type.schema_type
|
|
152
177
|
self._conversation_id = user_message_as_validated_type.conversation_id
|
|
153
178
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if content is None:
|
|
157
|
-
raise ValueError(f"User message content could not be found: {user_message_as_validated_type}")
|
|
179
|
+
message_content: typing.Any = await self._process_websocket_user_message(user_message_as_validated_type)
|
|
158
180
|
|
|
159
|
-
if
|
|
181
|
+
if (self._running_workflow_task is None):
|
|
160
182
|
|
|
161
|
-
def _done_callback(
|
|
183
|
+
def _done_callback(_task: asyncio.Task):
|
|
162
184
|
self._running_workflow_task = None
|
|
163
185
|
|
|
164
186
|
self._running_workflow_task = asyncio.create_task(
|
|
165
|
-
self._run_workflow(payload=
|
|
187
|
+
self._run_workflow(payload=message_content,
|
|
166
188
|
user_message_id=self._message_parent_id,
|
|
167
189
|
conversation_id=self._conversation_id,
|
|
168
190
|
result_type=self._schema_output_mapping[self._workflow_schema_type],
|
|
@@ -180,13 +202,14 @@ class WebSocketMessageHandler:
|
|
|
180
202
|
async def create_websocket_message(self,
|
|
181
203
|
data_model: BaseModel,
|
|
182
204
|
message_type: str | None = None,
|
|
183
|
-
status:
|
|
205
|
+
status: WebSocketMessageStatus = WebSocketMessageStatus.IN_PROGRESS) -> None:
|
|
184
206
|
"""
|
|
185
207
|
Creates a websocket message that will be ready for routing based on message type or data model.
|
|
186
208
|
|
|
187
|
-
:
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
Args:
|
|
210
|
+
data_model (BaseModel): Message content model.
|
|
211
|
+
message_type (str | None): Message content model.
|
|
212
|
+
status (WebSocketMessageStatus): Message content model.
|
|
190
213
|
"""
|
|
191
214
|
try:
|
|
192
215
|
message: BaseModel | None = None
|
|
@@ -196,8 +219,8 @@ class WebSocketMessageHandler:
|
|
|
196
219
|
|
|
197
220
|
message_schema: type[BaseModel] = await self._message_validator.get_message_schema_by_type(message_type)
|
|
198
221
|
|
|
199
|
-
if 'id'
|
|
200
|
-
message_id: str = data_model
|
|
222
|
+
if hasattr(data_model, 'id'):
|
|
223
|
+
message_id: str = str(getattr(data_model, 'id'))
|
|
201
224
|
else:
|
|
202
225
|
message_id = str(uuid.uuid4())
|
|
203
226
|
|
|
@@ -253,12 +276,15 @@ class WebSocketMessageHandler:
|
|
|
253
276
|
Registered human interaction callback that processes human interactions and returns
|
|
254
277
|
responses from websocket connection.
|
|
255
278
|
|
|
256
|
-
:
|
|
257
|
-
|
|
279
|
+
Args:
|
|
280
|
+
prompt: Incoming interaction content data model.
|
|
281
|
+
|
|
282
|
+
Returns:
|
|
283
|
+
A Text Content Base Pydantic model.
|
|
258
284
|
"""
|
|
259
285
|
|
|
260
286
|
# First create a future from the loop for the human response
|
|
261
|
-
human_response_future: asyncio.Future[
|
|
287
|
+
human_response_future: asyncio.Future[TextContent] = asyncio.get_running_loop().create_future()
|
|
262
288
|
|
|
263
289
|
# Then add the future to the outstanding human prompts dictionary
|
|
264
290
|
self._user_interaction_response = human_response_future
|
|
@@ -274,10 +300,10 @@ class WebSocketMessageHandler:
|
|
|
274
300
|
return HumanResponseNotification()
|
|
275
301
|
|
|
276
302
|
# Wait for the human response future to complete
|
|
277
|
-
|
|
303
|
+
text_content: TextContent = await human_response_future
|
|
278
304
|
|
|
279
305
|
interaction_response: HumanResponse = await self._message_validator.convert_text_content_to_human_response(
|
|
280
|
-
|
|
306
|
+
text_content, prompt.content)
|
|
281
307
|
|
|
282
308
|
return interaction_response
|
|
283
309
|
|
|
@@ -293,13 +319,12 @@ class WebSocketMessageHandler:
|
|
|
293
319
|
output_type: type | None = None) -> None:
|
|
294
320
|
|
|
295
321
|
try:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if self._flow_handler else None)) as session:
|
|
322
|
+
auth_callback = self._flow_handler.authenticate if self._flow_handler else None
|
|
323
|
+
async with self._session_manager.session(user_message_id=user_message_id,
|
|
324
|
+
conversation_id=conversation_id,
|
|
325
|
+
http_connection=self._socket,
|
|
326
|
+
user_input_callback=self.human_interaction_callback,
|
|
327
|
+
user_authentication_callback=auth_callback) as session:
|
|
303
328
|
|
|
304
329
|
async for value in generate_streaming_response(payload,
|
|
305
330
|
session_manager=session,
|
|
@@ -240,8 +240,7 @@ class MessageValidator:
|
|
|
240
240
|
thread_id: str = "default",
|
|
241
241
|
parent_id: str = "default",
|
|
242
242
|
conversation_id: str | None = None,
|
|
243
|
-
content: SystemResponseContent
|
|
244
|
-
| Error = SystemResponseContent(),
|
|
243
|
+
content: SystemResponseContent | Error = SystemResponseContent(),
|
|
245
244
|
status: WebSocketMessageStatus = WebSocketMessageStatus.IN_PROGRESS,
|
|
246
245
|
timestamp: str = str(datetime.datetime.now(datetime.UTC))
|
|
247
246
|
) -> WebSocketSystemResponseTokenMessage | None:
|
|
@@ -13,13 +13,17 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import logging
|
|
16
17
|
from typing import Literal
|
|
17
18
|
|
|
18
19
|
from pydantic import Field
|
|
20
|
+
from pydantic import model_validator
|
|
19
21
|
|
|
20
22
|
from nat.authentication.oauth2.oauth2_resource_server_config import OAuth2ResourceServerConfig
|
|
21
23
|
from nat.data_models.front_end import FrontEndBaseConfig
|
|
22
24
|
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
|
|
23
27
|
|
|
24
28
|
class MCPFrontEndConfig(FrontEndBaseConfig, name="mcp"):
|
|
25
29
|
"""MCP front end configuration.
|
|
@@ -43,3 +47,31 @@ class MCPFrontEndConfig(FrontEndBaseConfig, name="mcp"):
|
|
|
43
47
|
|
|
44
48
|
server_auth: OAuth2ResourceServerConfig | None = Field(
|
|
45
49
|
default=None, description=("OAuth 2.0 Resource Server configuration for token verification."))
|
|
50
|
+
|
|
51
|
+
@model_validator(mode="after")
|
|
52
|
+
def validate_security_configuration(self):
|
|
53
|
+
"""Validate security configuration to prevent accidental misconfigurations."""
|
|
54
|
+
# Check if server is bound to a non-localhost interface without authentication
|
|
55
|
+
localhost_hosts = {"localhost", "127.0.0.1", "::1"}
|
|
56
|
+
if self.host not in localhost_hosts and self.server_auth is None:
|
|
57
|
+
logger.warning(
|
|
58
|
+
"MCP server is configured to bind to '%s' without authentication. "
|
|
59
|
+
"This may expose your server to unauthorized access. "
|
|
60
|
+
"Consider either: (1) binding to localhost for local-only access, "
|
|
61
|
+
"or (2) configuring server_auth for production deployments on public interfaces.",
|
|
62
|
+
self.host)
|
|
63
|
+
|
|
64
|
+
# Check if SSE transport is used (which doesn't support authentication)
|
|
65
|
+
if self.transport == "sse":
|
|
66
|
+
if self.server_auth is not None:
|
|
67
|
+
logger.warning("SSE transport does not support authentication. "
|
|
68
|
+
"The configured server_auth will be ignored. "
|
|
69
|
+
"For production use with authentication, use 'streamable-http' transport instead.")
|
|
70
|
+
elif self.host not in localhost_hosts:
|
|
71
|
+
logger.warning(
|
|
72
|
+
"SSE transport does not support authentication and is bound to '%s'. "
|
|
73
|
+
"This configuration is not recommended for production use. "
|
|
74
|
+
"For production deployments, use 'streamable-http' transport with server_auth configured.",
|
|
75
|
+
self.host)
|
|
76
|
+
|
|
77
|
+
return self
|
nat/observability/register.py
CHANGED
|
@@ -77,6 +77,14 @@ async def console_logging_method(config: ConsoleLoggingMethodConfig, builder: Bu
|
|
|
77
77
|
level = getattr(logging, config.level.upper(), logging.INFO)
|
|
78
78
|
handler = logging.StreamHandler(stream=sys.stdout)
|
|
79
79
|
handler.setLevel(level)
|
|
80
|
+
|
|
81
|
+
# Set formatter to match the default CLI format
|
|
82
|
+
formatter = logging.Formatter(
|
|
83
|
+
fmt="%(asctime)s - %(levelname)-8s - %(name)s:%(lineno)d - %(message)s",
|
|
84
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
85
|
+
)
|
|
86
|
+
handler.setFormatter(formatter)
|
|
87
|
+
|
|
80
88
|
yield handler
|
|
81
89
|
|
|
82
90
|
|
|
@@ -95,4 +103,12 @@ async def file_logging_method(config: FileLoggingMethod, builder: Builder):
|
|
|
95
103
|
level = getattr(logging, config.level.upper(), logging.INFO)
|
|
96
104
|
handler = logging.FileHandler(filename=config.path, mode="a", encoding="utf-8")
|
|
97
105
|
handler.setLevel(level)
|
|
106
|
+
|
|
107
|
+
# Set formatter to match the default CLI format
|
|
108
|
+
formatter = logging.Formatter(
|
|
109
|
+
fmt="%(asctime)s - %(levelname)-8s - %(name)s:%(lineno)d - %(message)s",
|
|
110
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
111
|
+
)
|
|
112
|
+
handler.setFormatter(formatter)
|
|
113
|
+
|
|
98
114
|
yield handler
|
nat/runtime/runner.py
CHANGED
|
@@ -196,8 +196,7 @@ class Runner:
|
|
|
196
196
|
|
|
197
197
|
return result
|
|
198
198
|
except Exception as e:
|
|
199
|
-
|
|
200
|
-
logger.error("Error running workflow%s", err_msg)
|
|
199
|
+
logger.error("Error running workflow: %s", e)
|
|
201
200
|
event_stream = self._context_state.event_stream.get()
|
|
202
201
|
if event_stream:
|
|
203
202
|
event_stream.on_complete()
|
nat/runtime/session.py
CHANGED
|
@@ -192,7 +192,7 @@ class SessionManager:
|
|
|
192
192
|
user_message_id: str | None,
|
|
193
193
|
conversation_id: str | None) -> None:
|
|
194
194
|
"""
|
|
195
|
-
Extracts and sets user metadata for
|
|
195
|
+
Extracts and sets user metadata for WebSocket connections.
|
|
196
196
|
"""
|
|
197
197
|
|
|
198
198
|
# Extract cookies from WebSocket headers (similar to HTTP request)
|
|
@@ -30,10 +30,10 @@ logger = logging.getLogger(__name__)
|
|
|
30
30
|
class AddToolConfig(FunctionBaseConfig, name="add_memory"):
|
|
31
31
|
"""Function to add memory to a hosted memory platform."""
|
|
32
32
|
|
|
33
|
-
description: str = Field(default=("Tool to add memory about a user's interactions to a system "
|
|
33
|
+
description: str = Field(default=("Tool to add a memory about a user's interactions to a system "
|
|
34
34
|
"for retrieval later."),
|
|
35
35
|
description="The description of this function's use for tool calling agents.")
|
|
36
|
-
memory: MemoryRef = Field(default="saas_memory",
|
|
36
|
+
memory: MemoryRef = Field(default=MemoryRef("saas_memory"),
|
|
37
37
|
description=("Instance name of the memory client instance from the workflow "
|
|
38
38
|
"configuration object."))
|
|
39
39
|
|
|
@@ -46,7 +46,7 @@ async def add_memory_tool(config: AddToolConfig, builder: Builder):
|
|
|
46
46
|
from langchain_core.tools import ToolException
|
|
47
47
|
|
|
48
48
|
# First, retrieve the memory client
|
|
49
|
-
memory_editor = builder.get_memory_client(config.memory)
|
|
49
|
+
memory_editor = await builder.get_memory_client(config.memory)
|
|
50
50
|
|
|
51
51
|
async def _arun(item: MemoryItem) -> str:
|
|
52
52
|
"""
|
|
@@ -30,10 +30,9 @@ logger = logging.getLogger(__name__)
|
|
|
30
30
|
class DeleteToolConfig(FunctionBaseConfig, name="delete_memory"):
|
|
31
31
|
"""Function to delete memory from a hosted memory platform."""
|
|
32
32
|
|
|
33
|
-
description: str = Field(default=
|
|
34
|
-
"interactions to help answer questions in a personalized way."),
|
|
33
|
+
description: str = Field(default="Tool to delete a memory from a hosted memory platform.",
|
|
35
34
|
description="The description of this function's use for tool calling agents.")
|
|
36
|
-
memory: MemoryRef = Field(default="saas_memory",
|
|
35
|
+
memory: MemoryRef = Field(default=MemoryRef("saas_memory"),
|
|
37
36
|
description=("Instance name of the memory client instance from the workflow "
|
|
38
37
|
"configuration object."))
|
|
39
38
|
|
|
@@ -47,7 +46,7 @@ async def delete_memory_tool(config: DeleteToolConfig, builder: Builder):
|
|
|
47
46
|
from langchain_core.tools import ToolException
|
|
48
47
|
|
|
49
48
|
# First, retrieve the memory client
|
|
50
|
-
memory_editor = builder.get_memory_client(config.memory)
|
|
49
|
+
memory_editor = await builder.get_memory_client(config.memory)
|
|
51
50
|
|
|
52
51
|
async def _arun(user_id: str) -> str:
|
|
53
52
|
"""
|
|
@@ -30,10 +30,10 @@ logger = logging.getLogger(__name__)
|
|
|
30
30
|
class GetToolConfig(FunctionBaseConfig, name="get_memory"):
|
|
31
31
|
"""Function to get memory to a hosted memory platform."""
|
|
32
32
|
|
|
33
|
-
description: str = Field(default=("Tool to retrieve memory about a user's "
|
|
33
|
+
description: str = Field(default=("Tool to retrieve a memory about a user's "
|
|
34
34
|
"interactions to help answer questions in a personalized way."),
|
|
35
35
|
description="The description of this function's use for tool calling agents.")
|
|
36
|
-
memory: MemoryRef = Field(default="saas_memory",
|
|
36
|
+
memory: MemoryRef = Field(default=MemoryRef("saas_memory"),
|
|
37
37
|
description=("Instance name of the memory client instance from the workflow "
|
|
38
38
|
"configuration object."))
|
|
39
39
|
|
|
@@ -49,7 +49,7 @@ async def get_memory_tool(config: GetToolConfig, builder: Builder):
|
|
|
49
49
|
from langchain_core.tools import ToolException
|
|
50
50
|
|
|
51
51
|
# First, retrieve the memory client
|
|
52
|
-
memory_editor = builder.get_memory_client(config.memory)
|
|
52
|
+
memory_editor = await builder.get_memory_client(config.memory)
|
|
53
53
|
|
|
54
54
|
async def _arun(search_input: SearchMemoryInput) -> str:
|
|
55
55
|
"""
|
nat/utils/type_converter.py
CHANGED
|
@@ -93,6 +93,14 @@ class TypeConverter:
|
|
|
93
93
|
if to_type is None or decomposed.is_instance(data):
|
|
94
94
|
return data
|
|
95
95
|
|
|
96
|
+
# 2) If data is a union type, try to convert to each type in the union
|
|
97
|
+
if decomposed.is_union:
|
|
98
|
+
for union_type in decomposed.args:
|
|
99
|
+
result = self._convert(data, union_type)
|
|
100
|
+
if result is not None:
|
|
101
|
+
return result
|
|
102
|
+
return None
|
|
103
|
+
|
|
96
104
|
root = decomposed.root
|
|
97
105
|
|
|
98
106
|
# 2) Attempt direct in *this* converter
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nvidia-nat
|
|
3
|
+
Version: 1.3.0rc4
|
|
4
|
+
Summary: NVIDIA NeMo Agent toolkit
|
|
5
|
+
Author: NVIDIA Corporation
|
|
6
|
+
Maintainer: NVIDIA Corporation
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: documentation, https://docs.nvidia.com/nemo/agent-toolkit/latest/
|
|
9
|
+
Project-URL: source, https://github.com/NVIDIA/NeMo-Agent-Toolkit
|
|
10
|
+
Keywords: ai,rag,agents
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: <3.14,>=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE-3rd-party.txt
|
|
18
|
+
License-File: LICENSE.md
|
|
19
|
+
Requires-Dist: aioboto3>=11.0.0
|
|
20
|
+
Requires-Dist: authlib~=1.5
|
|
21
|
+
Requires-Dist: click~=8.1
|
|
22
|
+
Requires-Dist: colorama~=0.4.6
|
|
23
|
+
Requires-Dist: datasets~=4.0
|
|
24
|
+
Requires-Dist: expandvars~=1.0
|
|
25
|
+
Requires-Dist: fastapi~=0.115.5
|
|
26
|
+
Requires-Dist: httpx~=0.27
|
|
27
|
+
Requires-Dist: jinja2~=3.1
|
|
28
|
+
Requires-Dist: jsonpath-ng~=1.7
|
|
29
|
+
Requires-Dist: mcp~=1.13
|
|
30
|
+
Requires-Dist: nest-asyncio~=1.6
|
|
31
|
+
Requires-Dist: networkx~=3.4
|
|
32
|
+
Requires-Dist: numpy~=1.26; python_version < "3.12"
|
|
33
|
+
Requires-Dist: numpy~=2.3; python_version >= "3.12"
|
|
34
|
+
Requires-Dist: openinference-semantic-conventions~=0.1.14
|
|
35
|
+
Requires-Dist: openpyxl~=3.1
|
|
36
|
+
Requires-Dist: optuna~=4.4.0
|
|
37
|
+
Requires-Dist: pip>=24.3.1
|
|
38
|
+
Requires-Dist: pkce==1.0.3
|
|
39
|
+
Requires-Dist: pkginfo~=1.12
|
|
40
|
+
Requires-Dist: platformdirs~=4.3
|
|
41
|
+
Requires-Dist: pydantic~=2.11
|
|
42
|
+
Requires-Dist: pymilvus~=2.4
|
|
43
|
+
Requires-Dist: python-dotenv~=1.1.1
|
|
44
|
+
Requires-Dist: PyYAML~=6.0
|
|
45
|
+
Requires-Dist: ragas~=0.2.14
|
|
46
|
+
Requires-Dist: rich~=13.9
|
|
47
|
+
Requires-Dist: tabulate~=0.9
|
|
48
|
+
Requires-Dist: uvicorn[standard]<0.36
|
|
49
|
+
Requires-Dist: wikipedia~=1.4
|
|
50
|
+
Provides-Extra: all
|
|
51
|
+
Requires-Dist: nvidia-nat-all; extra == "all"
|
|
52
|
+
Provides-Extra: adk
|
|
53
|
+
Requires-Dist: nvidia-nat-adk; extra == "adk"
|
|
54
|
+
Provides-Extra: agno
|
|
55
|
+
Requires-Dist: nvidia-nat-agno; extra == "agno"
|
|
56
|
+
Provides-Extra: crewai
|
|
57
|
+
Requires-Dist: nvidia-nat-crewai; extra == "crewai"
|
|
58
|
+
Provides-Extra: data-flywheel
|
|
59
|
+
Requires-Dist: nvidia-nat-data-flywheel; extra == "data-flywheel"
|
|
60
|
+
Provides-Extra: ingestion
|
|
61
|
+
Requires-Dist: nvidia-nat-ingestion; extra == "ingestion"
|
|
62
|
+
Provides-Extra: langchain
|
|
63
|
+
Requires-Dist: nvidia-nat-langchain; extra == "langchain"
|
|
64
|
+
Provides-Extra: llama-index
|
|
65
|
+
Requires-Dist: nvidia-nat-llama-index; extra == "llama-index"
|
|
66
|
+
Provides-Extra: mcp
|
|
67
|
+
Requires-Dist: nvidia-nat-mcp; extra == "mcp"
|
|
68
|
+
Provides-Extra: mem0ai
|
|
69
|
+
Requires-Dist: nvidia-nat-mem0ai; extra == "mem0ai"
|
|
70
|
+
Provides-Extra: opentelemetry
|
|
71
|
+
Requires-Dist: nvidia-nat-opentelemetry; extra == "opentelemetry"
|
|
72
|
+
Provides-Extra: phoenix
|
|
73
|
+
Requires-Dist: nvidia-nat-phoenix; extra == "phoenix"
|
|
74
|
+
Provides-Extra: profiling
|
|
75
|
+
Requires-Dist: nvidia-nat-profiling; extra == "profiling"
|
|
76
|
+
Provides-Extra: ragaai
|
|
77
|
+
Requires-Dist: nvidia-nat-ragaai; extra == "ragaai"
|
|
78
|
+
Provides-Extra: mysql
|
|
79
|
+
Requires-Dist: nvidia-nat-mysql; extra == "mysql"
|
|
80
|
+
Provides-Extra: redis
|
|
81
|
+
Requires-Dist: nvidia-nat-redis; extra == "redis"
|
|
82
|
+
Provides-Extra: s3
|
|
83
|
+
Requires-Dist: nvidia-nat-s3; extra == "s3"
|
|
84
|
+
Provides-Extra: semantic-kernel
|
|
85
|
+
Requires-Dist: nvidia-nat-semantic-kernel; extra == "semantic-kernel"
|
|
86
|
+
Provides-Extra: telemetry
|
|
87
|
+
Requires-Dist: nvidia-nat-opentelemetry; extra == "telemetry"
|
|
88
|
+
Requires-Dist: nvidia-nat-phoenix; extra == "telemetry"
|
|
89
|
+
Requires-Dist: nvidia-nat-weave; extra == "telemetry"
|
|
90
|
+
Requires-Dist: nvidia-nat-ragaai; extra == "telemetry"
|
|
91
|
+
Provides-Extra: weave
|
|
92
|
+
Requires-Dist: nvidia-nat-weave; extra == "weave"
|
|
93
|
+
Provides-Extra: zep-cloud
|
|
94
|
+
Requires-Dist: nvidia-nat-zep-cloud; extra == "zep-cloud"
|
|
95
|
+
Provides-Extra: examples
|
|
96
|
+
Requires-Dist: nat_adk_demo; extra == "examples"
|
|
97
|
+
Requires-Dist: nat_agno_personal_finance; extra == "examples"
|
|
98
|
+
Requires-Dist: nat_haystack_deep_research_agent; extra == "examples"
|
|
99
|
+
Requires-Dist: nat_alert_triage_agent; extra == "examples"
|
|
100
|
+
Requires-Dist: nat_automated_description_generation; extra == "examples"
|
|
101
|
+
Requires-Dist: nat_email_phishing_analyzer; extra == "examples"
|
|
102
|
+
Requires-Dist: nat_multi_frameworks; extra == "examples"
|
|
103
|
+
Requires-Dist: nat_plot_charts; extra == "examples"
|
|
104
|
+
Requires-Dist: nat_por_to_jiratickets; extra == "examples"
|
|
105
|
+
Requires-Dist: nat_profiler_agent; extra == "examples"
|
|
106
|
+
Requires-Dist: nat_redact_pii; extra == "examples"
|
|
107
|
+
Requires-Dist: nat_router_agent; extra == "examples"
|
|
108
|
+
Requires-Dist: nat_semantic_kernel_demo; extra == "examples"
|
|
109
|
+
Requires-Dist: nat_sequential_executor; extra == "examples"
|
|
110
|
+
Requires-Dist: nat_simple_auth; extra == "examples"
|
|
111
|
+
Requires-Dist: nat_simple_auth_mcp; extra == "examples"
|
|
112
|
+
Requires-Dist: nat_simple_web_query; extra == "examples"
|
|
113
|
+
Requires-Dist: nat_simple_web_query_eval; extra == "examples"
|
|
114
|
+
Requires-Dist: nat_simple_calculator; extra == "examples"
|
|
115
|
+
Requires-Dist: nat_simple_calculator_custom_routes; extra == "examples"
|
|
116
|
+
Requires-Dist: nat_simple_calculator_eval; extra == "examples"
|
|
117
|
+
Requires-Dist: nat_simple_calculator_mcp; extra == "examples"
|
|
118
|
+
Requires-Dist: nat_simple_calculator_observability; extra == "examples"
|
|
119
|
+
Requires-Dist: nat_simple_calculator_hitl; extra == "examples"
|
|
120
|
+
Requires-Dist: nat_simple_rag; extra == "examples"
|
|
121
|
+
Requires-Dist: nat_swe_bench; extra == "examples"
|
|
122
|
+
Requires-Dist: nat_user_report; extra == "examples"
|
|
123
|
+
Provides-Extra: gunicorn
|
|
124
|
+
Requires-Dist: gunicorn~=23.0; extra == "gunicorn"
|
|
125
|
+
Provides-Extra: async-endpoints
|
|
126
|
+
Requires-Dist: aiosqlite~=0.21; extra == "async-endpoints"
|
|
127
|
+
Requires-Dist: dask==2023.6; extra == "async-endpoints"
|
|
128
|
+
Requires-Dist: distributed==2023.6; extra == "async-endpoints"
|
|
129
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0; extra == "async-endpoints"
|
|
130
|
+
Provides-Extra: nvidia-haystack
|
|
131
|
+
Requires-Dist: nvidia-haystack~=0.3.0; extra == "nvidia-haystack"
|
|
132
|
+
Provides-Extra: litellm
|
|
133
|
+
Requires-Dist: litellm==1.74.9; extra == "litellm"
|
|
134
|
+
Provides-Extra: openai
|
|
135
|
+
Requires-Dist: openai~=1.106; extra == "openai"
|
|
136
|
+
Dynamic: license-file
|
|
137
|
+
|
|
138
|
+
<!--
|
|
139
|
+
SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
140
|
+
SPDX-License-Identifier: Apache-2.0
|
|
141
|
+
|
|
142
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
143
|
+
you may not use this file except in compliance with the License.
|
|
144
|
+
You may obtain a copy of the License at
|
|
145
|
+
|
|
146
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
147
|
+
|
|
148
|
+
Unless required by applicable law or agreed to in writing, software
|
|
149
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
151
|
+
See the License for the specific language governing permissions and
|
|
152
|
+
limitations under the License.
|
|
153
|
+
-->
|
|
154
|
+
|
|
155
|
+

|
|
156
|
+
|
|
157
|
+
# NVIDIA NeMo Agent Toolkit
|
|
158
|
+
|
|
159
|
+
NeMo Agent toolkit is a flexible library designed to seamlessly integrate your enterprise agents—regardless of framework—with various data sources and tools. By treating agents, tools, and agentic workflows as simple function calls, NeMo Agent toolkit enables true composability: build once and reuse anywhere.
|
|
160
|
+
|
|
161
|
+
## Key Features
|
|
162
|
+
|
|
163
|
+
- [**Framework Agnostic:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/extend/plugins.html) Works with any agentic framework, so you can use your current technology stack without replatforming.
|
|
164
|
+
- [**Reusability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/extend/sharing-components.html) Every agent, tool, or workflow can be combined and repurposed, allowing developers to leverage existing work in new scenarios.
|
|
165
|
+
- [**Rapid Development:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/tutorials/index.html) Start with a pre-built agent, tool, or workflow, and customize it to your needs.
|
|
166
|
+
- [**Profiling:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/profiler.html) Profile entire workflows down to the tool and agent level, track input/output tokens and timings, and identify bottlenecks.
|
|
167
|
+
- [**Observability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-phoenix.html) Monitor and debug your workflows with any OpenTelemetry-compatible observability tool, with examples using [Phoenix](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-phoenix.html) and [W&B Weave](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-weave.html).
|
|
168
|
+
- [**Evaluation System:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/evaluate.html) Validate and maintain accuracy of agentic workflows with built-in evaluation tools.
|
|
169
|
+
- [**User Interface:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/quick-start/launching-ui.html) Use the NeMo Agent toolkit UI chat interface to interact with your agents, visualize output, and debug workflows.
|
|
170
|
+
- [**MCP Compatibility**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/mcp/mcp-client.html) Compatible with Model Context Protocol (MCP), allowing tools served by MCP Servers to be used as NeMo Agent toolkit functions.
|
|
171
|
+
|
|
172
|
+
With NeMo Agent toolkit, you can move quickly, experiment freely, and ensure reliability across all your agent-driven projects.
|
|
173
|
+
|
|
174
|
+
## Links
|
|
175
|
+
* [Documentation](https://docs.nvidia.com/nemo/agent-toolkit/1.3/index.html): Explore the full documentation for NeMo Agent toolkit.
|
|
176
|
+
|
|
177
|
+
## First time user?
|
|
178
|
+
If this is your first time using NeMo Agent toolkit, it is recommended to install the latest version from the [source repository](https://github.com/NVIDIA/NeMo-Agent-Toolkit?tab=readme-ov-file#quick-start) on GitHub. This package is intended for users who are familiar with NeMo Agent toolkit applications and need to add NeMo Agent toolkit as a dependency to their project.
|
|
179
|
+
|
|
180
|
+
## Feedback
|
|
181
|
+
|
|
182
|
+
We would love to hear from you! Please file an issue on [GitHub](https://github.com/NVIDIA/NeMo-Agent-Toolkit/issues) if you have any feedback or feature requests.
|
|
183
|
+
|
|
184
|
+
## Acknowledgements
|
|
185
|
+
|
|
186
|
+
We would like to thank the following open source projects that made NeMo Agent toolkit possible:
|
|
187
|
+
|
|
188
|
+
- [CrewAI](https://github.com/crewAIInc/crewAI)
|
|
189
|
+
- [FastAPI](https://github.com/tiangolo/fastapi)
|
|
190
|
+
- [LangChain](https://github.com/langchain-ai/langchain)
|
|
191
|
+
- [Llama-Index](https://github.com/run-llama/llama_index)
|
|
192
|
+
- [Mem0ai](https://github.com/mem0ai/mem0)
|
|
193
|
+
- [Ragas](https://github.com/explodinggradients/ragas)
|
|
194
|
+
- [Semantic Kernel](https://github.com/microsoft/semantic-kernel)
|
|
195
|
+
- [uv](https://github.com/astral-sh/uv)
|