nvidia-nat-langchain 1.3.0rc4__py3-none-any.whl → 1.3.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.

Potentially problematic release.


This version of nvidia-nat-langchain might be problematic. Click here for more details.

@@ -65,32 +65,22 @@ def _patch_llm_based_on_config(client: ModelType, llm_config: LLMBaseConfig) ->
65
65
  Raises:
66
66
  ValueError: If the messages are not a valid type for LanguageModelInput.
67
67
  """
68
- system_message = SystemMessage(content=self.system_prompt)
69
- if isinstance(messages, BaseMessage):
70
- # Attempt to inject the system prompt into the first system message
71
- if isinstance(messages, SystemMessage):
72
- messages.content = f"{self.system_prompt}\n\n{messages.content}"
73
- return FunctionArgumentWrapper(messages, *args, **kwargs)
74
- # If no system message found, prepend a new one
75
- new_messages = [system_message, messages]
76
- return FunctionArgumentWrapper(new_messages, *args, **kwargs)
77
- elif isinstance(messages, PromptValue):
78
- new_messages = [system_message, *messages.to_messages()]
79
- return FunctionArgumentWrapper(new_messages, *args, **kwargs)
68
+ if isinstance(messages, PromptValue):
69
+ messages = messages.to_messages()
80
70
  elif isinstance(messages, str):
81
- new_messages = [system_message, HumanMessage(content=messages)]
82
- return FunctionArgumentWrapper(new_messages, *args, **kwargs)
83
- elif isinstance(messages, Sequence):
84
- if all(isinstance(m, BaseMessage) for m in messages):
71
+ messages = [HumanMessage(content=messages)]
72
+
73
+ if isinstance(messages, Sequence) and all(isinstance(m, BaseMessage) for m in messages):
74
+ for i, message in enumerate(messages):
75
+ if isinstance(message, SystemMessage):
76
+ if self.system_prompt not in str(message.content):
77
+ messages = list(messages)
78
+ messages[i] = SystemMessage(content=f"{message.content}\n{self.system_prompt}")
79
+ break
80
+ else:
85
81
  messages = list(messages)
86
- # Attempt to inject the system prompt into the first system message
87
- for message in messages:
88
- if isinstance(message, SystemMessage):
89
- message.content = f"{self.system_prompt}\n\n{message.content}"
90
- return FunctionArgumentWrapper(messages, *args, **kwargs)
91
- # If no system message found, prepend a new one
92
- new_messages = [system_message, *messages]
93
- return FunctionArgumentWrapper(new_messages, *args, **kwargs)
82
+ messages.insert(0, SystemMessage(content=self.system_prompt))
83
+ return FunctionArgumentWrapper(messages, *args, **kwargs)
94
84
  raise ValueError(f"Unsupported message type: {type(messages)}")
95
85
 
96
86
  if isinstance(llm_config, RetryMixin):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nvidia-nat-langchain
3
- Version: 1.3.0rc4
3
+ Version: 1.3.0rc6
4
4
  Summary: Subpackage for LangChain/LangGraph integration in NeMo Agent toolkit
5
5
  Author: NVIDIA Corporation
6
6
  Maintainer: NVIDIA Corporation
@@ -16,7 +16,7 @@ Requires-Python: <3.14,>=3.11
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE-3rd-party.txt
18
18
  License-File: LICENSE.md
19
- Requires-Dist: nvidia-nat==v1.3.0-rc4
19
+ Requires-Dist: nvidia-nat==v1.3.0-rc6
20
20
  Requires-Dist: langchain-aws~=0.2.31
21
21
  Requires-Dist: langchain-core~=0.3.75
22
22
  Requires-Dist: langchain-litellm~=0.2.3
@@ -1,7 +1,7 @@
1
1
  nat/meta/pypi.md,sha256=T_KFtTXVxhFM8Y6K3OlNByA5sTXLQuqqUpHgNOCvZBU,1120
2
2
  nat/plugins/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  nat/plugins/langchain/embedder.py,sha256=ZSESaazyz7y3F0GSSsWRe_xfvxOe0Mwd45wEAkQ2jJk,3339
4
- nat/plugins/langchain/llm.py,sha256=MhkcqlINcNuGppLLr8vN9DN2meKCjbAzcO_cXxy9GK8,7958
4
+ nat/plugins/langchain/llm.py,sha256=KFE59qGeYxTSScaPgid5CDcx_acTcAJylmDVAmQtYmk,7089
5
5
  nat/plugins/langchain/register.py,sha256=jgq6wSJoGQIZFJhS8RbUs25cLgNJjCkFu4M6qaWJS_4,906
6
6
  nat/plugins/langchain/retriever.py,sha256=SWbXXOezEUuPACnmSSU497NAmEVEMj2SrFJGodkRg34,2644
7
7
  nat/plugins/langchain/tool_wrapper.py,sha256=Zgb2_XB4bEhjPPeqS-ZH_OJT_pcQmteX7u03N_qCLfc,2121
@@ -10,10 +10,10 @@ nat/plugins/langchain/tools/code_generation_tool.py,sha256=f5pna0WMOx3QOS4WnaMFK
10
10
  nat/plugins/langchain/tools/register.py,sha256=uemxqLxcNk1bGX4crV52oMphLTZWonStzkXwTZeG2Rw,889
11
11
  nat/plugins/langchain/tools/tavily_internet_search.py,sha256=UFMP1xh_kC3fydMQBeV-oDZ-M7jnLcs5OkMSzgm7mng,2653
12
12
  nat/plugins/langchain/tools/wikipedia_search.py,sha256=431YwLsjoC_mdvMZ_gY0Q37Uqaue2ASnAHpwr4jWCaU,2197
13
- nvidia_nat_langchain-1.3.0rc4.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
14
- nvidia_nat_langchain-1.3.0rc4.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
15
- nvidia_nat_langchain-1.3.0rc4.dist-info/METADATA,sha256=B_4DICNI625tSbo57-PLqkRP5uVqt2IqkbdS4JTad9g,2219
16
- nvidia_nat_langchain-1.3.0rc4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- nvidia_nat_langchain-1.3.0rc4.dist-info/entry_points.txt,sha256=4deXsMn97I012HhDw0UjoqcZ8eEoZ7BnqaRx5QmzebY,123
18
- nvidia_nat_langchain-1.3.0rc4.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
19
- nvidia_nat_langchain-1.3.0rc4.dist-info/RECORD,,
13
+ nvidia_nat_langchain-1.3.0rc6.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
14
+ nvidia_nat_langchain-1.3.0rc6.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
15
+ nvidia_nat_langchain-1.3.0rc6.dist-info/METADATA,sha256=MoVc-Gjx2mTvpRBrsiBHaTX2XJ6lO2fs3bNQ3csHAnk,2219
16
+ nvidia_nat_langchain-1.3.0rc6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ nvidia_nat_langchain-1.3.0rc6.dist-info/entry_points.txt,sha256=4deXsMn97I012HhDw0UjoqcZ8eEoZ7BnqaRx5QmzebY,123
18
+ nvidia_nat_langchain-1.3.0rc6.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
19
+ nvidia_nat_langchain-1.3.0rc6.dist-info/RECORD,,