Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ repos:
args:
- "-L"
- "rouge,coo,couldn,unsecure,ontext,afterall,als"
- repo: https://github.com/jendrikseipp/vulture
rev: v2.15
hooks:
- id: vulture
pass_filenames: false
4 changes: 2 additions & 2 deletions py/src/braintrust/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def tags(self) -> Sequence[str]:
"""

@abc.abstractmethod
def report_progress(self, progress: TaskProgressEvent) -> None:
def report_progress(self, _progress: TaskProgressEvent) -> None:
"""
Report progress that will show up in the playground.
"""
Expand Down Expand Up @@ -459,7 +459,7 @@ class EvalResultWithSummary(SerializableDataClass, Generic[Input, Output]):
summary: ExperimentSummary
results: list[EvalResult[Input, Output]]

def _repr_pretty_(self, p, cycle):
def _repr_pretty_(self, p, _cycle):
p.text(f'EvalResultWithSummary(summary="...", results=[...])')


Expand Down
5 changes: 2 additions & 3 deletions py/src/braintrust/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ def _register_dropped_item_count(self, num_items):
self._queue_drop_logging_state["last_logged_timestamp"] = time_now

@staticmethod
def _write_payload_to_dir(payload_dir, payload, debug_logging_adjective=None):
def _write_payload_to_dir(payload_dir, payload):
payload_file = os.path.join(payload_dir, f"payload_{time.time()}_{str(uuid.uuid4())[:8]}.json")
try:
os.makedirs(payload_dir, exist_ok=True)
Expand Down Expand Up @@ -2831,7 +2831,7 @@ def _validate_and_sanitize_experiment_log_partial_args(event: Mapping[str, Any])
# Note that this only checks properties that are expected of a complete event.
# _validate_and_sanitize_experiment_log_partial_args should still be invoked
# (after handling special fields like 'id').
def _validate_and_sanitize_experiment_log_full_args(event: Mapping[str, Any], has_dataset: bool) -> Mapping[str, Any]:
def _validate_and_sanitize_experiment_log_full_args(event: Mapping[str, Any]) -> Mapping[str, Any]:
input = event.get("input")
inputs = event.get("inputs")
if (input is not None and inputs is not None) or (input is None and inputs is None):
Expand Down Expand Up @@ -3861,7 +3861,6 @@ def log(
metrics=metrics,
id=id,
),
self.dataset is not None,
)
span = self._start_span_impl(start_time=self.last_start_time, lookup_span_parent=False, **event)
self.last_start_time = span.end()
Expand Down
14 changes: 7 additions & 7 deletions py/src/braintrust/wrappers/agno/_test_agno_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def __init__(self):
self.name = name
self.steps = ["first-step"]

async def _aexecute(self, session_id, user_id, execution_input, workflow_run_response, run_context=None):
async def _aexecute(self, session_id, user_id, execution_input, workflow_run_response, _run_context=None):
return FakeWorkflowRunResponse(input=execution_input.input, content="workflow-async")

def _execute_stream(self, session, execution_input, workflow_run_response, run_context=None):
def _execute_stream(self, session, execution_input, workflow_run_response, _run_context=None):
yield FakeEvent("WorkflowStarted", content=None)
yield FakeEvent("StepStarted", content=None)
yield FakeEvent("StepCompleted", content="hello ")
Expand All @@ -74,7 +74,7 @@ def __init__(self):
self.name = name
self.steps = ["first-step"]

def _execute_stream(self, session, execution_input, workflow_run_response, run_context=None):
def _execute_stream(self, session, execution_input, workflow_run_response, _run_context=None):
yield FakeEvent("StepCompleted", content="hello")
yield FakeEvent("WorkflowCompleted", content="hello", metrics=FakeMetrics(), status="COMPLETED")

Expand All @@ -87,7 +87,7 @@ def __init__(self):
self.name = name
self.steps = ["first-step"]

def _execute_stream(self, session, execution_input, workflow_run_response, run_context=None):
def _execute_stream(self, session, execution_input, workflow_run_response, _run_context=None):
yield FakeEvent("WorkflowStarted", content=None)
yield FakeEvent("StepCompleted", content="hello ")
workflow_run_response.content = "world"
Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self):
self.steps = ["agent-step"]
self.agent = WrappedAgent()

async def _aexecute(self, session_id, user_id, execution_input, workflow_run_response, run_context=None):
async def _aexecute(self, session_id, user_id, execution_input, workflow_run_response, _run_context=None):
return await self.agent.arun(execution_input.input)

return FakeWorkflow
Expand All @@ -128,7 +128,7 @@ def __init__(self):
self.id = "workflow-agent-123"
self.steps = ["agent-step"]

def _execute_workflow_agent(self, user_input, session, execution_input, run_context, stream=False, **kwargs):
def _execute_workflow_agent(self, user_input, session, execution_input, _run_context, stream=False, **kwargs):
if stream:

def _stream():
Expand All @@ -143,7 +143,7 @@ def _stream():
return _stream()
return FakeRunOutput(f"{user_input}-sync")

async def _aexecute_workflow_agent(self, user_input, run_context, execution_input, stream=False, **kwargs):
async def _aexecute_workflow_agent(self, user_input, _run_context, execution_input, stream=False, **kwargs):
if stream:

async def _astream():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def _normalize_write(data: str, *, sanitize: bool = False) -> dict[str, Any]:


async def _empty_stream():
return
yield {} # type: ignore[unreachable]
for _ in ():
yield {}


def _normalize_for_match(value: Any) -> Any:
Expand Down
4 changes: 1 addition & 3 deletions py/src/braintrust/wrappers/test_pydantic_ai_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,11 @@ async def fake_run_chat(
*,
stream,
agent,
deps,
console,
code_theme,
prog_name,
message_history,
model_settings=None,
usage_limits=None,
**_,
):
assert stream is True
assert prog_name == "braintrust-cli"
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ split-on-trailing-comma = true
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
addopts = "--durations=3 --durations-min=0.1"

[tool.vulture]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should also run in CI.

paths = ["py/src"]
ignore_names = ["with_simulate_login", "reset_id_generator_state", "dataset_record_id"] # pytest fixtures and deprecated-but-public API parameters
min_confidence = 100
Loading