truefoundry 0.10.4rc1__py3-none-any.whl → 0.10.4rc3__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 truefoundry might be problematic. Click here for more details.

@@ -94,7 +94,6 @@ class AskClient:
94
94
  """Generate authorization headers for connecting to the SSE server."""
95
95
  return {
96
96
  "Authorization": f"Bearer {self.token}",
97
- "X-TFY-Cluster-Id": self.cluster,
98
97
  "X-TFY-Session-Id": self._session_id,
99
98
  }
100
99
 
@@ -317,6 +316,10 @@ class AskClient:
317
316
  turn += 1
318
317
  message = response.choices[0].message
319
318
 
319
+ if not message.content and not message.tool_calls:
320
+ self._log_message("No assistant response. Try again.", log=True)
321
+ break
322
+
320
323
  if message.content:
321
324
  self._append_message(
322
325
  ChatCompletionAssistantMessageParam(
@@ -327,8 +330,7 @@ class AskClient:
327
330
  if message.tool_calls:
328
331
  await self._handle_tool_calls(message, spinner)
329
332
 
330
- if not message.content and not message.tool_calls:
331
- self._log_message("No assistant response.")
333
+ if message.content and not message.tool_calls:
332
334
  break
333
335
  except Exception as e:
334
336
  self._log_message(f"OpenAI call failed: {e}", log=True)
@@ -402,10 +404,16 @@ class AskClient:
402
404
 
403
405
  async def chat_loop(self):
404
406
  """Interactive loop: accepts user queries and returns responses until interrupted or 'exit' is typed."""
407
+ self._append_message(
408
+ ChatCompletionUserMessageParam(
409
+ role="user",
410
+ content=f"Selected cluster: {self.cluster}",
411
+ )
412
+ )
405
413
  self._append_message(
406
414
  ChatCompletionAssistantMessageParam(
407
415
  role="assistant",
408
- content="Hello! How can I help you with your Kubernetes cluster?",
416
+ content="Hello! How can I help you with this Kubernetes cluster?",
409
417
  )
410
418
  )
411
419
 
@@ -2,12 +2,13 @@ import ast
2
2
  import io
3
3
  import json
4
4
  import re
5
- from typing import Dict, List, Optional
5
+ from typing import Any, Dict, List, Optional
6
6
 
7
7
  from rich.console import Console
8
8
  from rich.pretty import pprint
9
9
 
10
10
  from truefoundry.deploy import Application, LocalSource
11
+ from truefoundry.pydantic_v1 import BaseModel
11
12
 
12
13
 
13
14
  def generate_deployment_code(
@@ -16,7 +17,7 @@ def generate_deployment_code(
16
17
  spec_repr: str,
17
18
  workspace_fqn: str,
18
19
  ):
19
- symbols = ",".join(symbols_to_import)
20
+ symbols = ", ".join(symbols_to_import)
20
21
  application_type = application_type.replace(" ", "").replace("-", "_")
21
22
  code = f"""\
22
23
  import logging
@@ -71,7 +72,7 @@ def remove_none_type_fields(code):
71
72
 
72
73
  def remove_type_field(code):
73
74
  lines = code.split("\n")
74
- new_lines = [re.sub(r'^[ \t]*type=[\'"][^"]*[\'"],', "", line) for line in lines]
75
+ new_lines = [re.sub(r'^[ \t]*type=[\'"][^"]*[\'"],?', "", line) for line in lines]
75
76
  return "\n".join(new_lines)
76
77
 
77
78
 
@@ -102,7 +103,7 @@ def add_local_source_comment(code):
102
103
  return "\n".join(new_lines)
103
104
 
104
105
 
105
- def convert_deployment_config_to_python(workspace_fqn: str, application_spec: dict):
106
+ def _convert_deployment_config_to_python(workspace_fqn: str, application_spec: dict):
106
107
  """
107
108
  Convert a deployment config to a python file that can be used to deploy to a workspace
108
109
  """
@@ -142,6 +143,42 @@ def convert_deployment_config_to_python(workspace_fqn: str, application_spec: di
142
143
  return generated_code
143
144
 
144
145
 
146
+ def convert_deployment_config_to_python(
147
+ workspace_fqn: str,
148
+ application_spec: Dict[str, Any],
149
+ exclude_unset: bool = False,
150
+ exclude_defaults: bool = False,
151
+ ):
152
+ original_repr_args = BaseModel.__repr_args__
153
+
154
+ def _patched_repr_args(self: BaseModel):
155
+ _missing = object()
156
+ pairs = []
157
+ for name, value in original_repr_args(self):
158
+ if name is not None:
159
+ model_field = self.__fields__.get(name)
160
+ if model_field is None:
161
+ continue
162
+ if exclude_unset and name not in self.__fields_set__:
163
+ continue
164
+ if (
165
+ exclude_defaults
166
+ and not getattr(model_field, "required", True)
167
+ and getattr(model_field, "default", _missing) == value
168
+ ):
169
+ continue
170
+ pairs.append((name, value))
171
+ return pairs
172
+
173
+ try:
174
+ BaseModel.__repr_args__ = _patched_repr_args
175
+ return _convert_deployment_config_to_python(
176
+ workspace_fqn=workspace_fqn, application_spec=application_spec
177
+ )
178
+ finally:
179
+ BaseModel.__repr_args__ = original_repr_args
180
+
181
+
145
182
  def generate_python_snippet_for_trigger_job(
146
183
  application_fqn: str, command: Optional[str], params: Optional[Dict[str, str]]
147
184
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truefoundry
3
- Version: 0.10.4rc1
3
+ Version: 0.10.4rc3
4
4
  Summary: TrueFoundry CLI
5
5
  Author-email: TrueFoundry Team <abhishek@truefoundry.com>
6
6
  Requires-Python: <3.14,>=3.8.1
@@ -5,7 +5,7 @@ truefoundry/pydantic_v1.py,sha256=jSuhGtz0Mbk1qYu8jJ1AcnIDK4oxUsdhALc4spqstmM,34
5
5
  truefoundry/version.py,sha256=bqiT4Q-VWrTC6P4qfK43mez-Ppf-smWfrl6DcwV7mrw,137
6
6
  truefoundry/_ask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  truefoundry/_ask/cli.py,sha256=zPaDvxhX2dITmPTtut2Iu6WAIaizrwR-U_dDZ6xv2io,5814
8
- truefoundry/_ask/client.py,sha256=4vWO04jWbSF0XD3q8DwXjvL4HW-WBg7nsQ0DydNwHmM,18479
8
+ truefoundry/_ask/client.py,sha256=QWQRiDwmtIlLaZsyGcLZaQstYFzpmJeCRdATMapjL-8,18740
9
9
  truefoundry/_ask/llm_utils.py,sha256=ayjz7JtVu142lrm8t0cVoxLxUpx76b71y8R62z_WurY,13537
10
10
  truefoundry/autodeploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  truefoundry/autodeploy/cli.py,sha256=9ZxKu_MGIpraMzaW4ZyuQZhlKIQYE3biBrBV4S1h6Fo,14167
@@ -53,7 +53,7 @@ truefoundry/common/types.py,sha256=BMJFCsR1lPJAw66IQBSvLyV4I6o_x5oj78gVsUa9si8,1
53
53
  truefoundry/common/utils.py,sha256=j3QP0uOsaGD_VmDDR68JTwoYE1okkAq6OqpVkzVf48Q,6424
54
54
  truefoundry/common/warnings.py,sha256=rs6BHwk7imQYedo07iwh3TWEOywAR3Lqhj0AY4khByg,504
55
55
  truefoundry/deploy/__init__.py,sha256=2GNbI8IGJBotz_IKaqQ-DWYWZn_pSu7lN7aId15Gk7Q,2799
56
- truefoundry/deploy/python_deploy_codegen.py,sha256=AainOFR20XvhNeztJkLPWGZ40lAT_nwc-ZmG77Kum4o,6525
56
+ truefoundry/deploy/python_deploy_codegen.py,sha256=X6cSGQ9_9GxrgIlTLvBWMDz9QnU7hrxieMIutNJe_ng,7784
57
57
  truefoundry/deploy/_autogen/models.py,sha256=xt-DuaRDx5jeRwyGoQH2yyPZAep9Q2MHFW9XBuRzG8E,73161
58
58
  truefoundry/deploy/builder/__init__.py,sha256=kgvlkVkiWpMVdim81tIeLrdoACqrFDgwCqHdQVsCsMo,4988
59
59
  truefoundry/deploy/builder/constants.py,sha256=amUkHoHvVKzGv0v_knfiioRuKiJM0V0xW0diERgWiI0,508
@@ -381,7 +381,7 @@ truefoundry/workflow/remote_filesystem/__init__.py,sha256=LQ95ViEjJ7Ts4JcCGOxMPs
381
381
  truefoundry/workflow/remote_filesystem/logger.py,sha256=em2l7D6sw7xTLDP0kQSLpgfRRCLpN14Qw85TN7ujQcE,1022
382
382
  truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=xcT0wQmQlgzcj0nP3tJopyFSVWT1uv3nhiTIuwfXYeg,12342
383
383
  truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=nSGPZu0Gyd_jz0KsEE-7w_BmnTD8CVF1S8cUJoxaCbc,13305
384
- truefoundry-0.10.4rc1.dist-info/METADATA,sha256=925B7ewlbtV30Q3WkQNhKyq52X2Opd83SSRqsFZpYjY,2508
385
- truefoundry-0.10.4rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
386
- truefoundry-0.10.4rc1.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
387
- truefoundry-0.10.4rc1.dist-info/RECORD,,
384
+ truefoundry-0.10.4rc3.dist-info/METADATA,sha256=DvsgKrey42e5PHmRKl107ZHQeOO-uqsRX-OG7tibhiI,2508
385
+ truefoundry-0.10.4rc3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
386
+ truefoundry-0.10.4rc3.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
387
+ truefoundry-0.10.4rc3.dist-info/RECORD,,