nvidia-nat-agno 1.3.0a20250827__py3-none-any.whl → 1.3.0a20250829__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/plugins/agno/llm.py +56 -42
- nat/plugins/agno/tool_wrapper.py +1 -4
- {nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/METADATA +2 -2
- {nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/RECORD +7 -7
- {nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/WHEEL +0 -0
- {nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/top_level.txt +0 -0
nat/plugins/agno/llm.py
CHANGED
@@ -13,75 +13,89 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
import
|
16
|
+
from typing import TypeVar
|
17
17
|
|
18
18
|
from nat.builder.builder import Builder
|
19
19
|
from nat.builder.framework_enum import LLMFrameworkEnum
|
20
20
|
from nat.cli.register_workflow import register_llm_client
|
21
|
+
from nat.data_models.llm import LLMBaseConfig
|
21
22
|
from nat.data_models.retry_mixin import RetryMixin
|
23
|
+
from nat.data_models.thinking_mixin import ThinkingMixin
|
22
24
|
from nat.llm.nim_llm import NIMModelConfig
|
23
25
|
from nat.llm.openai_llm import OpenAIModelConfig
|
26
|
+
from nat.llm.utils.thinking import BaseThinkingInjector
|
27
|
+
from nat.llm.utils.thinking import FunctionArgumentWrapper
|
28
|
+
from nat.llm.utils.thinking import patch_with_thinking
|
24
29
|
from nat.utils.exception_handlers.automatic_retries import patch_with_retry
|
30
|
+
from nat.utils.type_utils import override
|
25
31
|
|
32
|
+
ModelType = TypeVar("ModelType")
|
26
33
|
|
27
|
-
@register_llm_client(config_type=NIMModelConfig, wrapper_type=LLMFrameworkEnum.AGNO)
|
28
|
-
async def nim_agno(llm_config: NIMModelConfig, builder: Builder):
|
29
34
|
|
30
|
-
|
35
|
+
def _patch_llm_based_on_config(client: ModelType, llm_config: LLMBaseConfig) -> ModelType:
|
31
36
|
|
32
|
-
|
33
|
-
**llm_config.model_dump(exclude={"type", "model_name"}, by_alias=True),
|
34
|
-
"id": f"{llm_config.model_name}",
|
35
|
-
}
|
37
|
+
from agno.models.message import Message
|
36
38
|
|
37
|
-
|
38
|
-
if ("api_key" not in config_obj or config_obj["api_key"] is None):
|
39
|
+
class AgnoThinkingInjector(BaseThinkingInjector):
|
39
40
|
|
40
|
-
|
41
|
-
# Dont need to do anything. User has already set the correct key
|
42
|
-
pass
|
43
|
-
else:
|
44
|
-
nvidai_api_key = os.getenv("NVIDIA_API_KEY")
|
41
|
+
from agno.models.message import Message
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
@override
|
44
|
+
def inject(self, messages: list[Message], *args, **kwargs) -> FunctionArgumentWrapper:
|
45
|
+
new_messages = [Message(role="system", content=self.system_prompt)] + messages
|
46
|
+
return FunctionArgumentWrapper(new_messages, *args, **kwargs)
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
if isinstance(llm_config, ThinkingMixin) and llm_config.thinking_system_prompt is not None:
|
49
|
+
client = patch_with_thinking(
|
50
|
+
client,
|
51
|
+
AgnoThinkingInjector(system_prompt=llm_config.thinking_system_prompt,
|
52
|
+
function_names=[
|
53
|
+
"invoke_stream",
|
54
|
+
"invoke",
|
55
|
+
"ainvoke",
|
56
|
+
"ainvoke_stream",
|
57
|
+
]))
|
58
58
|
|
59
|
+
if isinstance(llm_config, RetryMixin):
|
59
60
|
client = patch_with_retry(client,
|
60
61
|
retries=llm_config.num_retries,
|
61
62
|
retry_codes=llm_config.retry_on_status_codes,
|
62
63
|
retry_on_messages=llm_config.retry_on_errors)
|
63
64
|
|
64
|
-
|
65
|
+
return client
|
65
66
|
|
66
67
|
|
67
|
-
@register_llm_client(config_type=
|
68
|
-
async def
|
68
|
+
@register_llm_client(config_type=NIMModelConfig, wrapper_type=LLMFrameworkEnum.AGNO)
|
69
|
+
async def nim_agno(llm_config: NIMModelConfig, _builder: Builder):
|
69
70
|
|
70
|
-
from agno.models.
|
71
|
+
from agno.models.nvidia import Nvidia
|
72
|
+
|
73
|
+
config_obj = {
|
74
|
+
**llm_config.model_dump(
|
75
|
+
exclude={"type", "model_name"},
|
76
|
+
by_alias=True,
|
77
|
+
exclude_none=True,
|
78
|
+
),
|
79
|
+
}
|
71
80
|
|
72
|
-
|
73
|
-
kwargs = llm_config.model_dump(exclude={"type"}, by_alias=True)
|
81
|
+
client = Nvidia(**config_obj, id=llm_config.model_name)
|
74
82
|
|
75
|
-
|
76
|
-
if "model" in kwargs:
|
77
|
-
kwargs["id"] = kwargs.pop("model")
|
83
|
+
yield _patch_llm_based_on_config(client, llm_config)
|
78
84
|
|
79
|
-
client = OpenAIChat(**kwargs)
|
80
85
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
+
@register_llm_client(config_type=OpenAIModelConfig, wrapper_type=LLMFrameworkEnum.AGNO)
|
87
|
+
async def openai_agno(llm_config: OpenAIModelConfig, _builder: Builder):
|
88
|
+
|
89
|
+
from agno.models.openai import OpenAIChat
|
90
|
+
|
91
|
+
config_obj = {
|
92
|
+
**llm_config.model_dump(
|
93
|
+
exclude={"type", "model_name"},
|
94
|
+
by_alias=True,
|
95
|
+
exclude_none=True,
|
96
|
+
),
|
97
|
+
}
|
98
|
+
|
99
|
+
client = OpenAIChat(**config_obj, id=llm_config.model_name)
|
86
100
|
|
87
|
-
yield client
|
101
|
+
yield _patch_llm_based_on_config(client, llm_config)
|
nat/plugins/agno/tool_wrapper.py
CHANGED
@@ -17,7 +17,6 @@ import asyncio
|
|
17
17
|
import json
|
18
18
|
import logging
|
19
19
|
import textwrap
|
20
|
-
import traceback
|
21
20
|
from typing import Any
|
22
21
|
from typing import Awaitable
|
23
22
|
from typing import Callable
|
@@ -287,9 +286,7 @@ def execute_agno_tool(name: str,
|
|
287
286
|
return process_future.result(timeout=30) # 30-second timeout for processing
|
288
287
|
|
289
288
|
except Exception as e:
|
290
|
-
logger.
|
291
|
-
error_traceback = traceback.format_exc()
|
292
|
-
logger.error(f"Exception traceback: {error_traceback}")
|
289
|
+
logger.error("Error executing Agno tool %s: %s", name, e)
|
293
290
|
raise
|
294
291
|
|
295
292
|
|
{nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/METADATA
RENAMED
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nvidia-nat-agno
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.0a20250829
|
4
4
|
Summary: Subpackage for Agno 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==v1.3.
|
9
|
+
Requires-Dist: nvidia-nat==v1.3.0a20250829
|
10
10
|
Requires-Dist: agno~=1.2.3
|
11
11
|
Requires-Dist: openai~=1.66
|
12
12
|
Requires-Dist: google-search-results~=2.4.2
|
{nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/RECORD
RENAMED
@@ -1,13 +1,13 @@
|
|
1
1
|
nat/meta/pypi.md,sha256=tZD7hiOSYWgiAdddD1eIJ8T5ipZwEIjnd8ilgmasdmw,1198
|
2
2
|
nat/plugins/agno/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
nat/plugins/agno/llm.py,sha256=
|
3
|
+
nat/plugins/agno/llm.py,sha256=QWJAQopnsb51efVkTHYsyolvkBB09dFSLpwjn847qTY,3804
|
4
4
|
nat/plugins/agno/register.py,sha256=q-es1KVb_PTHOFszltym7e7Pj2jmyieih_Ve-cguHI8,788
|
5
|
-
nat/plugins/agno/tool_wrapper.py,sha256=
|
5
|
+
nat/plugins/agno/tool_wrapper.py,sha256=lzXjusqh25uLFKmNHhWFnagCLtBV-o6odRUOqr4egV0,15725
|
6
6
|
nat/plugins/agno/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
nat/plugins/agno/tools/register.py,sha256=mpNgD1r51EoYlQiEAqPX15wCtx2alDcMIQiR8F_ub-M,743
|
8
8
|
nat/plugins/agno/tools/serp_api_tool.py,sha256=AJQH6-1iEUUrk_nzfZ3zZqutEKhJ_LMOUJi_iol65Sc,4442
|
9
|
-
nvidia_nat_agno-1.3.
|
10
|
-
nvidia_nat_agno-1.3.
|
11
|
-
nvidia_nat_agno-1.3.
|
12
|
-
nvidia_nat_agno-1.3.
|
13
|
-
nvidia_nat_agno-1.3.
|
9
|
+
nvidia_nat_agno-1.3.0a20250829.dist-info/METADATA,sha256=tBLKkU4w_FrUNjiuSenF6YVZBKdAE1Cx5IvL1Vhed6w,1609
|
10
|
+
nvidia_nat_agno-1.3.0a20250829.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
+
nvidia_nat_agno-1.3.0a20250829.dist-info/entry_points.txt,sha256=qRhuHKj2WmdJkLpbVXpYkdtc2cZdG4LPlBsABG2ImVI,103
|
12
|
+
nvidia_nat_agno-1.3.0a20250829.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
13
|
+
nvidia_nat_agno-1.3.0a20250829.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{nvidia_nat_agno-1.3.0a20250827.dist-info → nvidia_nat_agno-1.3.0a20250829.dist-info}/top_level.txt
RENAMED
File without changes
|