DeepFabric 4.7.1__py3-none-any.whl → 4.8.1__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.
@@ -24,6 +24,25 @@ from .reporters import BaseReporter, CloudReporter, FileReporter, MultiReporter
24
24
 
25
25
  console = Console()
26
26
 
27
+ # Mapping for legacy conversation_type values
28
+ _CONVERSATION_TYPE_ALIASES = {
29
+ "chain_of_thought": "cot",
30
+ }
31
+
32
+
33
+ def _normalize_conversation_type(value: str) -> str:
34
+ """Normalize conversation_type to valid values.
35
+
36
+ Handles legacy values like 'chain_of_thought' -> 'cot'.
37
+
38
+ Args:
39
+ value: Raw conversation_type value from dataset
40
+
41
+ Returns:
42
+ Normalized value ('basic' or 'cot')
43
+ """
44
+ return _CONVERSATION_TYPE_ALIASES.get(value, value)
45
+
27
46
 
28
47
  class EvaluatorConfig(BaseModel):
29
48
  """Configuration for evaluation run."""
@@ -247,9 +266,10 @@ class Evaluator:
247
266
  # Convert sample dict to Conversation object
248
267
  conversation = Conversation.model_validate(sample)
249
268
 
250
- # Determine conversation type from metadata
269
+ # Determine conversation type from metadata (normalize legacy values)
251
270
  metadata = conversation.metadata or {}
252
- conv_type = metadata.get("conversation_type", "basic")
271
+ raw_conv_type = metadata.get("conversation_type", "basic")
272
+ conv_type = _normalize_conversation_type(raw_conv_type)
253
273
  reasoning_style = metadata.get("reasoning_style")
254
274
  agent_mode = metadata.get("agent_mode")
255
275
 
deepfabric/schemas.py CHANGED
@@ -4,11 +4,12 @@ import logging
4
4
  import re
5
5
  import secrets
6
6
  import string
7
+ import warnings
7
8
 
8
9
  from decimal import ROUND_HALF_UP, Decimal
9
10
  from typing import Annotated, Any, Literal
10
11
 
11
- from pydantic import BaseModel, BeforeValidator, Field, field_validator
12
+ from pydantic import BaseModel, BeforeValidator, Field, field_validator, model_validator
12
13
 
13
14
  logger = logging.getLogger(__name__)
14
15
 
@@ -796,15 +797,35 @@ class ReasoningTrace(BaseModel):
796
797
  class ToolContext(BaseModel):
797
798
  """Tool execution history - present when tools are used.
798
799
 
799
- Note: available_tools has been removed as it was redundant with the
800
- top-level 'tools' field in Conversation. Use 'tools' for the OpenAI-format
801
- tool definitions needed by chat templates.
800
+ Note: available_tools has been deprecated in favor of the top-level 'tools'
801
+ field in Conversation. Use 'tools' for the OpenAI-format tool definitions
802
+ needed by chat templates. The field is kept here for backward compatibility
803
+ with existing datasets.
802
804
  """
803
805
 
804
806
  executions: list[ToolExecution] = Field(
805
807
  default_factory=list,
806
808
  description="Tool executions performed during the conversation (may be empty if agent answered without tools)",
807
809
  )
810
+ # Deprecated: kept for backward compatibility with existing datasets
811
+ available_tools: list[dict[str, Any]] | None = Field(
812
+ default=None,
813
+ description="Deprecated: Use top-level 'tools' field instead. Kept for backward compatibility.",
814
+ )
815
+
816
+ @model_validator(mode="after")
817
+ def warn_on_deprecated_available_tools(self) -> "ToolContext":
818
+ """Warn if the deprecated `available_tools` field is used."""
819
+ if self.available_tools is not None:
820
+ warnings.warn(
821
+ (
822
+ "'tool_context.available_tools' is deprecated and will be removed in a future version. "
823
+ "Use the top-level 'tools' field in Conversation instead."
824
+ ),
825
+ DeprecationWarning,
826
+ stacklevel=2,
827
+ )
828
+ return self
808
829
 
809
830
  class Config:
810
831
  extra = "forbid"
@@ -28,7 +28,7 @@ Usage:
28
28
 
29
29
  Environment Variables:
30
30
  DEEPFABRIC_API_KEY: API key for authentication
31
- DEEPFABRIC_API_URL: SaaS backend URL (default: https://api.deepfabric.ai)
31
+ DEEPFABRIC_API_URL: SaaS backend URL (default: https://api.deepfabric.cloud)
32
32
  """
33
33
 
34
34
  from __future__ import annotations
@@ -127,9 +127,9 @@ def _show_notebook_prompt() -> str | None:
127
127
  </div>
128
128
  <p style="margin: 0; font-size: 14px; opacity: 0.9;">
129
129
  Enter your API key to automatically log training metrics.<br>
130
- Get your key at <a href="https://app.deepfabric.ai/settings/api"
130
+ You can create a key from your profile page: <a href="https://deepfabric.cloud/profile"
131
131
  target="_blank" style="color: #fff; text-decoration: underline;">
132
- app.deepfabric.ai/settings/api</a>
132
+ deepfabric.cloud/profile</a>
133
133
  </p>
134
134
  </div>
135
135
  """
@@ -182,8 +182,8 @@ def _show_colab_prompt() -> str | None:
182
182
  </div>
183
183
  <p style="margin: 0; font-size: 14px; opacity: 0.9;">
184
184
  Enter your API key below to log training metrics.<br>
185
- Get your key at <a href="https://app.deepfabric.ai/settings/api"
186
- target="_blank" style="color: #fff;">app.deepfabric.ai/settings/api</a><br>
185
+ You can create a key from your profile page: <a href="https://deepfabric.cloud/profile"
186
+ target="_blank" style="color: #fff;">deepfabric.cloud/profile</a><br>
187
187
  <em>Press Enter without typing to skip.</em>
188
188
  </p>
189
189
  </div>
@@ -211,7 +211,7 @@ def _show_terminal_prompt() -> str | None:
211
211
  print("=" * 60)
212
212
  print()
213
213
  print(" Enter your API key to log training metrics to DeepFabric.")
214
- print(" Get your key at: https://app.deepfabric.ai/settings/api")
214
+ print(" You can create a key from your profile page: https://deepfabric.cloud/profile")
215
215
  print()
216
216
  print(" Press Enter without typing to skip (disable logging).")
217
217
  print()
@@ -43,7 +43,7 @@ class DeepFabricCallback:
43
43
 
44
44
  Environment Variables:
45
45
  DEEPFABRIC_API_KEY: API key (alternative to constructor arg)
46
- DEEPFABRIC_API_URL: Backend URL (default: https://api.deepfabric.ai)
46
+ DEEPFABRIC_API_URL: Backend URL (default: https://api.deepfabric.cloud)
47
47
  """
48
48
 
49
49
  def __init__(
@@ -67,7 +67,7 @@ class DeepFabricCallback:
67
67
  """
68
68
  # Get API key from arg, env, or prompt
69
69
  self.api_key = api_key or get_api_key()
70
- self.endpoint = endpoint or os.getenv("DEEPFABRIC_API_URL", "https://api.deepfabric.ai")
70
+ self.endpoint = endpoint or os.getenv("DEEPFABRIC_API_URL", "https://api.deepfabric.cloud")
71
71
  self.pipeline_id = pipeline_id or self._get_pipeline_id()
72
72
  self.run_id = str(uuid.uuid4())
73
73
  self.enabled = enabled and self.api_key is not None
@@ -298,9 +298,10 @@ class DeepFabricCallback:
298
298
  Returns:
299
299
  Model name or None
300
300
  """
301
- # Try args first
302
- if hasattr(args, "model_name_or_path"):
303
- return args.model_name_or_path
301
+ # Try args first (model_name_or_path exists on SFTConfig and similar subclasses)
302
+ model_name_or_path = getattr(args, "model_name_or_path", None)
303
+ if model_name_or_path is not None:
304
+ return model_name_or_path
304
305
 
305
306
  # Try model config
306
307
  if model is not None:
@@ -310,8 +311,9 @@ class DeepFabricCallback:
310
311
  return model.name_or_path
311
312
 
312
313
  # Try output_dir as fallback
313
- if hasattr(args, "output_dir"):
314
- return os.path.basename(args.output_dir)
314
+ output_dir = getattr(args, "output_dir", None)
315
+ if output_dir is not None:
316
+ return os.path.basename(output_dir)
315
317
 
316
318
  return None
317
319
 
@@ -24,7 +24,7 @@ class MetricsSender:
24
24
 
25
25
  Example:
26
26
  sender = MetricsSender(
27
- endpoint="https://api.deepfabric.ai",
27
+ endpoint="https://api.deepfabric.cloud",
28
28
  api_key="your-api-key",
29
29
  )
30
30
  sender.send_metrics({"loss": 2.5, "step": 100})
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DeepFabric
3
- Version: 4.7.1
3
+ Version: 4.8.1
4
4
  Summary: Curate High Quality Datasets, Train, Evaluate and Ship
5
- Author-email: Luke Hinds <luke@alwaysfurther.ai>
5
+ Author-email: DeepFabric Team <oss@alwaysfurther.ai>
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.10
8
8
  Requires-Dist: accelerate>=0.20.0
@@ -21,7 +21,7 @@ deepfabric/loader.py,sha256=YNTGZZE-POjR0BIlx6WCT4bIzf0T4lW_fQl7ev9UFqE,18584
21
21
  deepfabric/metrics.py,sha256=iwtNHBX4ZTYUg2FZgtFcG3U0e9RlV2c1cm1Kp34FeWU,6129
22
22
  deepfabric/progress.py,sha256=3XQQrf2pUZlyd-8eRcNATH1v0Oi8JMedVHGbhPcca-8,9354
23
23
  deepfabric/prompts.py,sha256=JVFMeeBa2qqOMvmP_xx8bWzZ6ot9eyqOP3u8XzzPx3g,10290
24
- deepfabric/schemas.py,sha256=bBI1zOgsL05dIOpc-MBUS2p5zKhHr5roCjIfVNPFj2w,36466
24
+ deepfabric/schemas.py,sha256=ckzAjDc6IlC8Y-Pi2hyYRqcSwARX7z_GELuCypXuSgI,37401
25
25
  deepfabric/stream_simulator.py,sha256=GzvAxWxHVsuTwgXlqwXNfrTUDn6sND2kJOoQuYg88FA,3028
26
26
  deepfabric/topic_manager.py,sha256=6YxMO6dQHaGyxghsI8iNJGP1miaekBe5Mh1WdYeLqdI,11164
27
27
  deepfabric/topic_model.py,sha256=i_wYpw2kUl8NLodOSaqNu-C4_d6caYT1kPe_vkKjoyw,707
@@ -31,7 +31,7 @@ deepfabric/update_checker.py,sha256=AUa9iUdkGNzu7tWkQRxIlF19YRmKLetwxu-Ys2ONS8Y,
31
31
  deepfabric/utils.py,sha256=ve6tku_-jgW_ZIkh9osUEQ3C_03J6R_zOw0Xf5UGJYc,4891
32
32
  deepfabric/validation.py,sha256=1x1X_45kyI0w_FCdUiNdvy4LQu3B0KVR-fyvLkrKEGw,5125
33
33
  deepfabric/evaluation/__init__.py,sha256=7xMLmYXaNC1U7qf88S9fMxWTABoDRiOcimSYfCt_PSo,1224
34
- deepfabric/evaluation/evaluator.py,sha256=ExUrL5Zil4DzibzjzngA7dfxnmGIVp9H7319FhLHYmk,33918
34
+ deepfabric/evaluation/evaluator.py,sha256=qNowle5v2ukDJ11igNOCParlBfXT8QUeOvXx6sSJ_Ug,34480
35
35
  deepfabric/evaluation/inference.py,sha256=y7JA0IsBDwe0sJzVQeItYHAV5wUJn6Bjp1Wsp3r7qYQ,7644
36
36
  deepfabric/evaluation/metrics.py,sha256=ITNevYj7CBXzYs-rYhsihO6-rE9n30CYRaVUfdTbcFQ,12026
37
37
  deepfabric/evaluation/parser.py,sha256=AXyiCtNV4rueZQxLE_GqqkFNeDAewGoC--0vXHW-jW8,10603
@@ -64,13 +64,13 @@ deepfabric/tools/__init__.py,sha256=hV65lJmVH2qrWCvzHb-IS3VxYP9lal1j8-J3DzBGieM,
64
64
  deepfabric/tools/defaults.py,sha256=NcvrYo88OC1ID4U0CuKg_WYKz2pwFowsjBjSMZip-bI,2372
65
65
  deepfabric/tools/loader.py,sha256=Bv56D-76JChlK_QXfHLw_rneGLZYRhkn5ETbJMIdJsA,2910
66
66
  deepfabric/tools/mcp_client.py,sha256=uQRrlDSVwF0ZatOl9bidBNU7IgXgJKQU-xG50dK0Uy4,23377
67
- deepfabric/training/__init__.py,sha256=MqIyBnloX-4_zqAgoEaGzKXTVXroi40wEs4V7lbQNqk,1563
68
- deepfabric/training/api_key_prompt.py,sha256=bzcdzeK6ql_8Vz0cbR2vmxxtMRNRFpzYAJx7i8GNI3U,9315
69
- deepfabric/training/callback.py,sha256=vYh7nnCNf3xhbJEamWBKNXW4T7XNazXvmRqEkFyIwXI,13045
67
+ deepfabric/training/__init__.py,sha256=MJazTELfrTB15rIiCE04hDeUL8LSSg4-4LWWG6j2BRw,1566
68
+ deepfabric/training/api_key_prompt.py,sha256=pSIMX3eDGyV9x_r7MHE4TyIsIB2SqYb8gKCdAtTY-q8,9371
69
+ deepfabric/training/callback.py,sha256=5zdifbHA2PWILHl2cVFyO65aW7cGAQhcvDqm3s8_I0Q,13221
70
70
  deepfabric/training/dataset_utils.py,sha256=klx8DoawEwuMigBDP-RpMAfe7FvYxRbhj599MErxBr4,7313
71
- deepfabric/training/metrics_sender.py,sha256=_x0Has8ZR8ehXsdmv3nJbRDml5ioju4hZFv5ndsldpQ,10830
72
- deepfabric-4.7.1.dist-info/METADATA,sha256=FFTmSpKgb6pbOrYHQ9C1eCkKV6FPUAxlaH71Ij7KGwc,20423
73
- deepfabric-4.7.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
74
- deepfabric-4.7.1.dist-info/entry_points.txt,sha256=zatevils13hfs8x29_vmUyivQ6rTtq7hE2RBusZw1Fo,50
75
- deepfabric-4.7.1.dist-info/licenses/LICENSE,sha256=-qRt8wmrhQ9aMf7KhmZXc2vrTETYZF-6_T1KCeUhvHY,11340
76
- deepfabric-4.7.1.dist-info/RECORD,,
71
+ deepfabric/training/metrics_sender.py,sha256=ZCyvMv5hRu8XJnQYVGXJ9wh7HEMJ0l3Ktyi8_etOpZs,10833
72
+ deepfabric-4.8.1.dist-info/METADATA,sha256=rqINWAsjSFRqf4__rva0qMmWFq9cNtSxK1zhndl5anI,20427
73
+ deepfabric-4.8.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
74
+ deepfabric-4.8.1.dist-info/entry_points.txt,sha256=zatevils13hfs8x29_vmUyivQ6rTtq7hE2RBusZw1Fo,50
75
+ deepfabric-4.8.1.dist-info/licenses/LICENSE,sha256=-qRt8wmrhQ9aMf7KhmZXc2vrTETYZF-6_T1KCeUhvHY,11340
76
+ deepfabric-4.8.1.dist-info/RECORD,,