nvidia-nat-crewai 1.3.dev0__py3-none-any.whl → 1.3.0.dev2__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/crewai/llm.py +48 -2
- {nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/METADATA +2 -2
- nvidia_nat_crewai-1.3.0.dev2.dist-info/RECORD +11 -0
- nvidia_nat_crewai-1.3.dev0.dist-info/RECORD +0 -11
- {nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/WHEEL +0 -0
- {nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/top_level.txt +0 -0
nat/plugins/crewai/llm.py
CHANGED
@@ -19,13 +19,59 @@ 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
21
|
from nat.data_models.retry_mixin import RetryMixin
|
22
|
+
from nat.llm.azure_openai_llm import AzureOpenAIModelConfig
|
22
23
|
from nat.llm.nim_llm import NIMModelConfig
|
23
24
|
from nat.llm.openai_llm import OpenAIModelConfig
|
24
25
|
from nat.utils.exception_handlers.automatic_retries import patch_with_retry
|
25
26
|
|
26
27
|
|
28
|
+
@register_llm_client(config_type=AzureOpenAIModelConfig, wrapper_type=LLMFrameworkEnum.CREWAI)
|
29
|
+
async def azure_openai_crewai(llm_config: AzureOpenAIModelConfig, _builder: Builder):
|
30
|
+
|
31
|
+
from crewai import LLM
|
32
|
+
|
33
|
+
# https://docs.crewai.com/en/concepts/llms#azure
|
34
|
+
|
35
|
+
config_obj = {
|
36
|
+
**llm_config.model_dump(exclude={
|
37
|
+
"type",
|
38
|
+
"api_key",
|
39
|
+
"azure_endpoint",
|
40
|
+
"azure_deployment",
|
41
|
+
}, by_alias=True),
|
42
|
+
}
|
43
|
+
|
44
|
+
api_key = config_obj.get("api_key") or os.environ.get("AZURE_OPENAI_API_KEY") or os.environ.get("AZURE_API_KEY")
|
45
|
+
if api_key is None:
|
46
|
+
raise ValueError("Azure API key is not set")
|
47
|
+
os.environ["AZURE_API_KEY"] = api_key
|
48
|
+
api_base = (config_obj.get("azure_endpoint") or os.environ.get("AZURE_OPENAI_ENDPOINT")
|
49
|
+
or os.environ.get("AZURE_API_BASE"))
|
50
|
+
if api_base is None:
|
51
|
+
raise ValueError("Azure endpoint is not set")
|
52
|
+
os.environ["AZURE_API_BASE"] = api_base
|
53
|
+
|
54
|
+
os.environ["AZURE_API_VERSION"] = llm_config.api_version
|
55
|
+
model = config_obj.get("azure_deployment") or os.environ.get("AZURE_MODEL_DEPLOYMENT")
|
56
|
+
if model is None:
|
57
|
+
raise ValueError("Azure model deployment is not set")
|
58
|
+
|
59
|
+
config_obj["model"] = model
|
60
|
+
|
61
|
+
client = LLM(**config_obj)
|
62
|
+
|
63
|
+
if isinstance(llm_config, RetryMixin):
|
64
|
+
|
65
|
+
client = patch_with_retry(client,
|
66
|
+
retries=llm_config.num_retries,
|
67
|
+
retry_codes=llm_config.retry_on_status_codes,
|
68
|
+
retry_on_messages=llm_config.retry_on_errors)
|
69
|
+
|
70
|
+
yield client
|
71
|
+
|
72
|
+
|
27
73
|
@register_llm_client(config_type=NIMModelConfig, wrapper_type=LLMFrameworkEnum.CREWAI)
|
28
|
-
async def nim_crewai(llm_config: NIMModelConfig,
|
74
|
+
async def nim_crewai(llm_config: NIMModelConfig, _builder: Builder):
|
29
75
|
|
30
76
|
from crewai import LLM
|
31
77
|
|
@@ -60,7 +106,7 @@ async def nim_crewai(llm_config: NIMModelConfig, builder: Builder):
|
|
60
106
|
|
61
107
|
|
62
108
|
@register_llm_client(config_type=OpenAIModelConfig, wrapper_type=LLMFrameworkEnum.CREWAI)
|
63
|
-
async def openai_crewai(llm_config: OpenAIModelConfig,
|
109
|
+
async def openai_crewai(llm_config: OpenAIModelConfig, _builder: Builder):
|
64
110
|
|
65
111
|
from crewai import LLM
|
66
112
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nvidia-nat-crewai
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.0.dev2
|
4
4
|
Summary: Subpackage for CrewAI 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.0-dev2
|
10
10
|
Requires-Dist: crewai~=0.95.0
|
11
11
|
|
12
12
|
<!--
|
@@ -0,0 +1,11 @@
|
|
1
|
+
nat/meta/pypi.md,sha256=T68FnThRzDGFf1LR8u-okM-r11-skSnKqSyI6HOktQY,1107
|
2
|
+
nat/plugins/crewai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
nat/plugins/crewai/crewai_callback_handler.py,sha256=LDOctDQC9qdba1SVGoVkceCOSYuDj_mnl3HCuq2nIuQ,8382
|
4
|
+
nat/plugins/crewai/llm.py,sha256=ErsUXsHpQ-chWqFhYjp-OhARAnCl-HdV_tkrrTZzIOU,4665
|
5
|
+
nat/plugins/crewai/register.py,sha256=RKXyuaXy4ftA5IL2RrCofIBjpie_-2lP9YZoHAiyPU0,863
|
6
|
+
nat/plugins/crewai/tool_wrapper.py,sha256=BNKEPQQCLKtXNzGDAKBLCdmGJXe9lBOVI1hObha8hoI,1569
|
7
|
+
nvidia_nat_crewai-1.3.0.dev2.dist-info/METADATA,sha256=WnIqCrZBOK3zpDqC789LaKaFJ1RO3L0XQDXWxTcMjT0,1445
|
8
|
+
nvidia_nat_crewai-1.3.0.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
nvidia_nat_crewai-1.3.0.dev2.dist-info/entry_points.txt,sha256=YF5PUdQGr_OUDXB4TykElHJTsKT8yKkuE0bMX5n_RXs,58
|
10
|
+
nvidia_nat_crewai-1.3.0.dev2.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
11
|
+
nvidia_nat_crewai-1.3.0.dev2.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
nat/meta/pypi.md,sha256=T68FnThRzDGFf1LR8u-okM-r11-skSnKqSyI6HOktQY,1107
|
2
|
-
nat/plugins/crewai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
nat/plugins/crewai/crewai_callback_handler.py,sha256=LDOctDQC9qdba1SVGoVkceCOSYuDj_mnl3HCuq2nIuQ,8382
|
4
|
-
nat/plugins/crewai/llm.py,sha256=_ykUOFJCc9czWPGQZIfQerfqH_cGZfjZ09U297I4xuo,3000
|
5
|
-
nat/plugins/crewai/register.py,sha256=RKXyuaXy4ftA5IL2RrCofIBjpie_-2lP9YZoHAiyPU0,863
|
6
|
-
nat/plugins/crewai/tool_wrapper.py,sha256=BNKEPQQCLKtXNzGDAKBLCdmGJXe9lBOVI1hObha8hoI,1569
|
7
|
-
nvidia_nat_crewai-1.3.dev0.dist-info/METADATA,sha256=BtcRz8pDXVcK_giQGeY0N8xmWPs9k5mP79aFwgIEYE0,1440
|
8
|
-
nvidia_nat_crewai-1.3.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
-
nvidia_nat_crewai-1.3.dev0.dist-info/entry_points.txt,sha256=YF5PUdQGr_OUDXB4TykElHJTsKT8yKkuE0bMX5n_RXs,58
|
10
|
-
nvidia_nat_crewai-1.3.dev0.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
11
|
-
nvidia_nat_crewai-1.3.dev0.dist-info/RECORD,,
|
File without changes
|
{nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/entry_points.txt
RENAMED
File without changes
|
{nvidia_nat_crewai-1.3.dev0.dist-info → nvidia_nat_crewai-1.3.0.dev2.dist-info}/top_level.txt
RENAMED
File without changes
|