langsmith-sdk API reference
340 public APIs from langsmith-sdk (langchain-ai/langsmith-sdk) — 137 classes, 84 functions, 119 methods. Signatures extracted by static analysis of the actual source.
Repository: langchain-ai/langsmith-sdk
| Kind | Count |
|---|---|
| Classes | 137 |
| Functions | 84 |
| Methods | 119 |
API list
func
python.bench.create_run.benchmark_run_creation(*num_runs:int, *json_size:int, *samples:int, *benchmark_thread:bool) -> DictBenchmark run creation with specified parameters.
func
python.bench.create_run.create_large_json(length:int) -> DictCreate a large JSON object for benchmarking purposes.
func
python.bench.create_run.create_run_data(run_id:str, json_size:int) -> DictCreate a single run data object.
func
python.bench.create_run.mock_session() -> MockCreate a mock session object.
class
python.bench.dumps_json.DeeplyNestedAn object.
func
python.bench.json_serialization.serialize_sequential(data)Serialize data sequentially.
func
python.bench.tracing_client_bench.benchmark_run_creation(num_runs:int, json_size:int, samples:int=1) -> DictBenchmark run creation with specified parameters.
func
python.bench.tracing_client_bench.create_large_json(length:int) -> DictCreate a large JSON object for benchmarking purposes.
func
python.bench.tracing_client_bench.create_run_data(run_id:str, json_size:int, start_time:Optional[datetime]=None) -> DictCreate a single run data object.
func
python.bench.tracing_client_via_pyo3.benchmark_run_creation(json_size, num_runs) -> NoneBenchmark the creation of runs.
func
python.bench.tracing_rust_client_bench.benchmark_run_creation(num_runs:int, json_size:int, samples:int=1) -> DictBenchmark run creation with specified parameters.
func
python.bench.upload_example_with_large_file_attachment.create_large_file(size:int, dir:str) -> strCreate a large file for benchmarking purposes.
func
python.bench.upload_examples_bench.benchmark_example_uploading(num_examples:int, json_size:int, samples:int=1) -> DictBenchmark run creation with specified parameters.
func
python.bench.upload_examples_bench.create_example_data(dataset_id:str, json_size:int) -> DictCreate a single example data object.
func
python.bench.upload_examples_bench.create_large_json(length:int) -> DictCreate a large JSON object for benchmarking purposes.
func
python.langsmith._internal._aiter.accepts_context(callable:Callable[..., Any]) -> boolCheck if a callable accepts a context argument.
func
python.langsmith._internal._aiter.async_zip(*async_iterables)Async version of zip.
func
python.langsmith._internal._aiter.tee_peer(iterator:AsyncIterator[T], buffer:deque[T], peers:list[deque[T]], lock:AbstractAsyncContextManager[Any]) -> AsyncGenerator[T, None]Iterate over :py:func:`~.tee`.
class
python.langsmith._internal._background_thread.TracingQueueItemAn item in the tracing queue.
func
python.langsmith._internal._context.get_current_run_tree() -> Optional['RunTree']Get the current RunTree from the context.
func
python.langsmith._internal._hub.build_commit_url(host:str, name:str, commit_hash:str, organization_id:str) -> strBuild the URL for a hub directory commit.
func
python.langsmith._internal._otel_utils.get_otel_span_id_from_uuid(uuid_val:UUID) -> intGet OpenTelemetry span ID as integer from UUID.
func
python.langsmith._internal._otel_utils.get_otel_trace_id_from_uuid(uuid_val:UUID) -> intGet OpenTelemetry trace ID as integer from UUID.
func
python.langsmith._internal._patch.new_request(self, *args, **kwargs)Handle parent request.
func
python.langsmith._internal._patch.request(self, method, url, body=None, headers=None)Make the request.
class
python.langsmith._internal._serde.ZoneInfoIntroduced in python 3.9.
func
python.langsmith._internal._serde.dumps_json(obj:Any) -> bytesSerialize an object to a JSON formatted string.
func
python.langsmith._internal._uuid.is_uuid_v7(uuid_obj:uuid.UUID) -> boolCheck if a UUID is version 7.
func
python.langsmith._internal._uuid.warn_if_not_uuid_v7(uuid_obj:uuid.UUID, id_type:str) -> NoneWarn if a UUID is not version 7.
func
python.langsmith._internal.voice.audio.pcm_to_wav(pcm:bytes, sample_rate:int, num_channels:int=1) -> bytesWrap raw PCM16 bytes in a WAV container.
func
python.langsmith._internal.voice.helpers.dump_event(event:Any) -> dict[str, Any]Best-effort conversion of an event object to a plain dict.
func
python.langsmith._internal.voice.helpers.scrub(obj:Any) -> AnyMake an event payload safe and compact for a span.
class
python.langsmith._internal.voice.session.EventSessionConversation-level tracing state.
method
python.langsmith._internal.voice.session.EventSession.add_message(role:str, content:str) -> NoneAppend one transcript line to the conversation rollup.
func
python.langsmith._internal.voice.set_thread_id(thread_id:Optional[str]) -> NoneSet the LangSmith thread id for the current (async) context.
class
python.langsmith._openapi_client._base_client.BasePageDefines the core interface for pagination.
func
python.langsmith._openapi_client._files.deepcopy_with_paths(item:_T, paths:Sequence[Sequence[str]]) -> _TCopy only the containers along the given paths.
func
python.langsmith._openapi_client._models.set_pydantic_config(typ:Any, config:pydantic.ConfigDict) -> NoneAdd a pydantic config for the given type.
method
python.langsmith._openapi_client._streaming.Stream.close() -> NoneClose the response and release the connection.
func
python.langsmith._openapi_client._utils._json.openapi_dumps(obj:Any) -> bytesSerialize an object to UTF-8 encoded JSON bytes.
func
python.langsmith._openapi_client._utils._typing.is_iterable_type(typ:type) -> boolIf the given type is `typing.Iterable[T]`
func
python.langsmith._openapi_client._utils._utils.quote(string:str) -> strAdd single quotation marks around the given string.
func
python.langsmith._openapi_client._utils._utils.removeprefix(string:str, prefix:str) -> strRemove a prefix from a string.
func
python.langsmith._openapi_client._utils._utils.removesuffix(string:str, suffix:str) -> strRemove a suffix from a string.
class
python.langsmith._openapi_client.types.annotation_queue_schema.AnnotationQueueSchemaAnnotationQueue schema.
class
python.langsmith._openapi_client.types.annotation_queue_size_schema.AnnotationQueueSizeSchemaSize of an Annotation Queue
class
python.langsmith._openapi_client.types.annotation_queues.run_create_by_key_params.BodyAdd run to AQ by SmithDB key.
class
python.langsmith._runtime_overrides.RuntimeOverridesOverrides for LangSmith runtime behavior.
func
python.langsmith._runtime_overrides.get_runtime_overrides() -> RuntimeOverridesGet the current runtime overrides.
func
python.langsmith._runtime_overrides.set_runtime_overrides(aio_to_thread:Optional[AioToThread]=None) -> NoneSet LangSmith runtime overrides.
class
python.langsmith.anonymizer.ReplacerOptionsConfiguration options for replacing sensitive data.
class
python.langsmith.anonymizer.StringNodeString node extracted from the data.
class
python.langsmith.anonymizer.StringNodeProcessorProcesses a list of string nodes for masking.
method
python.langsmith.anonymizer.StringNodeProcessor.mask_nodes(nodes:list[StringNode]) -> list[StringNode]Accept and return a list of string nodes to be masked.
class
python.langsmith.anonymizer.StringNodeRuleDeclarative rule used for replacing sensitive data.
func
python.langsmith.anonymizer.create_anonymizer(replacer:ReplacerType, *max_depth:Optional[int]=None) -> Callable[[Any], Any]Create an anonymizer function.
class
python.langsmith.async_client.AsyncClientAsync Client for interacting with the LangSmith API.
method
python.langsmith.async_client.AsyncClient.aclose()Close the async client.
method
python.langsmith.async_client.AsyncClient.agent_exists(identifier:str) -> boolCheck if an agent repo exists.
method
python.langsmith.async_client.AsyncClient.api_key() -> Optional[str]Return the API key used for authentication.
method
python.langsmith.async_client.AsyncClient.create_dataset(dataset_name:str, **kwargs:Any) -> ls_schemas.DatasetCreate a dataset.
method
python.langsmith.async_client.AsyncClient.create_example(inputs:dict[str, Any], outputs:Optional[dict[str, Any]]=None, dataset_id:Optional[ls_client.ID_TYPE]=None, dataset_name:Optional[str]=None, **kwargs:Any) -> ls_schemas.ExampleCreate an example.
method
python.langsmith.async_client.AsyncClient.create_project(project_name:str, **kwargs:Any) -> ls_schemas.TracerSessionCreate a project.
method
python.langsmith.async_client.AsyncClient.create_prompt(prompt_identifier:str, *description:Optional[str]=None, *readme:Optional[str]=None, *tags:Optional[Sequence[str]]=None, *is_public:bool=False) -> ls_schemas.PromptCreate a new prompt.
method
python.langsmith.async_client.AsyncClient.create_run(name:str, inputs:dict[str, Any], run_type:str, *project_name:Optional[str]=None, *revision_id:Optional[ls_client.ID_TYPE]=None, **kwargs:Any) -> NoneCreate a run.
method
python.langsmith.async_client.AsyncClient.delete_agent(identifier:str) -> NoneDelete an agent and its owned child file repos.
method
python.langsmith.async_client.AsyncClient.delete_dataset(dataset_id:ls_client.ID_TYPE) -> NoneDelete a dataset.
method
python.langsmith.async_client.AsyncClient.delete_feedback(feedback_id:ID_TYPE) -> NoneDelete a feedback by ID.
method
python.langsmith.async_client.AsyncClient.delete_feedback_config(feedback_key:str) -> NoneDelete a feedback configuration.
method
python.langsmith.async_client.AsyncClient.delete_project(*project_name:Optional[str]=None, *project_id:Optional[str]=None) -> NoneDelete a project from LangSmith.
method
python.langsmith.async_client.AsyncClient.delete_prompt(prompt_identifier:str) -> NoneDelete a prompt.
method
python.langsmith.async_client.AsyncClient.delete_skill(identifier:str) -> NoneDelete a skill and its owned child file repos.
method
python.langsmith.async_client.AsyncClient.evaluators() -> AsyncEvaluatorsResourceAccess the evaluator resource.
method
python.langsmith.async_client.AsyncClient.get_prompt(prompt_identifier:str) -> Optional[ls_schemas.Prompt]Get a specific prompt by its identifier.
method
python.langsmith.async_client.AsyncClient.headers() -> dict[str, str]Return the custom headers used for API requests.
method
python.langsmith.async_client.AsyncClient.info() -> ls_schemas.LangSmithInfoGet information about the LangSmith server.
method
python.langsmith.async_client.AsyncClient.like_prompt(prompt_identifier:str) -> dict[str, int]Like a prompt.
method
python.langsmith.async_client.AsyncClient.list_datasets(**kwargs:Any) -> AsyncIterator[ls_schemas.Dataset]List datasets.
method
python.langsmith.async_client.AsyncClient.list_examples(*dataset_id:Optional[ls_client.ID_TYPE]=None, *dataset_name:Optional[str]=None, **kwargs:Any) -> AsyncIterator[ls_schemas.Example]List examples.
method
python.langsmith.async_client.AsyncClient.public() -> AsyncPublicResourceAccess the public shared-run resource.
method
python.langsmith.async_client.AsyncClient.pull_agent(identifier:str, *version:Optional[str]=None) -> ls_schemas.AgentContextPull an agent from Hub.
method
python.langsmith.async_client.AsyncClient.pull_skill(identifier:str, *version:Optional[str]=None) -> ls_schemas.SkillContextPull a skill from Hub.
method
python.langsmith.async_client.AsyncClient.read_dataset(dataset_name:Optional[str]=None, dataset_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.DatasetRead a dataset.
method
python.langsmith.async_client.AsyncClient.read_example(example_id:ls_client.ID_TYPE) -> ls_schemas.ExampleRead an example.
method
python.langsmith.async_client.AsyncClient.read_feedback(feedback_id:ls_client.ID_TYPE) -> ls_schemas.FeedbackRead feedback.
method
python.langsmith.async_client.AsyncClient.read_project(project_name:Optional[str]=None, project_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.TracerSessionRead a project.
method
python.langsmith.async_client.AsyncClient.read_run(run_id:ls_client.ID_TYPE, *project_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.RunRead a run.
method
python.langsmith.async_client.AsyncClient.run_is_shared(run_id:ls_client.ID_TYPE) -> boolGet share state for a run asynchronously.
method
python.langsmith.async_client.AsyncClient.runs() -> AsyncRunsResourceAccess the runs resource.
method
python.langsmith.async_client.AsyncClient.share_run(run_id:ls_client.ID_TYPE, *share_id:Optional[ls_client.ID_TYPE]=None) -> strGet a share link for a run asynchronously.
method
python.langsmith.async_client.AsyncClient.skill_exists(identifier:str) -> boolCheck if a skill repo exists.
method
python.langsmith.async_client.AsyncClient.traces() -> AsyncTracesResourceAccess the traces resource (query, list_runs).
method
python.langsmith.async_client.AsyncClient.unlike_prompt(prompt_identifier:str) -> dict[str, int]Unlike a prompt.
method
python.langsmith.async_client.AsyncClient.update_run(run_id:ls_client.ID_TYPE, **kwargs:Any) -> NoneUpdate a run.
method
python.langsmith.async_client.AsyncClient.workspace_id() -> Optional[str]Return the workspace ID used for API requests.
func
python.langsmith.evaluation._arunner.async_chain_from_iterable(iterable:Iterable[AsyncIterable[T]]) -> AsyncIterator[T]Chain multiple async iterables.
func
python.langsmith.evaluation._name_generation.random_name() -> strGenerate a random name.
class
python.langsmith.evaluation._runner.ExperimentResultsRepresents the results of an evaluate() call.
method
python.langsmith.evaluation._runner.ExperimentResults.experiment_id() -> uuid.UUIDThe ID of the experiment.
method
python.langsmith.evaluation._runner.ExperimentResults.wait() -> NoneWait for the evaluation runner to complete.
class
python.langsmith.evaluation.evaluator.CategoryA category for categorical feedback.
class
python.langsmith.evaluation.evaluator.EvaluationResultEvaluation result.
class
python.langsmith.evaluation.evaluator.EvaluationResultsBatch evaluation results.
class
python.langsmith.evaluation.evaluator.FeedbackConfigConfiguration to define a type of feedback.
class
python.langsmith.evaluation.evaluator.RunEvaluatorEvaluator interface class.
method
python.langsmith.evaluation.evaluator.RunEvaluator.evaluate_run(run:Run, example:Optional[Example]=None, evaluator_run_id:Optional[uuid.UUID]=None) -> Union[EvaluationResult, EvaluationResults]Evaluate an example.
class
python.langsmith.evaluation.llm_evaluator.CategoricalScoreConfigConfiguration for a categorical score.
class
python.langsmith.evaluation.llm_evaluator.ContinuousScoreConfigConfiguration for a continuous score.
class
python.langsmith.evaluation.llm_evaluator.LLMEvaluatorA class for building LLM-as-a-judge evaluators.
method
python.langsmith.evaluation.llm_evaluator.LLMEvaluator.aevaluate_run(run:Run, example:Optional[Example]=None) -> Union[EvaluationResult, EvaluationResults]Asynchronously evaluate a run.
method
python.langsmith.evaluation.llm_evaluator.LLMEvaluator.evaluate_run(run:Run, example:Optional[Example]=None) -> Union[EvaluationResult, EvaluationResults]Evaluate a run.
method
python.langsmith.evaluation.string_evaluator.StringEvaluator.evaluate_run(run:Run, example:Optional[Example]=None, evaluator_run_id:Optional[uuid.UUID]=None) -> EvaluationResultEvaluate a single run.
func
python.langsmith.integrations.claude_agent_sdk._config.get_tracing_config() -> dict[str, Any]Get the current tracing configuration.
func
python.langsmith.integrations.claude_agent_sdk._tools.clear_parent_run_tree(token:Any=None) -> NoneReset the parent run tree in the current context.
func
python.langsmith.integrations.google_adk._messages.has_function_calls(llm_response:Any) -> boolCheck if LlmResponse contains function calls.
func
python.langsmith.integrations.google_adk._usage.extract_model_name(llm_request:Any) -> Optional[str]Extract the model name from an LlmRequest.
func
python.langsmith.integrations.google_adk._usage.extract_usage_from_response(llm_response:Any) -> dict[str, Any]Extract token usage from LlmResponse.
func
python.langsmith.integrations.openai_realtime._connection.is_inbound(event_type:str) -> boolDirection of an event relative to the model.
class
python.langsmith.integrations.otel.processor.BatchSpanProcessorMock batch span processor class.
class
python.langsmith.integrations.otel.processor.OTLPSpanExporterMock otlp span exporter class.
class
python.langsmith.integrations.otel.processor.traceMock trace class.
class
python.langsmith.prompt_cache.AsyncCacheDeprecated alias for AsyncPromptCache.
class
python.langsmith.prompt_cache.AsyncPromptCacheThread-safe LRU cache with asyncio task refresh.
method
python.langsmith.prompt_cache.AsyncPromptCache.aset(key:str, value:Any, refresh_func:Callable[[], Awaitable[Any]]) -> NoneSet a value in the cache.
method
python.langsmith.prompt_cache.AsyncPromptCache.shutdown() -> NoneStop background refresh task.
method
python.langsmith.prompt_cache.AsyncPromptCache.start() -> NoneStart async background refresh loop.
method
python.langsmith.prompt_cache.AsyncPromptCache.stop() -> NoneStop async background refresh loop.
class
python.langsmith.prompt_cache.CacheDeprecated alias for PromptCache.
class
python.langsmith.prompt_cache.CacheEntryA single cache entry with metadata for TTL tracking.
method
python.langsmith.prompt_cache.CacheEntry.is_stale(ttl_seconds:Optional[float]) -> boolCheck if entry is past its TTL (needs refresh).
class
python.langsmith.prompt_cache.CacheMetricsCache performance metrics.
method
python.langsmith.prompt_cache.CacheMetrics.hit_rate() -> floatCache hit rate (0.0 to 1.0).
method
python.langsmith.prompt_cache.CacheMetrics.total_requests() -> intTotal cache requests (hits + misses).
class
python.langsmith.prompt_cache.PromptCacheThread-safe LRU cache with background thread refresh.
method
python.langsmith.prompt_cache.PromptCache.set(key:str, value:Any, refresh_func:Callable[[], Any]) -> NoneSet a value in the cache.
method
python.langsmith.prompt_cache.PromptCache.shutdown() -> NoneStop background refresh thread.
method
python.langsmith.prompt_cache.PromptCache.stop() -> NoneStop background refresh thread.
func
python.langsmith.run_helpers.async_wrapper(*langsmith_extra:Optional[LangSmithExtra]=None, *args:Any, **kwargs:Any) -> AnyAsync version of wrapper function.
func
python.langsmith.run_helpers.get_current_run_tree() -> Optional[run_trees.RunTree]Get the current run tree.
func
python.langsmith.run_helpers.get_tracing_context(context:Optional[contextvars.Context]=None) -> dict[str, Any]Get the current tracing context.
func
python.langsmith.run_helpers.is_async(func:Callable) -> boolInspect function or wrapped function to see if it is async.
func
python.langsmith.run_helpers.is_traceable_function(func:Any) -> TypeGuard[SupportsLangsmithExtra[P, R]]Check if a function is `@traceable` decorated.
func
python.langsmith.run_helpers.set_run_metadata(**metadata:Any) -> NoneUpdate metadata on the current run tree.
class
python.langsmith.run_helpers.traceManage a LangSmith run in context.
class
python.langsmith.run_trees.ApiKeyAuthAPI key authentication for write replicas.
class
python.langsmith.run_trees.AuthHeadersCustom authentication headers for write replicas.
class
python.langsmith.run_trees.RunTreeRun Schema with back-references for posting runs.
method
python.langsmith.run_trees.RunTree.add_event(events:Union[ls_schemas.RunEvent, Sequence[ls_schemas.RunEvent], Sequence[dict], dict, str]) -> NoneAdd an event to the list of events.
method
python.langsmith.run_trees.RunTree.add_inputs(inputs:dict[str, Any]) -> NoneUpsert the given inputs into the run.
method
python.langsmith.run_trees.RunTree.add_metadata(metadata:dict[str, Any]) -> NoneAdd metadata to the run.
method
python.langsmith.run_trees.RunTree.add_outputs(outputs:dict[str, Any]) -> NoneUpsert the given outputs into the run.
method
python.langsmith.run_trees.RunTree.add_tags(tags:Union[Sequence[str], str]) -> NoneAdd tags to the run.
method
python.langsmith.run_trees.RunTree.client() -> ClientReturn the client.
method
python.langsmith.run_trees.RunTree.ensure_dotted_order() -> RunTreeEnsure the dotted order of the run.
method
python.langsmith.run_trees.RunTree.get_url() -> strReturn the URL of the run.
method
python.langsmith.run_trees.RunTree.infer_defaults(values:dict[str, Any]) -> dict[str, Any]Assign name to the run.
method
python.langsmith.run_trees.RunTree.patch(*exclude_inputs:bool=False) -> NonePatch the run tree to the API in a background thread.
method
python.langsmith.run_trees.RunTree.post(exclude_child_runs:bool=True) -> NonePost the run tree to the API asynchronously.
method
python.langsmith.run_trees.RunTree.to_headers() -> dict[str, str]Return the `RunTree` as a dictionary of headers.
method
python.langsmith.run_trees.RunTree.trace_start_time() -> datetimeReturn the start time of the trace (root run).
method
python.langsmith.run_trees.RunTree.wait() -> NoneWait for all `_futures` to complete.
class
python.langsmith.run_trees.WriteReplicaConfiguration for a write replica endpoint.
class
python.langsmith.sandbox._client.SandboxClientClient for interacting with the Sandbox Server API.
method
python.langsmith.sandbox._client.SandboxClient.close() -> NoneClose the HTTP client.
method
python.langsmith.sandbox._client.SandboxClient.delete_sandbox(name:str, *headers:RequestHeaders=None) -> NoneDelete a Sandbox.
method
python.langsmith.sandbox._client.SandboxClient.delete_snapshot(snapshot_id:str, *headers:RequestHeaders=None) -> NoneDelete a snapshot.
method
python.langsmith.sandbox._client.SandboxClient.get_sandbox(name:str, *headers:RequestHeaders=None) -> SandboxGet a Sandbox by name.
method
python.langsmith.sandbox._client.SandboxClient.get_sandbox_status(name:str, *headers:RequestHeaders=None) -> ResourceStatusGet the provisioning status of a sandbox.
method
python.langsmith.sandbox._client.SandboxClient.get_snapshot(snapshot_id:str, *headers:RequestHeaders=None) -> SnapshotGet a snapshot by ID.
method
python.langsmith.sandbox._client.SandboxClient.list_sandboxes(*headers:RequestHeaders=None) -> list[Sandbox]List all Sandboxes.
method
python.langsmith.sandbox._client.SandboxClient.list_snapshots(*name_contains:Optional[str]=None, *limit:Optional[int]=None, *offset:Optional[int]=None, *headers:RequestHeaders=None) -> list[Snapshot]List snapshots.
method
python.langsmith.sandbox._client.SandboxClient.start_sandbox(name:str, *timeout:int=120, *headers:RequestHeaders=None) -> SandboxStart a stopped sandbox and wait until ready.
class
python.langsmith.sandbox._exceptions.CommandTimeoutErrorRaised when a command exceeds its timeout.
class
python.langsmith.sandbox._exceptions.ResourceCreationErrorRaised when resource provisioning fails.
class
python.langsmith.sandbox._exceptions.ResourceNotFoundErrorRaised when a resource is not found.
class
python.langsmith.sandbox._exceptions.ResourceTimeoutErrorRaised when an operation times out.
class
python.langsmith.sandbox._exceptions.SandboxClientErrorBase exception for sandbox client errors.
class
python.langsmith.sandbox._exceptions.TunnelErrorBase exception for TCP tunnel errors.
class
python.langsmith.sandbox._exceptions.TunnelPortNotAllowedErrorThe daemon rejected the port as not allowed.
class
python.langsmith.sandbox._exceptions.ValidationErrorRaised when request validation fails.
func
python.langsmith.sandbox._helpers.extract_quota_type(message:str) -> Optional[str]Extract quota type from error message.
func
python.langsmith.sandbox._helpers.handle_sandbox_creation_error(error:httpx.HTTPStatusError) -> NoneHandle HTTP errors specific to sandbox creation.
func
python.langsmith.sandbox._helpers.parse_error_response(error:httpx.HTTPStatusError) -> dict[str, Any]Parse standardized error response.
func
python.langsmith.sandbox._helpers.parse_validation_error(error:httpx.HTTPStatusError) -> list[dict]Parse Pydantic validation error response.
func
python.langsmith.sandbox._helpers.validate_service_params(port:int, expires_in_seconds:int) -> NoneValidate parameters for service URL generation.
func
python.langsmith.sandbox._helpers.validate_ttl(value:Optional[int], name:str) -> NoneValidate a TTL value for sandbox create/update.
class
python.langsmith.sandbox._models.ExecutionResultResult of executing a command in a sandbox.
method
python.langsmith.sandbox._models.ExecutionResult.success() -> boolReturn True if the command exited with code 0.
method
python.langsmith.sandbox._models.ResourceStatus.from_dict(data:dict[str, Any]) -> ResourceStatusCreate a ResourceStatus from API response dict.
class
python.langsmith.sandbox._models.SnapshotRepresents a sandbox snapshot.
method
python.langsmith.sandbox._models.Snapshot.from_dict(data:dict[str, Any]) -> SnapshotCreate a Snapshot from API response dict.
class
python.langsmith.sandbox._mounts.GCSMountConfigGCS configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.GCSMountConfigRequiredRequired GCS configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.GCSMountSpecGCS-backed sandbox mount specification.
class
python.langsmith.sandbox._mounts.GitMountConfigGit configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.GitMountConfigRequiredRequired Git configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.GitMountRefSpecGit ref selected for a sandbox mount.
class
python.langsmith.sandbox._mounts.GitMountSpecGit-backed sandbox mount specification.
class
python.langsmith.sandbox._mounts.S3MountConfigS3 configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.S3MountConfigRequiredRequired S3 configuration for a sandbox mount.
class
python.langsmith.sandbox._mounts.S3MountSpecS3-backed sandbox mount specification.
class
python.langsmith.sandbox._mounts.SandboxMountAuthConfigProvider auth blocks for sandbox mounts.
class
python.langsmith.sandbox._mounts.SandboxMountConfigPublic mount config sent to the sandbox API.
method
python.langsmith.sandbox._sandbox.Sandbox.capture_snapshot(name:str, *timeout:int=60, *headers:RequestHeaders=None) -> SnapshotCapture a snapshot from this sandbox.
method
python.langsmith.sandbox._sandbox.Sandbox.delete(*headers:RequestHeaders=None) -> NoneDelete this sandbox.
method
python.langsmith.sandbox._sandbox.Sandbox.from_dict(data:dict[str, Any], client:SandboxClient, auto_delete:bool=True) -> SandboxCreate a Sandbox from API response dict.
method
python.langsmith.sandbox._sandbox.Sandbox.read(path:str, *timeout:int=60, *headers:RequestHeaders=None) -> bytesRead a file from the sandbox.
method
python.langsmith.sandbox._sandbox.Sandbox.start(*timeout:int=120, *headers:RequestHeaders=None) -> NoneStart a stopped sandbox and wait until ready.
method
python.langsmith.sandbox._sandbox.Sandbox.write(path:str, content:Union[str, bytes], *timeout:int=60, *headers:RequestHeaders=None) -> NoneWrite content to a file in the sandbox.
class
python.langsmith.sandbox._tunnel.AsyncTunnelAsync wrapper around :class:`Tunnel`.
class
python.langsmith.sandbox._tunnel.TunnelTCP tunnel to a port inside a sandbox.
method
python.langsmith.sandbox._tunnel.Tunnel.close() -> NoneShut down the tunnel, closing all connections.
method
python.langsmith.sandbox._tunnel.Tunnel.local_port() -> intLocal port the tunnel is listening on.
method
python.langsmith.sandbox._yamux.YamuxSession.close() -> NoneClose the session and all streams.
method
python.langsmith.sandbox._yamux.YamuxSession.open_stream() -> YamuxStreamOpen a new multiplexed stream.
class
python.langsmith.sandbox._yamux.YamuxStreamA single multiplexed stream within a yamux session.
method
python.langsmith.sandbox._yamux.YamuxStream.close() -> NoneClose the stream (sends FIN to the remote end).
method
python.langsmith.sandbox._yamux.YamuxStream.read(n:int) -> bytesRead up to *n* bytes, blocking until data is available.
method
python.langsmith.sandbox._yamux.YamuxStream.write(data:bytes) -> intWrite *data*, blocking if the send window is exhausted.
class
python.langsmith.schemas.APIFeedbackSourceAPI feedback source.
class
python.langsmith.schemas.AgentContextAn agent pulled from hub.
class
python.langsmith.schemas.AgentEntryA link to another agent repo.
class
python.langsmith.schemas.AnnotationQueueRepresents an annotation queue.
class
python.langsmith.schemas.AnnotationQueueWithDetailsRepresents an annotation queue with details.
class
python.langsmith.schemas.AttachmentInfoInfo for an attachment.
class
python.langsmith.schemas.AttachmentsOperationsOperations to perform on attachments.
class
python.langsmith.schemas.BaseMessageLikeA protocol representing objects similar to BaseMessage.
method
python.langsmith.schemas.BaseMessageLike.type() -> strType of the Message, used for serialization.
class
python.langsmith.schemas.BatchIngestConfigConfiguration for batch ingestion.
class
python.langsmith.schemas.BinaryIOLikeProtocol for binary IO-like objects.
method
python.langsmith.schemas.BinaryIOLike.getvalue() -> bytesGet value function.
method
python.langsmith.schemas.BinaryIOLike.read(size:int=-1) -> bytesRead function.
method
python.langsmith.schemas.BinaryIOLike.seek(offset:int, whence:int=0) -> intSeek function.
class
python.langsmith.schemas.ComparativeExperimentRepresents a comparative experiment.
method
python.langsmith.schemas.ComparativeExperiment.metadata() -> dict[str, Any]Retrieve the metadata (if any).
class
python.langsmith.schemas.DataTypeEnum for dataset data types.
class
python.langsmith.schemas.DatasetDataset ORM model.
method
python.langsmith.schemas.Dataset.url() -> Optional[str]URL of this run within the app.
class
python.langsmith.schemas.DatasetBaseDataset base model.
class
python.langsmith.schemas.DatasetShareSchemaRepresents the schema for a dataset share.
class
python.langsmith.schemas.DatasetTransformationSchema for dataset transformations.
class
python.langsmith.schemas.DatasetVersionClass representing a dataset version.
class
python.langsmith.schemas.DirectoryCommitInfoCommit details returned from a directory commit.
class
python.langsmith.schemas.DirectoryCommitResponseResponse body for ``POST /directories/commits``.
class
python.langsmith.schemas.ExampleExample model.
method
python.langsmith.schemas.Example.url() -> Optional[str]URL of this run within the app.
class
python.langsmith.schemas.ExampleBaseExample base model.
class
python.langsmith.schemas.ExampleCreateExample upload with attachments.
class
python.langsmith.schemas.ExampleUpdateExample update with attachments.
class
python.langsmith.schemas.ExampleUpsertWithAttachmentsExample create with attachments.
class
python.langsmith.schemas.ExampleWithRunsExample with runs.
class
python.langsmith.schemas.ExperimentRunStatsRun statistics for an experiment.
class
python.langsmith.schemas.ExtractedUsageMetadataUsage metadata dictionary extracted from a run.
class
python.langsmith.schemas.FeedbackSchema for getting feedback.
class
python.langsmith.schemas.FeedbackBaseFeedback schema.
class
python.langsmith.schemas.FeedbackCategorySpecific value and label pair for feedback.
class
python.langsmith.schemas.FeedbackCreateSchema used for creating feedback.
class
python.langsmith.schemas.FeedbackFormulaSchema for getting feedback formulas.
class
python.langsmith.schemas.FeedbackFormulaCreateSchema used for creating a feedback formula.
class
python.langsmith.schemas.FeedbackFormulaUpdateSchema used for updating a feedback formula.
class
python.langsmith.schemas.FeedbackIngestTokenRepresents the schema for a feedback ingest token.
class
python.langsmith.schemas.FeedbackSourceBaseBase class for feedback sources.
class
python.langsmith.schemas.FeedbackSourceTypeFeedback source type.
class
python.langsmith.schemas.FileEntryA file with inline content.
class
python.langsmith.schemas.InputCostDetailsBreakdown of input token costs.
class
python.langsmith.schemas.InputTokenDetailsBreakdown of input token counts.
class
python.langsmith.schemas.InsightsClusterA single cluster of runs in an insights report.
class
python.langsmith.schemas.InsightsHighlightedTraceA trace highlighted in an insights report summary.
class
python.langsmith.schemas.LangSmithInfoInformation about the LangSmith server.
class
python.langsmith.schemas.LangSmithSettingsSettings for the LangSmith tenant.
class
python.langsmith.schemas.ListPromptsResponseA list of prompts with metadata.
class
python.langsmith.schemas.ModelFeedbackSourceModel feedback source.
class
python.langsmith.schemas.OutputCostDetailsBreakdown of output token costs.
class
python.langsmith.schemas.OutputTokenDetailsBreakdown of output token counts.
class
python.langsmith.schemas.PromptRepresents a Prompt with metadata.
class
python.langsmith.schemas.PromptCommitRepresents a Prompt with a manifest.
class
python.langsmith.schemas.PromptSortFieldEnum for sorting fields for prompts.
class
python.langsmith.schemas.RunRun schema when loading from the DB.
method
python.langsmith.schemas.Run.input_cost() -> Decimal | NoneAlias for prompt_cost.
method
python.langsmith.schemas.Run.input_cost_details() -> dict[str, Decimal] | NoneAlias for prompt_cost_details.
method
python.langsmith.schemas.Run.input_token_details() -> dict[str, int] | NoneAlias for prompt_token_details.
method
python.langsmith.schemas.Run.input_tokens() -> int | NoneAlias for prompt_tokens.
method
python.langsmith.schemas.Run.output_cost() -> Decimal | NoneAlias for completion_cost.
method
python.langsmith.schemas.Run.output_cost_details() -> dict[str, Decimal] | NoneAlias for completion_cost_details.
method
python.langsmith.schemas.Run.output_token_details() -> dict[str, int] | NoneAlias for output_token_details.
method
python.langsmith.schemas.Run.output_tokens() -> int | NoneAlias for completion_tokens.
method
python.langsmith.schemas.Run.url() -> Optional[str]URL of this run within the app.
class
python.langsmith.schemas.RunBaseBase Run schema.
method
python.langsmith.schemas.RunBase.latency() -> Optional[float]Latency in seconds.
method
python.langsmith.schemas.RunBase.metadata() -> dict[str, Any]Retrieve the metadata (if any).
method
python.langsmith.schemas.RunBase.revision_id() -> Optional[UUID]Retrieve the revision ID (if any).
class
python.langsmith.schemas.RunEventRun event schema.
class
python.langsmith.schemas.RunLikeDictRun-like dictionary, for type-hinting.
class
python.langsmith.schemas.RunTypeEnum(Deprecated) Enum for run types.
class
python.langsmith.schemas.RunWithAnnotationQueueInfoRun schema with annotation queue info.
class
python.langsmith.schemas.SkillContextA skill pulled from hub.
class
python.langsmith.schemas.SkillEntryA link to a skill repo.
class
python.langsmith.schemas.TimeDeltaInputTimedelta input schema.
class
python.langsmith.schemas.TracerSessionTracerSession schema for the API.
method
python.langsmith.schemas.TracerSession.metadata() -> dict[str, Any]Retrieve the metadata (if any).
method
python.langsmith.schemas.TracerSession.tags() -> list[str]Retrieve the tags (if any).
method
python.langsmith.schemas.TracerSession.url() -> Optional[str]URL of this run within the app.
class
python.langsmith.schemas.TracerSessionResultA project, hydrated with additional information.
class
python.langsmith.schemas.UsageMetadataUsage metadata for a message, such as token counts.
class
python.langsmith.utils.FilterLangSmithRetryFilter for retries from this lib.
method
python.langsmith.utils.FilterLangSmithRetry.filter(record) -> boolFilter retries from this library.
class
python.langsmith.utils.LangSmithAuthErrorCouldn't authenticate with the LangSmith API.
class
python.langsmith.utils.LangSmithConflictErrorThe resource already exists.
class
python.langsmith.utils.LangSmithConnectionErrorCouldn't connect to the LangSmith API.
class
python.langsmith.utils.LangSmithErrorAn error occurred while communicating with the LangSmith API.
class
python.langsmith.utils.LangSmithExceptionGroupPort of ExceptionGroup for Py < 3.11.
class
python.langsmith.utils.LangSmithMissingAPIKeyWarningWarning for missing API key.
class
python.langsmith.utils.LangSmithNotFoundErrorCouldn't find the requested resource.
class
python.langsmith.utils.LangSmithRequestTimeoutClient took too long to send request body.
class
python.langsmith.utils.LangSmithRetryWrapper to filter logs with this name.
class
python.langsmith.utils.LangSmithWarningBase class for warnings.
func
python.langsmith.utils.convert_langchain_message(message:ls_schemas.BaseMessageLike) -> dictConvert a LangChain message to an example.
func
python.langsmith.utils.deepish_copy(val:T) -> TDeep copy a value with a compromise for uncopyable objects.
func
python.langsmith.utils.filter_logs(logger:logging.Logger, filters:Sequence[logging.Filter]) -> Generator[None, None, None]Temporarily adds specified filters to a logger.
func
python.langsmith.utils.get_api_key(api_key:Optional[str]) -> Optional[str]Get the API key from the environment or the given value.
func
python.langsmith.utils.get_cache_dir(cache:Optional[str]) -> Optional[str]Get the testing cache directory.
func
python.langsmith.utils.get_enum_value(enu:Union[enum.Enum, str]) -> strGet the value of a string enum.
func
python.langsmith.utils.get_invalid_prompt_identifier_msg(identifier:str) -> strGet the error message for an invalid prompt identifier.
func
python.langsmith.utils.get_llm_generation_from_outputs(outputs:Mapping[str, Any]) -> strGet the LLM generation from the outputs.
func
python.langsmith.utils.get_messages_from_inputs(inputs:Mapping[str, Any]) -> list[dict[str, Any]]Extract messages from the given inputs dictionary.
func
python.langsmith.utils.get_prompt_from_inputs(inputs:Mapping[str, Any]) -> strRetrieve the prompt from the given inputs.
func
python.langsmith.utils.get_tracer_project(return_default_value=True) -> Optional[str]Get the project name for a LangSmith tracer.
func
python.langsmith.utils.get_workspace_id(workspace_id:Optional[str]) -> Optional[str]Get workspace ID.
func
python.langsmith.utils.is_base_message_like(obj:object) -> boolCheck if the given object is similar to `BaseMessage`.
func
python.langsmith.utils.is_env_var_truish(value:Optional[str]) -> boolCheck if the given environment variable is truish.
func
python.langsmith.utils.is_truish(val:Any) -> boolCheck if the value is truish.
func
python.langsmith.utils.log_once(level:int, message:str) -> NoneLog a message at the specified level, but only once.
func
python.langsmith.utils.raise_for_status_with_text(response:Union[requests.Response, httpx.Response]) -> NoneRaise an error with the response text.
func
python.langsmith.utils.tracing_is_enabled(ctx:Optional[dict]=None) -> Union[bool, Literal['local']]Return True if tracing is enabled.
func
python.langsmith.utils.with_cache(path:Union[str, pathlib.Path], ignore_hosts:Optional[Sequence[str]]=None, allow_hosts:Optional[Sequence[str]]=None) -> Generator[None, None, None]Use a cache for requests.
func
python.langsmith.utils.with_optional_cache(path:Optional[Union[str, pathlib.Path]], ignore_hosts:Optional[Sequence[str]]=None, allow_hosts:Optional[Sequence[str]]=None) -> Generator[None, None, None]Use a cache for requests.
func
python.langsmith.utils.wrapper(*args:Any, **kwargs:Any) -> AnyValidate exactly one arg in each group is not None.
func
python.langsmith.utils.xor_args(*arg_groups:tuple[str, ...]) -> CallableValidate specified keyword args are mutually exclusive.
func
python.langsmith.uuid.uuid7() -> _uuid.UUIDGenerate a random UUID v7.
func
python.langsmith.uuid.uuid7_from_datetime(dt:_dt.datetime) -> _uuid.UUIDGenerate a UUID v7 from a datetime.
About this data
These signatures were extracted from the public source of langchain-ai/langsmith-sdk
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.