fluxloop 0.1.0__py3-none-any.whl → 0.1.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.
Potentially problematic release.
This version of fluxloop might be problematic. Click here for more details.
- fluxloop/__init__.py +3 -2
- fluxloop/config.py +43 -2
- fluxloop/schemas/config.py +18 -0
- {fluxloop-0.1.0.dist-info → fluxloop-0.1.2.dist-info}/METADATA +1 -1
- {fluxloop-0.1.0.dist-info → fluxloop-0.1.2.dist-info}/RECORD +7 -7
- {fluxloop-0.1.0.dist-info → fluxloop-0.1.2.dist-info}/WHEEL +0 -0
- {fluxloop-0.1.0.dist-info → fluxloop-0.1.2.dist-info}/top_level.txt +0 -0
fluxloop/__init__.py
CHANGED
|
@@ -18,10 +18,10 @@ from .schemas import (
|
|
|
18
18
|
TraceStatus,
|
|
19
19
|
)
|
|
20
20
|
from .client import FluxLoopClient
|
|
21
|
-
from .config import configure, get_config, reset_config
|
|
21
|
+
from .config import configure, get_config, reset_config, load_env
|
|
22
22
|
from .recording import disable_recording, enable_recording, record_call_args, set_recording_options
|
|
23
23
|
|
|
24
|
-
__version__ = "0.1.
|
|
24
|
+
__version__ = "0.1.2"
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
27
27
|
# Decorators
|
|
@@ -36,6 +36,7 @@ __all__ = [
|
|
|
36
36
|
"FluxLoopClient",
|
|
37
37
|
# Config
|
|
38
38
|
"configure",
|
|
39
|
+
"load_env",
|
|
39
40
|
"get_config",
|
|
40
41
|
"reset_config",
|
|
41
42
|
"enable_recording",
|
fluxloop/config.py
CHANGED
|
@@ -14,6 +14,39 @@ from pydantic import BaseModel, Field, field_validator
|
|
|
14
14
|
from .recording import disable_recording, enable_recording
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def load_env(
|
|
18
|
+
dotenv_path: Optional[str] = None,
|
|
19
|
+
*,
|
|
20
|
+
override: bool = True,
|
|
21
|
+
refresh_config: bool = True,
|
|
22
|
+
) -> bool:
|
|
23
|
+
"""Load environment variables for FluxLoop.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
dotenv_path: Optional path to a specific `.env` file or containing directory.
|
|
27
|
+
override: Whether to override existing environment variables.
|
|
28
|
+
refresh_config: When True (default), rebuild the in-memory SDK config using the
|
|
29
|
+
newly loaded environment variables (if the config has already been created).
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
True if the env file was found and loaded, False otherwise.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
if dotenv_path is None:
|
|
36
|
+
return load_dotenv(override=override)
|
|
37
|
+
|
|
38
|
+
candidate = Path(dotenv_path).expanduser()
|
|
39
|
+
if candidate.is_dir():
|
|
40
|
+
candidate = candidate / ".env"
|
|
41
|
+
|
|
42
|
+
loaded = load_dotenv(dotenv_path=str(candidate), override=override)
|
|
43
|
+
|
|
44
|
+
if refresh_config and globals().get("_config") is not None:
|
|
45
|
+
_refresh_config_from_env()
|
|
46
|
+
|
|
47
|
+
return loaded
|
|
48
|
+
|
|
49
|
+
|
|
17
50
|
def _resolve_recording_path(path: Optional[str]) -> Path:
|
|
18
51
|
"""Resolve the recording file path, creating parent directories."""
|
|
19
52
|
|
|
@@ -42,8 +75,8 @@ def _apply_recording_config(config: "SDKConfig") -> None:
|
|
|
42
75
|
if config.debug:
|
|
43
76
|
print("🎥 Argument recording disabled")
|
|
44
77
|
|
|
45
|
-
# Load environment variables
|
|
46
|
-
|
|
78
|
+
# Load environment variables (default behaviour on import)
|
|
79
|
+
load_env()
|
|
47
80
|
|
|
48
81
|
|
|
49
82
|
class SDKConfig(BaseModel):
|
|
@@ -144,6 +177,14 @@ _config = SDKConfig()
|
|
|
144
177
|
_apply_recording_config(_config)
|
|
145
178
|
|
|
146
179
|
|
|
180
|
+
def _refresh_config_from_env() -> None:
|
|
181
|
+
"""Rebuild the global SDK configuration from current environment variables."""
|
|
182
|
+
|
|
183
|
+
global _config
|
|
184
|
+
_config = SDKConfig()
|
|
185
|
+
_apply_recording_config(_config)
|
|
186
|
+
|
|
187
|
+
|
|
147
188
|
def configure(**kwargs) -> SDKConfig:
|
|
148
189
|
"""
|
|
149
190
|
Configure the SDK.
|
fluxloop/schemas/config.py
CHANGED
|
@@ -13,6 +13,7 @@ class VariationStrategy(str, Enum):
|
|
|
13
13
|
"""Strategy for generating prompt variations."""
|
|
14
14
|
|
|
15
15
|
REPHRASE = "rephrase" # Rephrase the same intent
|
|
16
|
+
ERROR_PRONE = "error_prone" # Introduce mistakes to test robustness
|
|
16
17
|
TYPO = "typo" # Add typos/errors
|
|
17
18
|
VERBOSE = "verbose" # Make more verbose
|
|
18
19
|
CONCISE = "concise" # Make more concise
|
|
@@ -142,6 +143,23 @@ class RunnerConfig(BaseModel):
|
|
|
142
143
|
"module_path + function_name."
|
|
143
144
|
),
|
|
144
145
|
)
|
|
146
|
+
factory: Optional[str] = Field(
|
|
147
|
+
default=None,
|
|
148
|
+
description=(
|
|
149
|
+
"Optional factory to construct instances when target references a class or bound method. "
|
|
150
|
+
"Use 'module:callable' format; callable must return the instance."
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
factory_kwargs: Dict[str, Any] = Field(
|
|
154
|
+
default_factory=dict,
|
|
155
|
+
description="Keyword arguments to pass to the factory callable, if provided.",
|
|
156
|
+
)
|
|
157
|
+
stream_output_path: Optional[str] = Field(
|
|
158
|
+
default=None,
|
|
159
|
+
description=(
|
|
160
|
+
"Dot-notation path for extracting text from async generator events (e.g., 'message.delta')."
|
|
161
|
+
),
|
|
162
|
+
)
|
|
145
163
|
|
|
146
164
|
# Execution environment
|
|
147
165
|
working_directory: Optional[str] = None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fluxloop/__init__.py,sha256=
|
|
1
|
+
fluxloop/__init__.py,sha256=RxodliXE5hqJ51AxIAYZVxm1XSjuBr28jKJPK8yCcS8,1274
|
|
2
2
|
fluxloop/buffer.py,sha256=pbviGFU0P_HlBYOlZccVuaj7OcQ5-M0L8d7r_vF1hQg,5940
|
|
3
3
|
fluxloop/client.py,sha256=4WCi1de8MJW-5La-ZalVYEaN7-gUFHlr6mByi1bBoc0,5487
|
|
4
|
-
fluxloop/config.py,sha256=
|
|
4
|
+
fluxloop/config.py,sha256=5mlcLiDKZ5XGV5Lt58RGEWvmSGX4BBO7lRZl0gMrC6E,6954
|
|
5
5
|
fluxloop/context.py,sha256=09VTTSnn72E0wRf55PX5j355ngKE2GXaqCYpgBVgxMM,6458
|
|
6
6
|
fluxloop/decorators.py,sha256=nfKIQpLwfMhr7A1TjtL-vppPWroPs98LsFB_1-ADfFM,15519
|
|
7
7
|
fluxloop/models.py,sha256=5AQ2jqArRGwQB91GOBVrBRb1h5gJBghl5G81EClOUp8,2399
|
|
@@ -9,9 +9,9 @@ fluxloop/recording.py,sha256=lnhJI0fWJfgMGMjw6TA8wU66PbelfYyD2UzMJ02W-uI,6609
|
|
|
9
9
|
fluxloop/serialization.py,sha256=SkY4bSUHxBrCkrPns-jWC1PkVSX8qh-oBprQTbmc5Z8,3239
|
|
10
10
|
fluxloop/storage.py,sha256=siwlbGdUpFAzdI6MMnODtkuxJyftQG9D4Phs2s5quMs,1732
|
|
11
11
|
fluxloop/schemas/__init__.py,sha256=przYFHTxNK7juJbqWZ2YVuCdBiMk3PB1H7T4xg3l62g,911
|
|
12
|
-
fluxloop/schemas/config.py,sha256=
|
|
12
|
+
fluxloop/schemas/config.py,sha256=n__U5aduQ5dIEs4cJNGSrD1jdpd-RAb03HhdOM7KlTk,11852
|
|
13
13
|
fluxloop/schemas/trace.py,sha256=tkeYQon9pCTZLp1Ad3e-KM86xLaofIqxjHJ7l-mX0Bk,6270
|
|
14
|
-
fluxloop-0.1.
|
|
15
|
-
fluxloop-0.1.
|
|
16
|
-
fluxloop-0.1.
|
|
17
|
-
fluxloop-0.1.
|
|
14
|
+
fluxloop-0.1.2.dist-info/METADATA,sha256=KAX7Cn1gcT34Tm8C7P99gzUlG5SACDbJ-TbwN8HViyo,2320
|
|
15
|
+
fluxloop-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
fluxloop-0.1.2.dist-info/top_level.txt,sha256=-whiUKvhn6Y7-TLfqrY7fZ1Cudjk8PnrKe7h7m8cuL4,9
|
|
17
|
+
fluxloop-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|