Async Client for interacting with the LangSmith API.
AsyncClient(
self,
api_url: Optional[str] = None,
api_key: Optional[str] = None,
timeout_ms: Optional[Union[int, tuple[Optional[int], Optional[int], Optional[int], Optional[int]]]] = None,
retry_config: Optional[Mapping[str, Any]] = None,
web_url: Optional[str] = None,
disable_prompt_cache: bool = False,
cache: Optional[Union[bool, AsyncPromptCache]] = None
)| Name | Type | Description |
|---|---|---|
api_url | Optional[str] | Default: NoneURL for the LangSmith API. |
api_key | Optional[str] | Default: NoneAPI key for the LangSmith API. |
timeout_ms | Optional[Union[int, tuple[Optional[int], Optional[int], Optional[int], Optional[int]]]] | Default: NoneTimeout for requests in milliseconds. |
retry_config | Optional[Mapping[str, Any]] | Default: NoneRetry configuration. |
web_url | Optional[str] | Default: NoneURL for the LangSmith web app. |
disable_prompt_cache | bool | Default: FalseDisable prompt caching for this client. |
cache | Optional[Union[bool, AsyncPromptCache]] | Default: None[Deprecated] Control prompt caching behavior. This parameter is deprecated. Use
|
Close the async client.
Create a run.
Update a run.
Read a run.
List runs from the LangSmith API.
Get a share link for a run asynchronously.
Get share state for a run asynchronously.
Retrieve the shared link for a specific run asynchronously.
Create a project.
Read a project.
Delete a project from LangSmith.
Create a dataset.
Read a dataset.
Delete a dataset.
List datasets.
Create an example.
Read an example.
List examples.
Create feedback for a run.
Create feedback from a presigned token or URL.
Create a pre-signed URL to send feedback data to.
This is useful for giving browser-based clients a way to upload feedback data directly to LangSmith without accessing the API key.
Read feedback.
List feedback.
Delete a feedback by ID.
List the annotation queues on the LangSmith API.
Create an annotation queue on the LangSmith API.
Read an annotation queue with the specified queue_id.
Update an annotation queue with the specified queue_id.
Delete an annotation queue with the specified queue_id.
Add runs to an annotation queue with the specified queue_id.
Delete a run from an annotation queue with the specified queue_id and run_id.
Get a run from an annotation queue at the specified index.
Create a feedback configuration.
Defines how feedback with a given key should be interpreted. If an identical configuration already exists for the key, it is returned unchanged. If a different configuration already exists for the key, an error is raised.
List feedback configurations.
Update a feedback configuration.
Only the provided fields will be updated; others remain unchanged.
Delete a feedback configuration.
This performs a soft delete. The configuration can be recreated later with the same key.
Enable dataset indexing. Examples are indexed by their inputs.
This enables searching for similar examples by inputs with
client.similar_examples().
Sync dataset index.
This already happens automatically every 5 minutes, but you can call this to force a sync.
Retrieve the dataset examples whose inputs best match the current inputs.
Must have few-shot indexing enabled for the dataset. See client.index_dataset().
Like a prompt.
Unlike a prompt.
List prompts with pagination.
Get a specific prompt by its identifier.
Create a new prompt.
Does not attach prompt object, just creates an empty prompt.
Create a commit for an existing prompt.
Update a prompt's metadata.
To update the content of a prompt, use push_prompt or create_commit instead.
Delete a prompt.
Pull a prompt object from the LangSmith API.
List commits for a given prompt.
Pull a prompt and return it as a LangChain PromptTemplate.
This method requires langchain-core.
Push a prompt to the LangSmith API.
Can be used to update prompt metadata or prompt content.
If the prompt does not exist, it will be created.
If the prompt exists, it will be updated.