nvidia-nat 1.2.0a20250813__py3-none-any.whl → 1.2.0rc6__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.
Files changed (116) hide show
  1. nat/agent/react_agent/register.py +1 -1
  2. nat/agent/reasoning_agent/reasoning_agent.py +3 -3
  3. nat/agent/rewoo_agent/prompt.py +11 -12
  4. nat/agent/rewoo_agent/register.py +30 -32
  5. nat/authentication/http_basic_auth/http_basic_auth_provider.py +1 -1
  6. nat/authentication/interfaces.py +1 -1
  7. nat/authentication/oauth2/oauth2_auth_code_flow_provider.py +2 -2
  8. nat/builder/component_utils.py +5 -5
  9. nat/builder/context.py +5 -5
  10. nat/builder/front_end.py +6 -6
  11. nat/builder/function_base.py +4 -4
  12. nat/builder/function_info.py +1 -1
  13. nat/builder/intermediate_step_manager.py +4 -4
  14. nat/builder/user_interaction_manager.py +3 -3
  15. nat/builder/workflow_builder.py +2 -2
  16. nat/cli/cli_utils/validation.py +1 -1
  17. nat/cli/commands/configure/channel/add.py +1 -1
  18. nat/cli/commands/configure/channel/channel.py +1 -3
  19. nat/cli/commands/configure/channel/remove.py +1 -1
  20. nat/cli/commands/configure/channel/update.py +1 -1
  21. nat/cli/commands/configure/configure.py +2 -2
  22. nat/cli/commands/evaluate.py +1 -1
  23. nat/cli/commands/info/info.py +2 -4
  24. nat/cli/commands/info/list_components.py +2 -2
  25. nat/cli/commands/info/list_mcp.py +9 -9
  26. nat/cli/commands/registry/publish.py +3 -3
  27. nat/cli/commands/registry/pull.py +3 -3
  28. nat/cli/commands/registry/registry.py +1 -3
  29. nat/cli/commands/registry/remove.py +3 -3
  30. nat/cli/commands/registry/search.py +3 -3
  31. nat/cli/commands/start.py +4 -4
  32. nat/cli/commands/workflow/templates/pyproject.toml.j2 +4 -4
  33. nat/cli/commands/workflow/workflow_commands.py +6 -6
  34. nat/data_models/api_server.py +38 -31
  35. nat/data_models/component_ref.py +9 -9
  36. nat/data_models/dataset_handler.py +56 -10
  37. nat/data_models/discovery_metadata.py +21 -50
  38. nat/data_models/evaluate.py +2 -2
  39. nat/data_models/intermediate_step.py +4 -4
  40. nat/embedder/register.py +0 -2
  41. nat/eval/dataset_handler/dataset_handler.py +118 -5
  42. nat/eval/evaluate.py +1 -1
  43. nat/eval/evaluator/evaluator_model.py +3 -3
  44. nat/eval/rag_evaluator/evaluate.py +1 -1
  45. nat/eval/swe_bench_evaluator/evaluate.py +2 -2
  46. nat/experimental/test_time_compute/editing/motivation_aware_summarization.py +1 -1
  47. nat/experimental/test_time_compute/functions/plan_select_execute_function.py +4 -4
  48. nat/experimental/test_time_compute/functions/ttc_tool_wrapper_function.py +1 -1
  49. nat/experimental/test_time_compute/scoring/llm_based_agent_scorer.py +1 -1
  50. nat/experimental/test_time_compute/scoring/llm_based_plan_scorer.py +1 -1
  51. nat/experimental/test_time_compute/search/multi_llm_planner.py +1 -1
  52. nat/experimental/test_time_compute/search/multi_query_retrieval_search.py +1 -1
  53. nat/experimental/test_time_compute/search/single_shot_multi_plan_planner.py +1 -1
  54. nat/experimental/test_time_compute/selection/llm_based_agent_output_selector.py +1 -1
  55. nat/experimental/test_time_compute/selection/llm_based_output_merging_selector.py +1 -1
  56. nat/experimental/test_time_compute/selection/llm_based_plan_selector.py +1 -1
  57. nat/front_ends/console/console_front_end_config.py +1 -1
  58. nat/front_ends/fastapi/fastapi_front_end_config.py +6 -7
  59. nat/front_ends/fastapi/fastapi_front_end_plugin.py +4 -4
  60. nat/front_ends/fastapi/fastapi_front_end_plugin_worker.py +13 -13
  61. nat/front_ends/fastapi/intermediate_steps_subscriber.py +1 -1
  62. nat/front_ends/fastapi/main.py +6 -6
  63. nat/front_ends/fastapi/message_handler.py +14 -3
  64. nat/front_ends/fastapi/message_validator.py +6 -8
  65. nat/front_ends/fastapi/response_helpers.py +3 -3
  66. nat/front_ends/mcp/mcp_front_end_config.py +3 -2
  67. nat/front_ends/mcp/mcp_front_end_plugin_worker.py +4 -4
  68. nat/front_ends/mcp/tool_converter.py +15 -16
  69. nat/memory/__init__.py +2 -2
  70. nat/meta/pypi.md +8 -8
  71. nat/object_store/__init__.py +2 -2
  72. nat/observability/exporter/base_exporter.py +1 -1
  73. nat/observability/exporter/raw_exporter.py +1 -1
  74. nat/observability/exporter_manager.py +1 -1
  75. nat/profiler/callbacks/agno_callback_handler.py +4 -4
  76. nat/profiler/callbacks/llama_index_callback_handler.py +2 -2
  77. nat/profiler/callbacks/semantic_kernel_callback_handler.py +1 -1
  78. nat/profiler/decorators/function_tracking.py +1 -1
  79. nat/profiler/forecasting/models/linear_model.py +3 -2
  80. nat/profiler/forecasting/models/random_forest_regressor.py +3 -2
  81. nat/profiler/inference_optimization/bottleneck_analysis/nested_stack_analysis.py +1 -1
  82. nat/profiler/inference_optimization/experimental/prefix_span_analysis.py +1 -1
  83. nat/profiler/profile_runner.py +1 -1
  84. nat/registry_handlers/local/local_handler.py +5 -5
  85. nat/registry_handlers/local/register_local.py +1 -1
  86. nat/registry_handlers/package_utils.py +17 -17
  87. nat/registry_handlers/pypi/pypi_handler.py +5 -5
  88. nat/registry_handlers/pypi/register_pypi.py +3 -3
  89. nat/registry_handlers/registry_handler_base.py +8 -8
  90. nat/registry_handlers/rest/register_rest.py +4 -4
  91. nat/registry_handlers/rest/rest_handler.py +6 -6
  92. nat/registry_handlers/schemas/package.py +3 -3
  93. nat/registry_handlers/schemas/publish.py +4 -4
  94. nat/registry_handlers/schemas/pull.py +4 -4
  95. nat/registry_handlers/schemas/search.py +7 -7
  96. nat/runtime/loader.py +21 -20
  97. nat/runtime/runner.py +2 -2
  98. nat/runtime/session.py +1 -1
  99. nat/settings/global_settings.py +2 -2
  100. nat/tool/chat_completion.py +1 -1
  101. nat/tool/code_execution/README.md +2 -2
  102. nat/tool/code_execution/test_code_execution_sandbox.py +1 -1
  103. nat/tool/mcp/exceptions.py +1 -1
  104. nat/tool/mcp/mcp_tool.py +1 -1
  105. nat/tool/retriever.py +3 -3
  106. nat/tool/server_tools.py +11 -11
  107. nat/utils/settings/global_settings.py +1 -1
  108. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/METADATA +9 -9
  109. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/RECORD +114 -116
  110. nat/embedder/langchain_client.py +0 -41
  111. nat/meta/module_to_distro.json +0 -4
  112. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/WHEEL +0 -0
  113. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/entry_points.txt +0 -0
  114. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
  115. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/licenses/LICENSE.md +0 -0
  116. {nvidia_nat-1.2.0a20250813.dist-info → nvidia_nat-1.2.0rc6.dist-info}/top_level.txt +0 -0
@@ -74,7 +74,7 @@ async def pull_artifact(registry_handler_config: RegistryHandlerBaseConfig, pack
74
74
 
75
75
  @click.group(name=__name__,
76
76
  invoke_without_command=True,
77
- help=("Pull AIQ Toolkit artifacts from a remote registry "
77
+ help=("Pull NAT artifacts from a remote registry "
78
78
  "by package name."))
79
79
  @click.option(
80
80
  "--config_file",
@@ -88,12 +88,12 @@ async def pull_artifact(registry_handler_config: RegistryHandlerBaseConfig, pack
88
88
  "--channel",
89
89
  type=str,
90
90
  required=True,
91
- help=("The remote registry channel to use when pulling the AIQ Toolkit artifact."),
91
+ help=("The remote registry channel to use when pulling the NAT artifact."),
92
92
  )
93
93
  @click.argument("packages", type=str)
94
94
  def pull(channel: str, config_file: str, packages: str) -> None:
95
95
  """
96
- Pull AIQ Toolkit artifacts from a remote registry channel.
96
+ Pull NAT artifacts from a remote registry channel.
97
97
  """
98
98
 
99
99
  from nat.settings.global_settings import GlobalSettings
@@ -25,9 +25,7 @@ from nat.cli.commands.registry.search import search
25
25
  logger = logging.getLogger(__name__)
26
26
 
27
27
 
28
- @click.group(name=__name__,
29
- invoke_without_command=False,
30
- help="Utility to configure AIQ Toolkit remote registry channels.")
28
+ @click.group(name=__name__, invoke_without_command=False, help="Utility to configure NAT remote registry channels.")
31
29
  def registry_command(**kwargs):
32
30
  pass
33
31
 
@@ -48,7 +48,7 @@ async def remove_artifact(registry_handler_config: RegistryHandlerBaseConfig, pa
48
48
 
49
49
  @click.group(name=__name__,
50
50
  invoke_without_command=True,
51
- help=("Remove AIQ Toolkit artifact from a remote registry by name and version."))
51
+ help=("Remove NAT artifact from a remote registry by name and version."))
52
52
  @click.argument("packages", type=str)
53
53
  @click.option(
54
54
  "--config_file",
@@ -62,11 +62,11 @@ async def remove_artifact(registry_handler_config: RegistryHandlerBaseConfig, pa
62
62
  "--channel",
63
63
  type=str,
64
64
  required=True,
65
- help=("The remote registry channel that will remove the AIQ Toolkit artifact."),
65
+ help=("The remote registry channel that will remove the NAT artifact."),
66
66
  )
67
67
  def remove(channel: str, config_file: str, packages: str) -> None:
68
68
  """
69
- Remove AIQ Toolkit artifacts from a remote registry.
69
+ Remove NAT artifacts from a remote registry.
70
70
  """
71
71
 
72
72
  from nat.settings.global_settings import GlobalSettings
@@ -62,7 +62,7 @@ async def search_artifacts( # pylint: disable=R0917
62
62
  registry_handler.save_search_results(search_response=search_response, save_path=save_path)
63
63
 
64
64
 
65
- @click.group(name=__name__, invoke_without_command=True, help="Search for AIQ Toolkit artifacts from remote registry.")
65
+ @click.group(name=__name__, invoke_without_command=True, help="Search for NAT artifacts from remote registry.")
66
66
  @click.option(
67
67
  "--config_file",
68
68
  type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
@@ -75,7 +75,7 @@ async def search_artifacts( # pylint: disable=R0917
75
75
  "--channel",
76
76
  type=str,
77
77
  required=True,
78
- help=("The remote registry channel to use when pulling the AIQ Toolkit artifact."),
78
+ help=("The remote registry channel to use when pulling the NAT artifact."),
79
79
  )
80
80
  @click.option(
81
81
  "-o",
@@ -125,7 +125,7 @@ def search( # pylint: disable=R0917
125
125
  n_results: int,
126
126
  output_path: str) -> None:
127
127
  """
128
- Search for AIQ Toolkit artifacts with the specified configuration.
128
+ Search for NAT artifacts with the specified configuration.
129
129
  """
130
130
 
131
131
  from nat.settings.global_settings import GlobalSettings
nat/cli/commands/start.py CHANGED
@@ -149,7 +149,7 @@ class StartCommandGroup(click.Group):
149
149
 
150
150
  # Build the command parameters
151
151
  params: list[click.Parameter] = self._build_params(registered_front_end)
152
- help_msg = f"Run an AIQ Toolkit workflow using the {registered_front_end.local_name} front end."
152
+ help_msg = f"Run a NAT workflow using the {registered_front_end.local_name} front end."
153
153
 
154
154
  cmd = click.Command(name=registered_front_end.local_name,
155
155
  params=params,
@@ -178,7 +178,7 @@ class StartCommandGroup(click.Group):
178
178
  # Here we need to ensure all objects are loaded before we try to create the config object
179
179
  discover_and_register_plugins(PluginTypes.CONFIG_OBJECT)
180
180
 
181
- logger.info("Starting AIQ Toolkit from config file: '%s'", config_file)
181
+ logger.info("Starting NAT from config file: '%s'", config_file)
182
182
 
183
183
  config_dict = load_and_override_config(config_file, override)
184
184
 
@@ -238,9 +238,9 @@ class StartCommandGroup(click.Group):
238
238
 
239
239
  @click.command(name=__name__,
240
240
  invoke_without_command=False,
241
- help="Run an AIQ Toolkit workflow using a front end configuration.",
241
+ help="Run a NAT workflow using a front end configuration.",
242
242
  cls=StartCommandGroup)
243
243
  @click.pass_context
244
244
  def start_command(ctx: click.Context, **kwargs) -> None:
245
- """Run an AIQ Toolkit workflow using a front end configuration."""
245
+ """Run a NAT workflow using a front end configuration."""
246
246
  pass
@@ -9,14 +9,14 @@ root = "{{ rel_path_to_repo_root}}"{% else %}requires = ["setuptools >= 64"]{% e
9
9
  name = "{{ package_name }}"
10
10
  {% if editable %}dynamic = ["version"]{% else %}version = "0.1.0"{% endif %}
11
11
  dependencies = [
12
- "aiqtoolkit[langchain]",
12
+ "nvidia-nat[langchain]",
13
13
  ]
14
14
  requires-python = ">=3.11,<3.13"
15
- description = "Custom AIQ Toolkit Workflow"
15
+ description = "Custom NeMo Agent Toolkit Workflow"
16
16
  classifiers = ["Programming Language :: Python"]
17
17
 
18
18
  {% if editable %}[tool.uv.sources]
19
- aiqtoolkit = { path = "{{ rel_path_to_repo_root}}", editable = true }{% endif %}
19
+ nvidia-nat = { path = "{{ rel_path_to_repo_root}}", editable = true }{% endif %}
20
20
 
21
- [project.entry-points.'aiq.components']
21
+ [project.entry-points.'nat.components']
22
22
  {{ package_name }} = "{{ package_name }}.register"
@@ -98,7 +98,7 @@ def find_package_root(package_name: str) -> Path | None:
98
98
 
99
99
  def get_workflow_path_from_name(workflow_name: str):
100
100
  """
101
- Look up the location of an installed AIQ Toolkit workflow and retrieve the root directory of the installed workflow.
101
+ Look up the location of an installed NAT workflow and retrieve the root directory of the installed workflow.
102
102
 
103
103
  Args:
104
104
  workflow_name: The name of the workflow.
@@ -127,13 +127,13 @@ def get_workflow_path_from_name(workflow_name: str):
127
127
  "within. Defaults to the present working directory.")
128
128
  @click.option(
129
129
  "--description",
130
- default="AIQ Toolkit function template. Please update the description.",
130
+ default="NAT function template. Please update the description.",
131
131
  help="""A description of the component being created. Will be used to populate the docstring and will describe the
132
- component when inspecting installed components using 'aiq info component'""")
132
+ component when inspecting installed components using 'nat info component'""")
133
133
  # pylint: disable=missing-param-doc
134
134
  def create_command(workflow_name: str, install: bool, workflow_dir: str, description: str):
135
135
  """
136
- Create a new AIQ Toolkit workflow using templates.
136
+ Create a new NAT workflow using templates.
137
137
 
138
138
  Args:
139
139
  workflow_name (str): The name of the new workflow.
@@ -234,7 +234,7 @@ def create_command(workflow_name: str, install: bool, workflow_dir: str, descrip
234
234
  @click.argument('workflow_name')
235
235
  def reinstall_command(workflow_name):
236
236
  """
237
- Reinstall an AIQ Toolkit workflow to update dependencies and code changes.
237
+ Reinstall a NAT workflow to update dependencies and code changes.
238
238
 
239
239
  Args:
240
240
  workflow_name (str): The name of the workflow to reinstall.
@@ -270,7 +270,7 @@ def reinstall_command(workflow_name):
270
270
  @click.argument('workflow_name')
271
271
  def delete_command(workflow_name: str):
272
272
  """
273
- Delete an AIQ Toolkit workflow and uninstall its package.
273
+ Delete a NAT workflow and uninstall its package.
274
274
 
275
275
  Args:
276
276
  workflow_name (str): The name of the workflow to delete.
@@ -33,6 +33,8 @@ from pydantic_core.core_schema import ValidationInfo
33
33
  from nat.data_models.interactive import HumanPrompt
34
34
  from nat.utils.type_converter import GlobalTypeConverter
35
35
 
36
+ FINISH_REASONS = frozenset({'stop', 'length', 'tool_calls', 'content_filter', 'function_call'})
37
+
36
38
 
37
39
  class Request(BaseModel):
38
40
  """
@@ -111,7 +113,7 @@ class Message(BaseModel):
111
113
 
112
114
  class ChatRequest(BaseModel):
113
115
  """
114
- ChatRequest is a data model that represents a request to the AIQ Toolkit chat API.
116
+ ChatRequest is a data model that represents a request to the NAT chat API.
115
117
  Fully compatible with OpenAI Chat Completions API specification.
116
118
  """
117
119
 
@@ -201,7 +203,7 @@ class Choice(BaseModel):
201
203
  delta: ChoiceDelta | None = None
202
204
  finish_reason: typing.Literal['stop', 'length', 'tool_calls', 'content_filter', 'function_call'] | None = None
203
205
  index: int
204
- # logprobs: AIQChoiceLogprobs | None = None
206
+ # logprobs: ChoiceLogprobs | None = None
205
207
 
206
208
 
207
209
  class Usage(BaseModel):
@@ -212,7 +214,7 @@ class Usage(BaseModel):
212
214
 
213
215
  class ResponseSerializable(abc.ABC):
214
216
  """
215
- AIQChatResponseSerializable is an abstract class that defines the interface for serializing output for the AIQ
217
+ ResponseSerializable is an abstract class that defines the interface for serializing output for the NAT
216
218
  Toolkit chat streaming API.
217
219
  """
218
220
 
@@ -235,7 +237,7 @@ class ResponseBaseModelIntermediate(BaseModel, ResponseSerializable):
235
237
 
236
238
  class ChatResponse(ResponseBaseModelOutput):
237
239
  """
238
- ChatResponse is a data model that represents a response from the AIQ Toolkit chat API.
240
+ ChatResponse is a data model that represents a response from the NAT chat API.
239
241
  Fully compatible with OpenAI Chat Completions API specification.
240
242
  """
241
243
 
@@ -283,7 +285,7 @@ class ChatResponse(ResponseBaseModelOutput):
283
285
 
284
286
  class ChatResponseChunk(ResponseBaseModelOutput):
285
287
  """
286
- ChatResponseChunk is a data model that represents a response chunk from the AIQ Toolkit chat streaming API.
288
+ ChatResponseChunk is a data model that represents a response chunk from the NAT chat streaming API.
287
289
  Fully compatible with OpenAI Chat Completions API specification.
288
290
  """
289
291
 
@@ -347,18 +349,21 @@ class ChatResponseChunk(ResponseBaseModelOutput):
347
349
 
348
350
  delta = ChoiceDelta(content=content, role=role) if content is not None or role is not None else ChoiceDelta()
349
351
 
350
- return ChatResponseChunk(id=id_,
351
- choices=[Choice(index=0, message=None, delta=delta, finish_reason=finish_reason)],
352
- created=created,
353
- model=model,
354
- object="chat.completion.chunk",
355
- usage=usage,
356
- system_fingerprint=system_fingerprint)
352
+ final_finish_reason = finish_reason if finish_reason in FINISH_REASONS else None
353
+
354
+ return ChatResponseChunk(
355
+ id=id_,
356
+ choices=[Choice(index=0, message=None, delta=delta, finish_reason=final_finish_reason)],
357
+ created=created,
358
+ model=model,
359
+ object="chat.completion.chunk",
360
+ usage=usage,
361
+ system_fingerprint=system_fingerprint)
357
362
 
358
363
 
359
364
  class ResponseIntermediateStep(ResponseBaseModelIntermediate):
360
365
  """
361
- ResponseSerializedStep is a data model that represents a serialized step in the AIQ Toolkit chat streaming API.
366
+ ResponseSerializedStep is a data model that represents a serialized step in the NAT chat streaming API.
362
367
  """
363
368
 
364
369
  # Allow extra fields in the model_config to support derived models
@@ -580,7 +585,7 @@ class WebSocketSystemInteractionMessage(BaseModel):
580
585
  timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
581
586
 
582
587
 
583
- # ======== AIQGenerateResponse Converters ========
588
+ # ======== GenerateResponse Converters ========
584
589
 
585
590
 
586
591
  def _generate_response_to_str(response: GenerateResponse) -> str:
@@ -606,33 +611,35 @@ def _generate_response_to_chat_response(response: GenerateResponse) -> ChatRespo
606
611
  GlobalTypeConverter.register_converter(_generate_response_to_chat_response)
607
612
 
608
613
 
609
- # ======== AIQChatRequest Converters ========
610
- def _aiq_chat_request_to_string(data: ChatRequest) -> str:
614
+ # ======== ChatRequest Converters ========
615
+ def _nat_chat_request_to_string(data: ChatRequest) -> str:
611
616
  if isinstance(data.messages[-1].content, str):
612
617
  return data.messages[-1].content
613
618
  return str(data.messages[-1].content)
614
619
 
615
620
 
616
- GlobalTypeConverter.register_converter(_aiq_chat_request_to_string)
621
+ GlobalTypeConverter.register_converter(_nat_chat_request_to_string)
617
622
 
618
623
 
619
- def _string_to_aiq_chat_request(data: str) -> ChatRequest:
624
+ def _string_to_nat_chat_request(data: str) -> ChatRequest:
620
625
  return ChatRequest.from_string(data, model="")
621
626
 
622
627
 
623
- GlobalTypeConverter.register_converter(_string_to_aiq_chat_request)
628
+ GlobalTypeConverter.register_converter(_string_to_nat_chat_request)
624
629
 
625
630
 
626
- # ======== AIQChatResponse Converters ========
627
- def _aiq_chat_response_to_string(data: ChatResponse) -> str:
628
- return data.choices[0].message.content or ""
631
+ # ======== ChatResponse Converters ========
632
+ def _nat_chat_response_to_string(data: ChatResponse) -> str:
633
+ if data.choices and data.choices[0].message:
634
+ return data.choices[0].message.content or ""
635
+ return ""
629
636
 
630
637
 
631
- GlobalTypeConverter.register_converter(_aiq_chat_response_to_string)
638
+ GlobalTypeConverter.register_converter(_nat_chat_response_to_string)
632
639
 
633
640
 
634
- def _string_to_aiq_chat_response(data: str) -> ChatResponse:
635
- '''Converts a string to an AIQChatResponse object'''
641
+ def _string_to_nat_chat_response(data: str) -> ChatResponse:
642
+ '''Converts a string to an ChatResponse object'''
636
643
 
637
644
  # Simulate usage
638
645
  prompt_tokens = 0
@@ -644,7 +651,7 @@ def _string_to_aiq_chat_response(data: str) -> ChatResponse:
644
651
  return ChatResponse.from_string(data, usage=usage)
645
652
 
646
653
 
647
- GlobalTypeConverter.register_converter(_string_to_aiq_chat_response)
654
+ GlobalTypeConverter.register_converter(_string_to_nat_chat_response)
648
655
 
649
656
 
650
657
  def _chat_response_to_chat_response_chunk(data: ChatResponse) -> ChatResponseChunk:
@@ -669,19 +676,19 @@ def _chat_response_chunk_to_string(data: ChatResponseChunk) -> str:
669
676
  GlobalTypeConverter.register_converter(_chat_response_chunk_to_string)
670
677
 
671
678
 
672
- def _string_to_aiq_chat_response_chunk(data: str) -> ChatResponseChunk:
673
- '''Converts a string to an AIQChatResponseChunk object'''
679
+ def _string_to_nat_chat_response_chunk(data: str) -> ChatResponseChunk:
680
+ '''Converts a string to an ChatResponseChunk object'''
674
681
 
675
682
  # Build and return the response
676
683
  return ChatResponseChunk.from_string(data)
677
684
 
678
685
 
679
- GlobalTypeConverter.register_converter(_string_to_aiq_chat_response_chunk)
686
+ GlobalTypeConverter.register_converter(_string_to_nat_chat_response_chunk)
680
687
 
681
688
 
682
689
  # ======== AINodeMessageChunk Converters ========
683
- def _ai_message_chunk_to_aiq_chat_response_chunk(data) -> ChatResponseChunk:
684
- '''Converts LangChain AINodeMessageChunk to AIQChatResponseChunk'''
690
+ def _ai_message_chunk_to_nat_chat_response_chunk(data) -> ChatResponseChunk:
691
+ '''Converts LangChain AINodeMessageChunk to ChatResponseChunk'''
685
692
  content = ""
686
693
  if hasattr(data, 'content') and data.content is not None:
687
694
  content = str(data.content)
@@ -43,7 +43,7 @@ class ComponentRefNode(HashableBaseModel):
43
43
 
44
44
  Args:
45
45
  ref_name (ComponentRef): The name of the component runtime instance.
46
- component_group (ComponentGroup): The component group in an AIQ Toolkit configuration object.
46
+ component_group (ComponentGroup): The component group in a NAT configuration object.
47
47
  """
48
48
 
49
49
  ref_name: "ComponentRef"
@@ -70,7 +70,7 @@ class ComponentRef(str, ABC):
70
70
  """Provides the component group this ComponentRef object represents.
71
71
 
72
72
  Returns:
73
- ComponentGroup: A component group of the AIQ Toolkit configuration object
73
+ ComponentGroup: A component group of the NAT configuration object
74
74
  """
75
75
 
76
76
  pass
@@ -82,7 +82,7 @@ class ComponentRef(str, ABC):
82
82
 
83
83
  class EmbedderRef(ComponentRef):
84
84
  """
85
- A reference to an embedder in an AIQ Toolkit configuration object.
85
+ A reference to an embedder in a NAT configuration object.
86
86
  """
87
87
 
88
88
  @property
@@ -93,7 +93,7 @@ class EmbedderRef(ComponentRef):
93
93
 
94
94
  class FunctionRef(ComponentRef):
95
95
  """
96
- A reference to a function in an AIQ Toolkit configuration object.
96
+ A reference to a function in a NAT configuration object.
97
97
  """
98
98
 
99
99
  @property
@@ -104,7 +104,7 @@ class FunctionRef(ComponentRef):
104
104
 
105
105
  class LLMRef(ComponentRef):
106
106
  """
107
- A reference to an LLM in an AIQ Toolkit configuration object.
107
+ A reference to an LLM in a NAT configuration object.
108
108
  """
109
109
 
110
110
  @property
@@ -115,7 +115,7 @@ class LLMRef(ComponentRef):
115
115
 
116
116
  class MemoryRef(ComponentRef):
117
117
  """
118
- A reference to a memory in an AIQ Toolkit configuration object.
118
+ A reference to a memory in a NAT configuration object.
119
119
  """
120
120
 
121
121
  @property
@@ -126,7 +126,7 @@ class MemoryRef(ComponentRef):
126
126
 
127
127
  class ObjectStoreRef(ComponentRef):
128
128
  """
129
- A reference to an object store in an AIQ toolkit configuration object.
129
+ A reference to an object store in a NAT configuration object.
130
130
  """
131
131
 
132
132
  @property
@@ -137,7 +137,7 @@ class ObjectStoreRef(ComponentRef):
137
137
 
138
138
  class RetrieverRef(ComponentRef):
139
139
  """
140
- A reference to a retriever in an AIQ Toolkit configuration object.
140
+ A reference to a retriever in a NAT configuration object.
141
141
  """
142
142
 
143
143
  @property
@@ -148,7 +148,7 @@ class RetrieverRef(ComponentRef):
148
148
 
149
149
  class AuthenticationRef(ComponentRef):
150
150
  """
151
- A reference to an API Authentication Provider in an AIQ Toolkit configuration object.
151
+ A reference to an API Authentication Provider in a NAT configuration object.
152
152
  """
153
153
 
154
154
  @property
@@ -13,6 +13,7 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
+ import importlib
16
17
  import json
17
18
  import typing
18
19
  from collections.abc import Callable
@@ -68,7 +69,7 @@ class EvalDatasetBaseConfig(TypedBaseModel, BaseModelRegistryTag):
68
69
  s3: EvalS3Config | None = None
69
70
 
70
71
  remote_file_path: str | None = None # only for s3
71
- file_path: Path | str = Path(".tmp/aiq/examples/default/default.json")
72
+ file_path: Path | str = Path(".tmp/nat/examples/default/default.json")
72
73
 
73
74
 
74
75
  class EvalDatasetJsonConfig(EvalDatasetBaseConfig, name="json"):
@@ -78,7 +79,7 @@ class EvalDatasetJsonConfig(EvalDatasetBaseConfig, name="json"):
78
79
  return pd.read_json, {}
79
80
 
80
81
 
81
- def read_jsonl(file_path: FilePath, **kwargs):
82
+ def read_jsonl(file_path: FilePath):
82
83
  with open(file_path, 'r', encoding='utf-8') as f:
83
84
  data = [json.loads(line) for line in f]
84
85
  return pd.DataFrame(data)
@@ -112,12 +113,57 @@ class EvalDatasetXlsConfig(EvalDatasetBaseConfig, name="xls"):
112
113
  return pd.read_excel, {"engine": "openpyxl"}
113
114
 
114
115
 
116
+ class EvalDatasetCustomConfig(EvalDatasetBaseConfig, name="custom"):
117
+ """
118
+ Configuration for custom dataset type that allows users to specify
119
+ a custom Python function to transform their dataset into EvalInput format.
120
+ """
121
+
122
+ function: str # Direct import path to function, format: "module.path.function_name"
123
+ kwargs: dict[str, typing.Any] = {} # Additional arguments to pass to the custom function
124
+
125
+ def parser(self) -> tuple[Callable, dict]:
126
+ """
127
+ Load and return the custom function for dataset transformation.
128
+
129
+ Returns:
130
+ Tuple of (custom_function, kwargs) where custom_function transforms
131
+ a dataset file into an EvalInput object.
132
+ """
133
+ custom_function = self._load_custom_function()
134
+ return custom_function, self.kwargs
135
+
136
+ def _load_custom_function(self) -> Callable:
137
+ """
138
+ Import and return the custom function using standard Python import path.
139
+ """
140
+ if not self.function:
141
+ raise ValueError("Function path cannot be empty")
142
+
143
+ # Split the function path to get module and function name
144
+ module_path, function_name = self.function.rsplit(".", 1)
145
+
146
+ # Import the module
147
+ module = importlib.import_module(module_path)
148
+
149
+ # Get the function from the module
150
+ if not hasattr(module, function_name):
151
+ raise AttributeError(f"Function '{function_name}' not found in module '{module_path}'")
152
+
153
+ custom_function = getattr(module, function_name)
154
+
155
+ if not callable(custom_function):
156
+ raise ValueError(f"'{self.function}' is not callable")
157
+
158
+ return custom_function
159
+
160
+
115
161
  # Union model with discriminator
116
- EvalDatasetConfig = typing.Annotated[typing.Annotated[EvalDatasetJsonConfig, Tag(EvalDatasetJsonConfig.static_type())]
117
- | typing.Annotated[EvalDatasetCsvConfig, Tag(EvalDatasetCsvConfig.static_type())]
118
- | typing.Annotated[EvalDatasetXlsConfig, Tag(EvalDatasetXlsConfig.static_type())]
119
- | typing.Annotated[EvalDatasetParquetConfig,
120
- Tag(EvalDatasetParquetConfig.static_type())]
121
- | typing.Annotated[EvalDatasetJsonlConfig,
122
- Tag(EvalDatasetJsonlConfig.static_type())],
123
- Discriminator(TypedBaseModel.discriminator)]
162
+ EvalDatasetConfig = typing.Annotated[
163
+ typing.Annotated[EvalDatasetJsonConfig, Tag(EvalDatasetJsonConfig.static_type())]
164
+ | typing.Annotated[EvalDatasetCsvConfig, Tag(EvalDatasetCsvConfig.static_type())]
165
+ | typing.Annotated[EvalDatasetXlsConfig, Tag(EvalDatasetXlsConfig.static_type())]
166
+ | typing.Annotated[EvalDatasetParquetConfig, Tag(EvalDatasetParquetConfig.static_type())]
167
+ | typing.Annotated[EvalDatasetJsonlConfig, Tag(EvalDatasetJsonlConfig.static_type())]
168
+ | typing.Annotated[EvalDatasetCustomConfig, Tag(EvalDatasetCustomConfig.static_type())],
169
+ Discriminator(TypedBaseModel.discriminator)]