From e68c424d58ead2b55d85096b1339bd89a99e6f96 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 1 Oct 2024 17:13:45 -0700 Subject: [PATCH] Fix --- python/langsmith/client.py | 11 ++++++----- python/langsmith/schemas.py | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/python/langsmith/client.py b/python/langsmith/client.py index e99164831..8c36c7aea 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -1409,7 +1409,7 @@ def batch_ingest_runs( ] = None, *, pre_sampled: bool = False, - ): + ) -> None: """Batch ingest/upsert multiple runs in the Langsmith system. Args: @@ -1424,7 +1424,7 @@ def batch_ingest_runs( Defaults to False. Returns: - None: If both `create` and `update` are None. + None Raises: LangsmithAPIError: If there is an error in the API request. @@ -1557,7 +1557,7 @@ def multipart_ingest_runs( ] = None, *, pre_sampled: bool = False, - ): + ) -> None: """Batch ingest/upsert multiple runs in the Langsmith system. Args: @@ -1572,7 +1572,7 @@ def multipart_ingest_runs( Defaults to False. Returns: - None: If both `create` and `update` are None. + None Raises: LangsmithAPIError: If there is an error in the API request. @@ -5795,6 +5795,7 @@ def _tracing_thread_handle_batch( _AUTO_SCALE_UP_NTHREADS_LIMIT = 16 _AUTO_SCALE_DOWN_NEMPTY_TRIGGER = 4 _BLOCKSIZE_BYTES = 1024 * 1024 # 1MB +_USE_MULTIPART = os.getenv("LANGSMITH_FF_MULTIPART") in ["1", "true"] def _ensure_ingest_config( @@ -5828,7 +5829,7 @@ def _tracing_control_thread_func(client_ref: weakref.ref[Client]) -> None: size_limit: int = batch_ingest_config["size_limit"] scale_up_nthreads_limit: int = batch_ingest_config["scale_up_nthreads_limit"] scale_up_qsize_trigger: int = batch_ingest_config["scale_up_qsize_trigger"] - use_multipart = os.getenv("LANGSMITH_FF_MULTIPART") in ["1", "true"] + use_multipart = _USE_MULTIPART # use_multipart = batch_ingest_config.get("use_multipart_endpoint", False) # TODO replace FF with reading from batch_ingest_config diff --git a/python/langsmith/schemas.py b/python/langsmith/schemas.py index 3a69e4d6f..fb4e13ef6 100644 --- a/python/langsmith/schemas.py +++ b/python/langsmith/schemas.py @@ -254,6 +254,10 @@ class RunBase(BaseModel): tags: Optional[List[str]] = None """Tags for categorizing or annotating the run.""" + attachments: Attachments = Field(default_factory=dict) + """Attachments associated with the run. + Each entry is a tuple of (mime_type, bytes).""" + _lock: threading.Lock = PrivateAttr(default_factory=threading.Lock) @property @@ -322,9 +326,6 @@ class Run(RunBase): """ # noqa: E501 in_dataset: Optional[bool] = None """Whether this run is in a dataset.""" - attachments: Attachments = Field(default_factory=dict) - """Attachments associated with the run. - Each entry is a tuple of (mime_type, bytes).""" _host_url: Optional[str] = PrivateAttr(default=None) def __init__(self, _host_url: Optional[str] = None, **kwargs: Any) -> None: