Skip to content

Commit dc4efbe

Browse files
authored
Merge pull request #237 from zenml-io/misc/fix-imports-and-sundry
Fix imports and update dependencies
2 parents 3123445 + 9c81c0b commit dc4efbe

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

deep_research/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ cd zenml_deep_research
8888
pip install -r requirements.txt
8989

9090
# Set up API keys
91-
export OPENAI_API_KEY=your_openai_key # Or another LLM provider key
91+
export OPENAI_API_KEY=your_openai_key # If using OpenAI models
92+
export OPENROUTER_API_KEY=your_openrouter_key # If using OpenRouter models (default configuration uses OpenRouter)
9293
export TAVILY_API_KEY=your_tavily_key # For Tavily search (default)
9394
export EXA_API_KEY=your_exa_key # For Exa search and MCP integration (required for MCP)
9495
export ANTHROPIC_API_KEY=your_anthropic_key # For MCP integration (required)

deep_research/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
zenml>=0.82.0
2-
litellm>=1.70.0,<2.0.0
1+
zenml>=0.83.1
32
tavily-python>=0.2.8
43
exa-py>=1.0.0
54
PyYAML>=6.0
65
click>=8.0.0
76
pydantic>=2.0.0
87
typing_extensions>=4.0.0
98
requests
10-
langfuse>=2.0.0
119
anthropic>=0.52.2
10+
litellm==1.69.1
11+
langfuse==2.60.8

deep_research/utils/tracing_metadata_utils.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from langfuse import Langfuse
99
from langfuse.api.core import ApiError
10-
from langfuse.client import ObservationsView, TraceWithDetails
1110
from rich import print
1211
from rich.console import Console
1312
from rich.table import Table
@@ -106,14 +105,14 @@ def wrapper(*args, **kwargs):
106105

107106
@rate_limited
108107
@retry_with_backoff
109-
def fetch_traces_safe(limit: Optional[int] = None) -> List[TraceWithDetails]:
108+
def fetch_traces_safe(limit: Optional[int] = None) -> List:
110109
"""Safely fetch traces with rate limiting and retry logic."""
111110
return langfuse.fetch_traces(limit=limit).data
112111

113112

114113
@rate_limited
115114
@retry_with_backoff
116-
def fetch_observations_safe(trace_id: str) -> List[ObservationsView]:
115+
def fetch_observations_safe(trace_id: str) -> List:
117116
"""Safely fetch observations with rate limiting and retry logic."""
118117
return langfuse.fetch_observations(trace_id=trace_id).data
119118

@@ -193,7 +192,7 @@ def get_total_tokens_used(trace_id: str) -> Tuple[int, int]:
193192
return 0, 0
194193

195194

196-
def get_trace_stats(trace: TraceWithDetails) -> Dict[str, Any]:
195+
def get_trace_stats(trace) -> Dict[str, Any]:
197196
"""Get comprehensive statistics for a trace.
198197
199198
Args:
@@ -251,7 +250,7 @@ def get_trace_stats(trace: TraceWithDetails) -> Dict[str, Any]:
251250
return {}
252251

253252

254-
def get_traces_by_name(name: str, limit: int = 1) -> List[TraceWithDetails]:
253+
def get_traces_by_name(name: str, limit: int = 1) -> List:
255254
"""Get traces by name using Langfuse API.
256255
257256
Args:
@@ -270,7 +269,7 @@ def get_traces_by_name(name: str, limit: int = 1) -> List[TraceWithDetails]:
270269
return []
271270

272271

273-
def get_observations_for_trace(trace_id: str) -> List[ObservationsView]:
272+
def get_observations_for_trace(trace_id: str) -> List:
274273
"""Get all observations for a specific trace.
275274
276275
Args:
@@ -289,7 +288,7 @@ def get_observations_for_trace(trace_id: str) -> List[ObservationsView]:
289288

290289
def filter_traces_by_date_range(
291290
start_date: datetime, end_date: datetime, limit: Optional[int] = None
292-
) -> List[TraceWithDetails]:
291+
) -> List:
293292
"""Filter traces within a specific date range.
294293
295294
Args:
@@ -330,9 +329,7 @@ def filter_traces_by_date_range(
330329
return []
331330

332331

333-
def get_traces_last_n_days(
334-
days: int, limit: Optional[int] = None
335-
) -> List[TraceWithDetails]:
332+
def get_traces_last_n_days(days: int, limit: Optional[int] = None) -> List:
336333
"""Get traces from the last N days.
337334
338335
Args:
@@ -349,7 +346,7 @@ def get_traces_last_n_days(
349346

350347

351348
def get_trace_stats_batch(
352-
traces: List[TraceWithDetails], show_progress: bool = True
349+
traces: List, show_progress: bool = True
353350
) -> List[Dict[str, Any]]:
354351
"""Get statistics for multiple traces efficiently with progress tracking.
355352
@@ -375,7 +372,7 @@ def get_trace_stats_batch(
375372

376373

377374
def get_aggregate_stats_for_traces(
378-
traces: List[TraceWithDetails],
375+
traces: List,
379376
) -> Dict[str, Any]:
380377
"""Calculate aggregate statistics for a list of traces.
381378
@@ -428,9 +425,7 @@ def get_aggregate_stats_for_traces(
428425
}
429426

430427

431-
def display_trace_stats_table(
432-
traces: List[TraceWithDetails], title: str = "Trace Statistics"
433-
):
428+
def display_trace_stats_table(traces: List, title: str = "Trace Statistics"):
434429
"""Display trace statistics in a formatted table.
435430
436431
Args:
@@ -459,7 +454,7 @@ def display_trace_stats_table(
459454
console.print(table)
460455

461456

462-
def identify_prompt_type(observation: ObservationsView) -> str:
457+
def identify_prompt_type(observation) -> str:
463458
"""Identify the prompt type based on keywords in the observation's input.
464459
465460
Examines the system prompt in observation.input['messages'][0]['content']

0 commit comments

Comments
 (0)