Skip to content

Commit

Permalink
Add run parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Nov 13, 2024
1 parent 33a621c commit 2381947
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
16 changes: 14 additions & 2 deletions js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Run> {
assertUuid(runId);
let run = await this._get<Run>(`/runs/${runId}`);
const params =
excludeS3StoredAttributes !== undefined
? new URLSearchParams({
exclude_s3_stored_attributes: excludeS3StoredAttributes.toString(),
})
: undefined;
let run = await this._get<Run>(`/runs/${runId}`, params);
if (loadChildRuns && run.child_run_ids) {
run = await this._loadChildRuns(run);
}
Expand Down
11 changes: 7 additions & 4 deletions js/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>;

/** 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<string, string>;

/** Dictionary of presigned URLs for attachments and oversized extra/error values stored in blob storage. */
s3_urls?: Record<string, string>;
}

export interface RunCreate extends BaseRun {
Expand Down
13 changes: 11 additions & 2 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions python/langsmith/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="")
Expand Down

0 comments on commit 2381947

Please sign in to comment.