nvidia-nat-crewai 1.3.0rc3__py3-none-any.whl → 1.3.0rc5__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.
@@ -154,13 +154,16 @@ class CrewAIProfilerHandler(BaseProfilerCallback):
154
154
  seconds_between_calls = int(now - self.last_call_ts)
155
155
  model_name = kwargs.get('model', "")
156
156
 
157
- model_input = ""
157
+ model_input = []
158
158
  try:
159
159
  for message in kwargs.get('messages', []):
160
- model_input += message.get('content', "")
160
+ content = message.get('content', "")
161
+ model_input.append("" if content is None else str(content))
161
162
  except Exception as e:
162
163
  logger.exception("Error getting model input: %s", e)
163
164
 
165
+ model_input = "".join(model_input)
166
+
164
167
  # Record the start event
165
168
  input_stats = IntermediateStepPayload(
166
169
  event_type=IntermediateStepType.LLM_START,
@@ -177,14 +180,17 @@ class CrewAIProfilerHandler(BaseProfilerCallback):
177
180
  # Call the original litellm.completion(...)
178
181
  output = original_func(*args, **kwargs)
179
182
 
180
- model_output = ""
183
+ model_output = []
181
184
  try:
182
185
  for choice in output.choices:
183
186
  msg = choice.model_extra["message"]
184
- model_output += msg.get('content', "")
187
+ content = msg.get('content', "")
188
+ model_output.append("" if content is None else str(content))
185
189
  except Exception as e:
186
190
  logger.exception("Error getting model output: %s", e)
187
191
 
192
+ model_output = "".join(model_output)
193
+
188
194
  now = time.time()
189
195
  # Record the end event
190
196
  output_stats = IntermediateStepPayload(
nat/plugins/crewai/llm.py CHANGED
@@ -41,8 +41,17 @@ def _patch_llm_based_on_config(client: ModelType, llm_config: LLMBaseConfig) ->
41
41
 
42
42
  @override
43
43
  def inject(self, messages: list[dict[str, str]], *args, **kwargs) -> FunctionArgumentWrapper:
44
- new_messages = [{"role": "system", "content": self.system_prompt}] + messages
45
- return FunctionArgumentWrapper(new_messages, *args, **kwargs)
44
+ # Attempt to inject the system prompt into the first system message
45
+ for i, message in enumerate(messages):
46
+ if message["role"] == "system":
47
+ if self.system_prompt not in message["content"]:
48
+ messages = list(messages)
49
+ messages[i] = {"role": "system", "content": f"{message['content']}\n{self.system_prompt}"}
50
+ break
51
+ else:
52
+ messages = list(messages)
53
+ messages.insert(0, {"role": "system", "content": self.system_prompt})
54
+ return FunctionArgumentWrapper(messages, *args, **kwargs)
46
55
 
47
56
  if isinstance(llm_config, RetryMixin):
48
57
  client = patch_with_retry(client,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nvidia-nat-crewai
3
- Version: 1.3.0rc3
3
+ Version: 1.3.0rc5
4
4
  Summary: Subpackage for CrewAI 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[litellm]==v1.3.0-rc3
19
+ Requires-Dist: nvidia-nat[litellm]==v1.3.0-rc5
20
20
  Requires-Dist: crewai~=0.193.2
21
21
  Dynamic: license-file
22
22
 
@@ -0,0 +1,13 @@
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=il537F5tD9pFL1P9Q38ReOZasD-GgcBrm8BX_w0-xdo,8582
4
+ nat/plugins/crewai/llm.py,sha256=sfQsdSK6WGWHscald4tG4dyXEcn6zqdhkFjE-1zAtJE,5984
5
+ nat/plugins/crewai/register.py,sha256=_R3bhGmz___696_NwyIcpw3koMBiWqIFoWEFJ0VAgXs,831
6
+ nat/plugins/crewai/tool_wrapper.py,sha256=BNKEPQQCLKtXNzGDAKBLCdmGJXe9lBOVI1hObha8hoI,1569
7
+ nvidia_nat_crewai-1.3.0rc5.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
8
+ nvidia_nat_crewai-1.3.0rc5.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
9
+ nvidia_nat_crewai-1.3.0rc5.dist-info/METADATA,sha256=jHmtQrTwc0TvCZLwD2RwD0SpiWfulpckXuU-PdGkeYU,1911
10
+ nvidia_nat_crewai-1.3.0rc5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ nvidia_nat_crewai-1.3.0rc5.dist-info/entry_points.txt,sha256=YF5PUdQGr_OUDXB4TykElHJTsKT8yKkuE0bMX5n_RXs,58
12
+ nvidia_nat_crewai-1.3.0rc5.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
13
+ nvidia_nat_crewai-1.3.0rc5.dist-info/RECORD,,
@@ -1,13 +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=m5u0RqUd94F0iIuUvknhVHn1SxYltg3lxAhN_3AogPQ,8334
4
- nat/plugins/crewai/llm.py,sha256=T57f7hZ5Aa4MUdc6PJLfU6TkF_dO87DWh2KvyAsCt7g,5493
5
- nat/plugins/crewai/register.py,sha256=_R3bhGmz___696_NwyIcpw3koMBiWqIFoWEFJ0VAgXs,831
6
- nat/plugins/crewai/tool_wrapper.py,sha256=BNKEPQQCLKtXNzGDAKBLCdmGJXe9lBOVI1hObha8hoI,1569
7
- nvidia_nat_crewai-1.3.0rc3.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
8
- nvidia_nat_crewai-1.3.0rc3.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
9
- nvidia_nat_crewai-1.3.0rc3.dist-info/METADATA,sha256=EO1Rh-x5tiIWDmTl2TkcqLnipAMxTSwBsJiPqBumuEM,1911
10
- nvidia_nat_crewai-1.3.0rc3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- nvidia_nat_crewai-1.3.0rc3.dist-info/entry_points.txt,sha256=YF5PUdQGr_OUDXB4TykElHJTsKT8yKkuE0bMX5n_RXs,58
12
- nvidia_nat_crewai-1.3.0rc3.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
13
- nvidia_nat_crewai-1.3.0rc3.dist-info/RECORD,,