nvidia-nat-langchain 1.2.0rc5__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.
- {aiq → nat}/meta/pypi.md +1 -1
- {aiq → nat}/plugins/langchain/embedder.py +24 -6
- {aiq → nat}/plugins/langchain/llm.py +8 -8
- {aiq → nat}/plugins/langchain/retriever.py +7 -7
- {aiq → nat}/plugins/langchain/tool_wrapper.py +25 -5
- {aiq → nat}/plugins/langchain/tools/code_generation_tool.py +6 -6
- {aiq → nat}/plugins/langchain/tools/tavily_internet_search.py +5 -5
- {aiq → nat}/plugins/langchain/tools/wikipedia_search.py +5 -5
- {nvidia_nat_langchain-1.2.0rc5.dist-info → nvidia_nat_langchain-1.2.0rc6.dist-info}/METADATA +4 -4
- nvidia_nat_langchain-1.2.0rc6.dist-info/RECORD +17 -0
- nvidia_nat_langchain-1.2.0rc6.dist-info/entry_points.txt +3 -0
- nvidia_nat_langchain-1.2.0rc6.dist-info/top_level.txt +1 -0
- nvidia_nat_langchain-1.2.0rc5.dist-info/RECORD +0 -17
- nvidia_nat_langchain-1.2.0rc5.dist-info/entry_points.txt +0 -3
- nvidia_nat_langchain-1.2.0rc5.dist-info/top_level.txt +0 -1
- {aiq → nat}/plugins/langchain/__init__.py +0 -0
- {aiq → nat}/plugins/langchain/register.py +0 -0
- {aiq → nat}/plugins/langchain/tools/__init__.py +0 -0
- {aiq → nat}/plugins/langchain/tools/register.py +0 -0
- {nvidia_nat_langchain-1.2.0rc5.dist-info → nvidia_nat_langchain-1.2.0rc6.dist-info}/WHEEL +0 -0
{aiq → nat}/meta/pypi.md
RENAMED
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
16
16
|
-->
|
17
17
|
|
18
|
-

|
19
19
|
|
20
20
|
# NVIDIA NeMo Agent Toolkit Subpackage
|
21
21
|
This is a subpackage for LangChain and LangGraph integration in NeMo Agent toolkit.
|
@@ -12,13 +12,15 @@
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
|
+
# pylint: disable=unused-argument
|
15
16
|
|
16
|
-
from
|
17
|
-
from
|
18
|
-
from
|
19
|
-
from
|
20
|
-
from
|
21
|
-
from
|
17
|
+
from nat.builder.builder import Builder
|
18
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
19
|
+
from nat.cli.register_workflow import register_embedder_client
|
20
|
+
from nat.data_models.retry_mixin import RetryMixin
|
21
|
+
from nat.embedder.nim_embedder import NIMEmbedderModelConfig
|
22
|
+
from nat.embedder.openai_embedder import OpenAIEmbedderModelConfig
|
23
|
+
from nat.utils.exception_handlers.automatic_retries import patch_with_retry
|
22
24
|
|
23
25
|
|
24
26
|
@register_embedder_client(config_type=OpenAIEmbedderModelConfig, wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
@@ -35,3 +37,19 @@ async def openai_langchain(embedder_config: OpenAIEmbedderModelConfig, builder:
|
|
35
37
|
retry_on_messages=embedder_config.retry_on_errors)
|
36
38
|
|
37
39
|
yield client
|
40
|
+
|
41
|
+
|
42
|
+
@register_embedder_client(config_type=NIMEmbedderModelConfig, wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
43
|
+
async def nim_langchain(embedder_config: NIMEmbedderModelConfig, builder: Builder):
|
44
|
+
|
45
|
+
from langchain_nvidia_ai_endpoints import NVIDIAEmbeddings
|
46
|
+
|
47
|
+
client = NVIDIAEmbeddings(**embedder_config.model_dump(exclude={"type"}, by_alias=True))
|
48
|
+
|
49
|
+
if isinstance(embedder_config, RetryMixin):
|
50
|
+
client = patch_with_retry(client,
|
51
|
+
retries=embedder_config.num_retries,
|
52
|
+
retry_codes=embedder_config.retry_on_status_codes,
|
53
|
+
retry_on_messages=embedder_config.retry_on_errors)
|
54
|
+
|
55
|
+
yield client
|
@@ -13,14 +13,14 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
18
|
-
from
|
19
|
-
from
|
20
|
-
from
|
21
|
-
from
|
22
|
-
from
|
23
|
-
from
|
16
|
+
from nat.builder.builder import Builder
|
17
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
18
|
+
from nat.cli.register_workflow import register_llm_client
|
19
|
+
from nat.data_models.retry_mixin import RetryMixin
|
20
|
+
from nat.llm.aws_bedrock_llm import AWSBedrockModelConfig
|
21
|
+
from nat.llm.nim_llm import NIMModelConfig
|
22
|
+
from nat.llm.openai_llm import OpenAIModelConfig
|
23
|
+
from nat.utils.exception_handlers.automatic_retries import patch_with_retry
|
24
24
|
|
25
25
|
|
26
26
|
@register_llm_client(config_type=NIMModelConfig, wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
@@ -13,17 +13,17 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
18
|
-
from
|
19
|
-
from
|
20
|
-
from
|
16
|
+
from nat.builder.builder import Builder
|
17
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
18
|
+
from nat.cli.register_workflow import register_retriever_client
|
19
|
+
from nat.retriever.milvus.register import MilvusRetrieverConfig
|
20
|
+
from nat.retriever.nemo_retriever.register import NemoRetrieverConfig
|
21
21
|
|
22
22
|
|
23
23
|
@register_retriever_client(config_type=NemoRetrieverConfig, wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
24
24
|
async def nemo_langchain(retriever_config: NemoRetrieverConfig, builder: Builder):
|
25
|
-
from
|
26
|
-
from
|
25
|
+
from nat.retriever.nemo_retriever.retriever import NemoLangchainRetriever
|
26
|
+
from nat.retriever.nemo_retriever.retriever import NemoRetriever
|
27
27
|
|
28
28
|
retriever = NemoRetriever(**retriever_config.model_dump(exclude={"type", "top_k", "collection_name"}))
|
29
29
|
optional_fields = ["collection_name", "top_k", "output_fields"]
|
@@ -13,20 +13,40 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
from
|
19
|
-
from
|
16
|
+
import logging
|
17
|
+
|
18
|
+
from nat.builder.builder import Builder
|
19
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
20
|
+
from nat.builder.function import Function
|
21
|
+
from nat.cli.register_workflow import register_tool_wrapper
|
22
|
+
|
23
|
+
logger = logging.getLogger(__name__)
|
20
24
|
|
21
25
|
|
22
26
|
@register_tool_wrapper(wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
23
|
-
def langchain_tool_wrapper(name: str, fn: Function, builder: Builder):
|
27
|
+
def langchain_tool_wrapper(name: str, fn: Function, builder: Builder): # pylint: disable=unused-argument
|
28
|
+
|
29
|
+
import asyncio
|
24
30
|
|
25
31
|
from langchain_core.tools.structured import StructuredTool
|
26
32
|
|
27
33
|
assert fn.input_schema is not None, "Tool must have input schema"
|
28
34
|
|
35
|
+
loop = asyncio.get_running_loop()
|
36
|
+
|
37
|
+
# Provide a sync wrapper for the tool to support synchronous tool calls
|
38
|
+
def _sync_fn(*args, **kwargs):
|
39
|
+
logger.warning("Invoking a synchronous tool call, performance may be degraded: `%s`", fn.instance_name)
|
40
|
+
return loop.run_until_complete(fn.acall_invoke(*args, **kwargs))
|
41
|
+
|
42
|
+
if fn.description is None:
|
43
|
+
logger.warning("No description set for `%s` falling back to instance name: `%s`",
|
44
|
+
type(fn).__name__,
|
45
|
+
fn.instance_name)
|
46
|
+
_sync_fn.__doc__ = fn.instance_name
|
47
|
+
|
29
48
|
return StructuredTool.from_function(coroutine=fn.acall_invoke,
|
49
|
+
func=_sync_fn,
|
30
50
|
name=name,
|
31
51
|
description=fn.description,
|
32
52
|
args_schema=fn.input_schema)
|
@@ -15,12 +15,12 @@
|
|
15
15
|
|
16
16
|
import logging
|
17
17
|
|
18
|
-
from
|
19
|
-
from
|
20
|
-
from
|
21
|
-
from
|
22
|
-
from
|
23
|
-
from
|
18
|
+
from nat.builder.builder import Builder
|
19
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
20
|
+
from nat.builder.function_info import FunctionInfo
|
21
|
+
from nat.cli.register_workflow import register_function
|
22
|
+
from nat.data_models.component_ref import LLMRef
|
23
|
+
from nat.data_models.function import FunctionBaseConfig
|
24
24
|
|
25
25
|
log = logging.getLogger(__name__)
|
26
26
|
|
@@ -13,10 +13,10 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
18
|
-
from
|
19
|
-
from
|
16
|
+
from nat.builder.builder import Builder
|
17
|
+
from nat.builder.function_info import FunctionInfo
|
18
|
+
from nat.cli.register_workflow import register_function
|
19
|
+
from nat.data_models.function import FunctionBaseConfig
|
20
20
|
|
21
21
|
|
22
22
|
# Internet Search tool
|
@@ -49,7 +49,7 @@ async def tavily_internet_search(tool_config: TavilyInternetSearchToolConfig, bu
|
|
49
49
|
[f'<Document href="{doc["url"]}"/>\n{doc["content"]}\n</Document>' for doc in search_docs])
|
50
50
|
return web_search_results
|
51
51
|
|
52
|
-
# Create a Generic
|
52
|
+
# Create a Generic NAT tool that can be used with any supported LLM framework
|
53
53
|
yield FunctionInfo.from_fn(
|
54
54
|
_tavily_internet_search,
|
55
55
|
description=("""This tool retrieves relevant contexts from web search (using Tavily) for the given question.
|
@@ -13,10 +13,10 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
from
|
17
|
-
from
|
18
|
-
from
|
19
|
-
from
|
16
|
+
from nat.builder.builder import Builder
|
17
|
+
from nat.builder.function_info import FunctionInfo
|
18
|
+
from nat.cli.register_workflow import register_function
|
19
|
+
from nat.data_models.function import FunctionBaseConfig
|
20
20
|
|
21
21
|
|
22
22
|
# Wikipedia Search tool
|
@@ -41,7 +41,7 @@ async def wiki_search(tool_config: WikiSearchToolConfig, builder: Builder):
|
|
41
41
|
])
|
42
42
|
return wiki_search_results
|
43
43
|
|
44
|
-
# Create
|
44
|
+
# Create a NAT wiki search tool that can be used with any supported LLM framework
|
45
45
|
yield FunctionInfo.from_fn(
|
46
46
|
_wiki_search,
|
47
47
|
description=("""This tool retrieves relevant contexts from wikipedia search for the given question.
|
{nvidia_nat_langchain-1.2.0rc5.dist-info → nvidia_nat_langchain-1.2.0rc6.dist-info}/METADATA
RENAMED
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nvidia-nat-langchain
|
3
|
-
Version: 1.2.
|
4
|
-
Summary: Subpackage for LangChain and LangGraph integration in
|
3
|
+
Version: 1.2.0rc6
|
4
|
+
Summary: Subpackage for LangChain and LangGraph integration in NeMo Agent toolkit
|
5
5
|
Keywords: ai,rag,agents
|
6
6
|
Classifier: Programming Language :: Python
|
7
7
|
Requires-Python: <3.13,>=3.11
|
8
8
|
Description-Content-Type: text/markdown
|
9
|
-
Requires-Dist: nvidia-nat
|
9
|
+
Requires-Dist: nvidia-nat==v1.2.0-rc6
|
10
10
|
Requires-Dist: langchain-aws~=0.2.1
|
11
11
|
Requires-Dist: langchain-core~=0.3.7
|
12
12
|
Requires-Dist: langchain-nvidia-ai-endpoints~=0.3.5
|
@@ -32,7 +32,7 @@ See the License for the specific language governing permissions and
|
|
32
32
|
limitations under the License.
|
33
33
|
-->
|
34
34
|
|
35
|
-

|
36
36
|
|
37
37
|
# NVIDIA NeMo Agent Toolkit Subpackage
|
38
38
|
This is a subpackage for LangChain and LangGraph integration in NeMo Agent toolkit.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
nat/meta/pypi.md,sha256=-RewrXPwhrT6398iluvXb5lefn18PybmvRFhmZF7KVI,1124
|
2
|
+
nat/plugins/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
nat/plugins/langchain/embedder.py,sha256=UcDB4GYY0vW3pUiFqqKhNMgAmEZdRSUJUazjThkPHuQ,2519
|
4
|
+
nat/plugins/langchain/llm.py,sha256=i_DffRmQ9PEELuXFYR2ouU0LRkPKAjwZi1z65xGrxws,3293
|
5
|
+
nat/plugins/langchain/register.py,sha256=UwxFY-HsZ5n32XPpqDtLvBamiw1Pdavtf2oYSK_XGtY,938
|
6
|
+
nat/plugins/langchain/retriever.py,sha256=SWbXXOezEUuPACnmSSU497NAmEVEMj2SrFJGodkRg34,2644
|
7
|
+
nat/plugins/langchain/tool_wrapper.py,sha256=dLK09a8lrmytNkIuhTaSByuLdW23aVmIcr3REyuJTMA,2156
|
8
|
+
nat/plugins/langchain/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
+
nat/plugins/langchain/tools/code_generation_tool.py,sha256=qL3HBiOQzVPLw4EiUOWeswckuVX8ynG2UQXYBLxR_gI,2724
|
10
|
+
nat/plugins/langchain/tools/register.py,sha256=3cf4RH2tQ_qOtZviwXQUqK5dKiVUJQYach4djxGpcOU,921
|
11
|
+
nat/plugins/langchain/tools/tavily_internet_search.py,sha256=AnnLRY1xSU4DOzxbB8nFZRjHngXpqatPVOJ7yWV7jVw,2612
|
12
|
+
nat/plugins/langchain/tools/wikipedia_search.py,sha256=431YwLsjoC_mdvMZ_gY0Q37Uqaue2ASnAHpwr4jWCaU,2197
|
13
|
+
nvidia_nat_langchain-1.2.0rc6.dist-info/METADATA,sha256=pllMoYf-NSsiYN89RNHphv4a3FhIzxQcqj-RH0v2QLs,1724
|
14
|
+
nvidia_nat_langchain-1.2.0rc6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
nvidia_nat_langchain-1.2.0rc6.dist-info/entry_points.txt,sha256=4deXsMn97I012HhDw0UjoqcZ8eEoZ7BnqaRx5QmzebY,123
|
16
|
+
nvidia_nat_langchain-1.2.0rc6.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
17
|
+
nvidia_nat_langchain-1.2.0rc6.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
nat
|
@@ -1,17 +0,0 @@
|
|
1
|
-
aiq/meta/pypi.md,sha256=jxJ0L4icshSNDFo-5xV1OQrSqK9R31Lx4K6Tg3oXP44,1135
|
2
|
-
aiq/plugins/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
aiq/plugins/langchain/embedder.py,sha256=MU63gh_hWNojlB6AG8WpER-3GIUan5CUIpm6_YOf9xg,1727
|
4
|
-
aiq/plugins/langchain/llm.py,sha256=5M-Q0DKycb_RWLj7SQWmEOpkpSHlXijC0Cus9deKhv8,3293
|
5
|
-
aiq/plugins/langchain/register.py,sha256=UwxFY-HsZ5n32XPpqDtLvBamiw1Pdavtf2oYSK_XGtY,938
|
6
|
-
aiq/plugins/langchain/retriever.py,sha256=P6PdppeQbROalO69w1Q4U-1f6hpdMor0fOEATb4SDw0,2644
|
7
|
-
aiq/plugins/langchain/tool_wrapper.py,sha256=XDh9JBC5X9pTmTtfBsc4zLAjDMIjaYV5P8g8LIB83W0,1407
|
8
|
-
aiq/plugins/langchain/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
aiq/plugins/langchain/tools/code_generation_tool.py,sha256=ArBhVXgk9KMvF4VHz4SKwGCSbmG-RAN9DmsCljRY4Uo,2724
|
10
|
-
aiq/plugins/langchain/tools/register.py,sha256=3cf4RH2tQ_qOtZviwXQUqK5dKiVUJQYach4djxGpcOU,921
|
11
|
-
aiq/plugins/langchain/tools/tavily_internet_search.py,sha256=zB-GpqGzJ1_73_DjOlhsEBajyFEnvYVMlD_ObOr7lSM,2620
|
12
|
-
aiq/plugins/langchain/tools/wikipedia_search.py,sha256=qPPQg0nUwjrVTTmo3CH9s13QyiNBnsaue6vFEggqCLo,2206
|
13
|
-
nvidia_nat_langchain-1.2.0rc5.dist-info/METADATA,sha256=QGFTWeNsT7losdEf_VhAtv7E9PZRHJJH5a3xkCZ-wAc,1720
|
14
|
-
nvidia_nat_langchain-1.2.0rc5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
-
nvidia_nat_langchain-1.2.0rc5.dist-info/entry_points.txt,sha256=WoapTU8bMDFxwRqT6eATj3l6kr15fHwifvfsjpuxAnA,123
|
16
|
-
nvidia_nat_langchain-1.2.0rc5.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
|
17
|
-
nvidia_nat_langchain-1.2.0rc5.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
aiq
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|