Skip to content

Commit 0e520ab

Browse files
committed
fix: use original private stored log method in flow decorator
1 parent e2fc2a3 commit 0e520ab

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/humanloop/decorators/flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> Optional[R]:
6767
"messages": func_args.get("messages"),
6868
"trace_parent_id": trace_id,
6969
}
70-
this_flow_log: FlowLogResponse = client.flows.log(
70+
this_flow_log: FlowLogResponse = client.flows._log( # type: ignore [attr-defined]
7171
path=decorator_context.path,
7272
flow=decorator_context.version,
7373
log_status="incomplete",

src/humanloop/overload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def overload_client(
181181
use_local_files: bool = False,
182182
) -> Any:
183183
"""Overloads client methods to add tracing, local file handling, and evaluation context."""
184-
# Store original log method as _log for all clients
184+
# Store original log method as _log for all clients. Used in flow decorator
185185
if hasattr(client, "log") and not hasattr(client, "_log"):
186186
client._log = client.log # type: ignore [attr-defined]
187187

tests/custom/sync/test_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from unittest.mock import Mock, patch
55
from humanloop.sync.sync_client import SyncClient
66
from humanloop.error import HumanloopRuntimeError
7+
from typing import Literal
78

89

910
@pytest.fixture
@@ -87,8 +88,8 @@ def test_cache_functionality(sync_client: SyncClient):
8788
# Save a test file
8889
content = "test content"
8990
path = "test/path"
90-
file_type = "prompt"
91-
sync_client._save_serialized_file(content, path, file_type) # type: ignore [arg-type] Ignore because we're deliberately testing an invalid literal
91+
file_type: Literal["prompt", "agent"] = "prompt"
92+
sync_client._save_serialized_file(content, path, file_type)
9293

9394
# First read should hit disk
9495
sync_client.get_file_content(path, file_type)

0 commit comments

Comments
 (0)