sdg-hub 0.7.0__py3-none-any.whl → 0.7.2__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.
sdg_hub/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.7.0'
32
- __version_tuple__ = version_tuple = (0, 7, 0)
31
+ __version__ = version = '0.7.2'
32
+ __version_tuple__ = version_tuple = (0, 7, 2)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -6,7 +6,8 @@ from typing import Any, Optional
6
6
  import asyncio
7
7
 
8
8
  from litellm import acompletion, completion
9
- from pydantic import ConfigDict, Field, field_validator
9
+ from pydantic import ConfigDict, Field, SecretStr, field_validator
10
+ from tqdm.asyncio import tqdm_asyncio
10
11
  import litellm
11
12
 
12
13
  # Third Party
@@ -52,8 +53,9 @@ class LLMChatBlock(BaseBlock):
52
53
  model : Optional[str], optional
53
54
  Model identifier in LiteLLM format. Can be set later via flow.set_model_config().
54
55
  Examples: "openai/gpt-4", "anthropic/claude-3-sonnet-20240229"
55
- api_key : Optional[str], optional
56
+ api_key : Optional[SecretStr], optional
56
57
  API key for the provider. Falls back to environment variables.
58
+ Automatically redacted in logs and string representations.
57
59
  api_base : Optional[str], optional
58
60
  Base URL for the API. Required for local models.
59
61
  async_mode : bool, optional
@@ -97,7 +99,7 @@ class LLMChatBlock(BaseBlock):
97
99
  model: Optional[str] = Field(
98
100
  None, exclude=True, description="Model identifier in LiteLLM format"
99
101
  )
100
- api_key: Optional[str] = Field(
102
+ api_key: Optional[SecretStr] = Field(
101
103
  None, exclude=True, description="API key for the provider"
102
104
  )
103
105
  api_base: Optional[str] = Field(
@@ -301,7 +303,7 @@ class LLMChatBlock(BaseBlock):
301
303
  if self.model is not None:
302
304
  completion_kwargs["model"] = self.model
303
305
  if self.api_key is not None:
304
- completion_kwargs["api_key"] = self.api_key
306
+ completion_kwargs["api_key"] = self.api_key.get_secret_value()
305
307
  if self.api_base is not None:
306
308
  completion_kwargs["api_base"] = self.api_base
307
309
  if self.timeout is not None:
@@ -501,7 +503,9 @@ class LLMChatBlock(BaseBlock):
501
503
  for messages in messages_list
502
504
  ]
503
505
 
504
- responses = await asyncio.gather(*tasks)
506
+ responses = await tqdm_asyncio.gather(
507
+ *tasks, desc=self.block_name, unit="req"
508
+ )
505
509
  return responses
506
510
 
507
511
  except Exception as e:
sdg_hub/core/flow/base.py CHANGED
@@ -13,6 +13,7 @@ from pydantic import (
13
13
  ConfigDict,
14
14
  Field,
15
15
  PrivateAttr,
16
+ SecretStr,
16
17
  field_validator,
17
18
  model_validator,
18
19
  )
@@ -793,7 +794,10 @@ class Flow(BaseModel):
793
794
  if api_base is not None:
794
795
  config_params["api_base"] = api_base
795
796
  if api_key is not None:
796
- config_params["api_key"] = api_key
797
+ # Convert string api_key to SecretStr for automatic redaction in logs
798
+ config_params["api_key"] = (
799
+ SecretStr(api_key) if isinstance(api_key, str) else api_key
800
+ )
797
801
 
798
802
  # Add any additional kwargs (temperature, max_tokens, etc.)
799
803
  config_params.update(kwargs)
@@ -855,6 +859,7 @@ class Flow(BaseModel):
855
859
 
856
860
  if modified_count > 0:
857
861
  # Enhanced logging showing what was configured
862
+ # Note: SecretStr values automatically display as '**********' in logs
858
863
  param_summary = []
859
864
  for param_name, param_value in config_params.items():
860
865
  if param_name == "model":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdg_hub
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Synthetic Data Generation
5
5
  Author-email: Red Hat AI Innovation <abhandwa@redhat.com>
6
6
  License: Apache-2.0
@@ -33,6 +33,20 @@ Requires-Dist: pydantic<3.0.0,>=2.0.0
33
33
  Requires-Dist: python-dotenv<2.0.0,>=1.0.0
34
34
  Requires-Dist: tenacity!=8.4.0,>=8.3.0
35
35
  Requires-Dist: tqdm<5.0.0,>=4.66.2
36
+ Provides-Extra: dev
37
+ Requires-Dist: pre-commit<4.0,>=3.0.4; extra == "dev"
38
+ Requires-Dist: pylint<4.0,>=2.16.2; extra == "dev"
39
+ Requires-Dist: pylint-pydantic; extra == "dev"
40
+ Requires-Dist: pytest; extra == "dev"
41
+ Requires-Dist: pytest-asyncio; extra == "dev"
42
+ Requires-Dist: pytest-cov; extra == "dev"
43
+ Requires-Dist: pytest-html; extra == "dev"
44
+ Requires-Dist: tox<5,>=4.4.2; extra == "dev"
45
+ Requires-Dist: ruff; extra == "dev"
46
+ Requires-Dist: pytest-env; extra == "dev"
47
+ Requires-Dist: nbconvert>=7.0.0; extra == "dev"
48
+ Provides-Extra: integration
49
+ Requires-Dist: nest-asyncio; extra == "integration"
36
50
  Provides-Extra: examples
37
51
  Requires-Dist: tabulate>=0.9.0; extra == "examples"
38
52
  Requires-Dist: transformers>=4.37.0; extra == "examples"
@@ -46,20 +60,7 @@ Requires-Dist: nltk; extra == "examples"
46
60
  Requires-Dist: sentence-transformers; extra == "examples"
47
61
  Requires-Dist: instructor; extra == "examples"
48
62
  Requires-Dist: fastapi; extra == "examples"
49
- Requires-Dist: nest-asyncio; extra == "examples"
50
63
  Requires-Dist: ipykernel; extra == "examples"
51
- Provides-Extra: dev
52
- Requires-Dist: pre-commit<4.0,>=3.0.4; extra == "dev"
53
- Requires-Dist: pylint<4.0,>=2.16.2; extra == "dev"
54
- Requires-Dist: pylint-pydantic; extra == "dev"
55
- Requires-Dist: pytest; extra == "dev"
56
- Requires-Dist: pytest-asyncio; extra == "dev"
57
- Requires-Dist: pytest-cov; extra == "dev"
58
- Requires-Dist: pytest-html; extra == "dev"
59
- Requires-Dist: tox<5,>=4.4.2; extra == "dev"
60
- Requires-Dist: ruff; extra == "dev"
61
- Requires-Dist: pytest-env; extra == "dev"
62
- Requires-Dist: nbconvert>=7.0.0; extra == "dev"
63
64
  Dynamic: license-file
64
65
 
65
66
  # `sdg_hub`: Synthetic Data Generation Toolkit
@@ -1,5 +1,5 @@
1
1
  sdg_hub/__init__.py,sha256=TlkZT40-70urdcWLqv3kupaJj8s-SVgd2QyvlSFwb4A,510
2
- sdg_hub/_version.py,sha256=uLbRjFSUZAgfl7V7O8zKV5Db36k7tz87ZIVq3l2SWs0,704
2
+ sdg_hub/_version.py,sha256=69rtUS5MR_8CGRaNqkaDM6V4ZDI_8FTMw2vDLxrWg0Q,704
3
3
  sdg_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  sdg_hub/core/__init__.py,sha256=e3BoejbqjYhasf9t__L4qE52lkD9EBjx4o--2kqKdro,460
5
5
  sdg_hub/core/blocks/__init__.py,sha256=8Rn1SglH8V3jGmTD_cG-h7qk9ktAab2eaBdyk7RN_hY,865
@@ -9,7 +9,7 @@ sdg_hub/core/blocks/filtering/__init__.py,sha256=isxSVSvDqkMjG8dQSl3Q2M4g5c1t9fT
9
9
  sdg_hub/core/blocks/filtering/column_value_filter.py,sha256=tHNykB-Q_ItbjDzvlpnjt0Z46mR67O6ZY29ed2ecOwo,6493
10
10
  sdg_hub/core/blocks/llm/__init__.py,sha256=1Oo2nv2uXJ2AzRlrQcqDi7gW1FNh9Fid84L89dvy4qM,683
11
11
  sdg_hub/core/blocks/llm/error_handler.py,sha256=7T-019ZFB9qgZoX1ybIiXyaLjPzrF96qcKmUu6vmO6g,12178
12
- sdg_hub/core/blocks/llm/llm_chat_block.py,sha256=ckkjF_r9CxoX2sJiikFWFxNrAS4w_gMnedo70TrQo3Y,22730
12
+ sdg_hub/core/blocks/llm/llm_chat_block.py,sha256=0J6oz3EHB8AXB8dicnt6XKvbKCKMvSAEbnLadNORFhs,22946
13
13
  sdg_hub/core/blocks/llm/llm_parser_block.py,sha256=NFk8xXceK_F1Pzn9dFNX65ynavuoQiH2ltDLLY_6SXQ,12136
14
14
  sdg_hub/core/blocks/llm/prompt_builder_block.py,sha256=zI8DFz34abGnH2Mk0KQe4Mkkb5ophwV7brn4axNsZ2I,14146
15
15
  sdg_hub/core/blocks/llm/text_parser_block.py,sha256=CoyfgKcJL9JpokzMcKk4bYeEBr6xnN0XYk45hJANnBQ,12763
@@ -22,7 +22,7 @@ sdg_hub/core/blocks/transform/rename_columns.py,sha256=EafchUDXvfXxqwRvNIcy92I1Z
22
22
  sdg_hub/core/blocks/transform/text_concat.py,sha256=Oo6VKGdmeiUmH3B0PDL1y_ot-bYmkT2jbGj7g7C84gg,3089
23
23
  sdg_hub/core/blocks/transform/uniform_col_val_setter.py,sha256=Osbz-jciBx5jFfzUbtbCBh_ET4CySG2h0IGWChESHi4,3239
24
24
  sdg_hub/core/flow/__init__.py,sha256=0_m_htuZfPxk8xQ9IKfp0Pz-JRE4O7lYMUFrKyLNoLA,409
25
- sdg_hub/core/flow/base.py,sha256=9nCXrCdKMzMAoIpiv2Zo7RzZhiLluXJ9XQAtg3wh_40,59104
25
+ sdg_hub/core/flow/base.py,sha256=0b2AQJ-OpqSQlt_c0tG84V_BdokZcFlkBKNbBLjGVTY,59368
26
26
  sdg_hub/core/flow/checkpointer.py,sha256=MJay3Q5cfRgJDetk82DaMKJ3ZZUYRHxQabEQTxhGukk,11850
27
27
  sdg_hub/core/flow/metadata.py,sha256=cFrpJjWOaK87aCuRFyC3Pdf83oYU93mrmZEMdUnhsN8,10540
28
28
  sdg_hub/core/flow/registry.py,sha256=N6KfX-L7QRkooznIFxDuhRZYuDA5g3N5zC-KRm2jVhk,12109
@@ -84,8 +84,8 @@ sdg_hub/flows/text_analysis/structured_insights/extract_entities.yaml,sha256=Q_S
84
84
  sdg_hub/flows/text_analysis/structured_insights/extract_keywords.yaml,sha256=_nPPMdHnxag_lYbhYUjGJGo-CvRwWvwdGX7cQhdZ1S0,847
85
85
  sdg_hub/flows/text_analysis/structured_insights/flow.yaml,sha256=BBV18SdvuVTAESjwkJ7V1jbb-cSTBvNl3SCycd0oEQ4,4934
86
86
  sdg_hub/flows/text_analysis/structured_insights/summarize.yaml,sha256=WXwQak1pF8e1OwnOoI1EHu8QB6iUNW89rfkTdi1Oq54,687
87
- sdg_hub-0.7.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
88
- sdg_hub-0.7.0.dist-info/METADATA,sha256=ABg2y-NjvyUPbMdqyDgrzQhpxdnv4oCwuOarTT86ahI,9584
89
- sdg_hub-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
90
- sdg_hub-0.7.0.dist-info/top_level.txt,sha256=TqI7d-HE1n6zkXFkU0nF3A1Ct0P0pBaqI675uFokhx4,8
91
- sdg_hub-0.7.0.dist-info/RECORD,,
87
+ sdg_hub-0.7.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
88
+ sdg_hub-0.7.2.dist-info/METADATA,sha256=V0DFJlc77tCFAiZY3AuAGXlbXo6hkeMTMm3YPhKiuZs,9615
89
+ sdg_hub-0.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
90
+ sdg_hub-0.7.2.dist-info/top_level.txt,sha256=TqI7d-HE1n6zkXFkU0nF3A1Ct0P0pBaqI675uFokhx4,8
91
+ sdg_hub-0.7.2.dist-info/RECORD,,