diff --git a/js/src/client.ts b/js/src/client.ts index 8c094e7fd..9fe068d5e 100644 --- a/js/src/client.ts +++ b/js/src/client.ts @@ -1234,10 +1234,22 @@ export class Client { public async readRun( runId: string, - { loadChildRuns }: { loadChildRuns: boolean } = { loadChildRuns: false } + { + loadChildRuns = false, + excludeS3StoredAttributes, + }: { + loadChildRuns?: boolean; + excludeS3StoredAttributes?: boolean; + } = {} ): Promise { assertUuid(runId); - let run = await this._get(`/runs/${runId}`); + const params = + excludeS3StoredAttributes !== undefined + ? new URLSearchParams({ + exclude_s3_stored_attributes: excludeS3StoredAttributes.toString(), + }) + : undefined; + let run = await this._get(`/runs/${runId}`, params); if (loadChildRuns && run.child_run_ids) { run = await this._loadChildRuns(run); } diff --git a/js/src/schemas.ts b/js/src/schemas.ts index 26afd7fc0..99df09799 100644 --- a/js/src/schemas.ts +++ b/js/src/schemas.ts @@ -193,11 +193,14 @@ export interface Run extends BaseRun { /** Whether the run is included in a dataset. */ in_dataset?: boolean; - /** The output S3 URLs */ - outputs_s3_urls?: S3URL; + /** Dictionary of presigned URLs for output data stored in blob storage, typically for multimedia in LLM runs. */ + outputs_s3_urls?: Record; - /** The input S3 URLs */ - inputs_s3_urls?: S3URL; + /** Dictionary of presigned URLs for input data stored in blob storage, typically for multimedia in LLM runs. */ + inputs_s3_urls?: Record; + + /** Dictionary of presigned URLs for attachments and oversized extra/error values stored in blob storage. */ + s3_urls?: Record; } export interface RunCreate extends BaseRun { diff --git a/python/langsmith/client.py b/python/langsmith/client.py index eb397b4c4..85ceadf5c 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -1740,7 +1740,11 @@ def _load_child_runs(self, run: ls_schemas.Run) -> ls_schemas.Run: return run def read_run( - self, run_id: ID_TYPE, load_child_runs: bool = False + self, + run_id: ID_TYPE, + load_child_runs: bool = False, + *, + exclude_s3_stored_attributes: Optional[bool] = None, ) -> ls_schemas.Run: """Read a run from the LangSmith API. @@ -1756,8 +1760,13 @@ def read_run( Run The run. """ + params = ( + None + if exclude_s3_stored_attributes is None + else {"exclude_s3_stored_attributes": exclude_s3_stored_attributes} + ) response = self.request_with_retries( - "GET", f"/runs/{_as_uuid(run_id, 'run_id')}" + "GET", f"/runs/{_as_uuid(run_id, 'run_id')}", params=params ) run = ls_schemas.Run(**response.json(), _host_url=self._host_url) if load_child_runs and run.child_run_ids: diff --git a/python/langsmith/schemas.py b/python/langsmith/schemas.py index 80e112e46..1e4bf9902 100644 --- a/python/langsmith/schemas.py +++ b/python/langsmith/schemas.py @@ -333,6 +333,12 @@ class Run(RunBase): parent_run_ids: Optional[List[UUID]] = None """List of parent run IDs.""" + inputs_s3_urls: Optional[dict] = None + """Dictionary of presigned URLs for input data stored in blob storage, typically for multimedia in LLM runs.""" + outputs_s3_urls: Optional[dict] = None + """Dictionary of presigned URLs for output data stored in blob storage, typically for multimedia in LLM runs.""" + s3_urls: Optional[dict] = None + """Dictionary of presigned URLs for attachments and oversized extra/error values stored in blob storage.""" trace_id: UUID """Unique ID assigned to every run within this nested trace.""" dotted_order: str = Field(default="")