Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing parameters in fetched run type #1213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
16 changes: 14 additions & 2 deletions js/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as uuid from "uuid";

Check notice on line 1 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / benchmark

Benchmark results

......................................... create_5_000_run_trees: Mean +- std dev: 623 ms +- 48 ms ......................................... create_10_000_run_trees: Mean +- std dev: 1.20 sec +- 0.06 sec ......................................... create_20_000_run_trees: Mean +- std dev: 1.20 sec +- 0.06 sec ......................................... dumps_class_nested_py_branch_and_leaf_200x400: Mean +- std dev: 702 us +- 11 us ......................................... dumps_class_nested_py_leaf_50x100: Mean +- std dev: 25.0 ms +- 0.3 ms ......................................... dumps_class_nested_py_leaf_100x200: Mean +- std dev: 104 ms +- 4 ms ......................................... dumps_dataclass_nested_50x100: Mean +- std dev: 25.2 ms +- 0.3 ms ......................................... WARNING: the benchmark result may be unstable * the standard deviation (16.5 ms) is 25% of the mean (65.7 ms) Try to rerun the benchmark with more runs, values and/or loops. Run 'python -m pyperf system tune' command to reduce the system jitter. Use pyperf stats, pyperf dump and pyperf hist to analyze results. Use --quiet option to hide these warnings. dumps_pydantic_nested_50x100: Mean +- std dev: 65.7 ms +- 16.5 ms ......................................... WARNING: the benchmark result may be unstable * the standard deviation (30.9 ms) is 14% of the mean (220 ms) Try to rerun the benchmark with more runs, values and/or loops. Run 'python -m pyperf system tune' command to reduce the system jitter. Use pyperf stats, pyperf dump and pyperf hist to analyze results. Use --quiet option to hide these warnings. dumps_pydanticv1_nested_50x100: Mean +- std dev: 220 ms +- 31 ms

Check notice on line 1 in js/src/client.ts

View workflow job for this annotation

GitHub Actions / benchmark

Comparison against main

+------------------------------------+---------+-----------------------+ | Benchmark | main | changes | +====================================+=========+=======================+ | dumps_class_nested_py_leaf_100x200 | 105 ms | 104 ms: 1.01x faster | +------------------------------------+---------+-----------------------+ | dumps_dataclass_nested_50x100 | 25.4 ms | 25.2 ms: 1.01x faster | +------------------------------------+---------+-----------------------+ | dumps_class_nested_py_leaf_50x100 | 25.1 ms | 25.0 ms: 1.01x faster | +------------------------------------+---------+-----------------------+ | Geometric mean | (ref) | 1.01x faster | +------------------------------------+---------+-----------------------+ Benchmark hidden because not significant (6): dumps_pydantic_nested_50x100, dumps_pydanticv1_nested_50x100, create_5_000_run_trees, create_10_000_run_trees, dumps_class_nested_py_branch_and_leaf_200x400, create_20_000_run_trees

import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
Expand Down Expand Up @@ -1234,10 +1234,22 @@

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
Loading