baml icon indicating copy to clipboard operation
baml copied to clipboard

[bug] Collector class missing clear() method documented in official guide

Open paulonasc opened this issue 6 months ago • 2 comments

Product

BAML

Describe the bug

According to the official BAML guide, the Collector class should have a clear() method to reset or clear collected logs. However, in the actual implementation (baml-py version 0.201.0), the Collector class does not include a clear() method:

class Collector:
    def __init__(self, name: Optional[str] = None) -> None: ...
    @property
    def logs(self) -> List[FunctionLog]: ...
    @property
    def last(self) -> Optional[FunctionLog]: ...
    @property
    def usage(self) -> Usage: ...
    def id(self, function_log_id: str) -> Optional[FunctionLog]: ...
    # For debugging
    @staticmethod
    def __function_call_count() -> int: ...
    @staticmethod
    def __print_storage() -> None: ...

There is no clear() method defined. Expected behavior: the Collector class should include the clear() method as documented, or the documentation should be updated to reflect its absence.

Reproduction Steps

Package details: name = "baml-py" version = "0.201.0"

Look inside of the Collector class in Python and you will notice clear() is not there

class Collector:
    def __init__(self, name: Optional[str] = None) -> None: ...
    @property
    def logs(self) -> List[FunctionLog]: ...
    @property
    def last(self) -> Optional[FunctionLog]: ...
    @property
    def usage(self) -> Usage: ...
    def id(self, function_log_id: str) -> Optional[FunctionLog]: ...
    # For debugging
    @staticmethod
    def __function_call_count() -> int: ...
    @staticmethod
    def __print_storage() -> None: ...

BAML Version

No response

Language/Framework

None

LLM Provider

None

LLM Model

No response

Operating System

None

Browser

None

Code Editor

None

paulonasc avatar Jul 09 '25 18:07 paulonasc

Hey, sorry for the radio silence on this! We'll look into this soon.

sxlijin avatar Oct 01 '25 19:10 sxlijin