docs: style linting (#6260)

also fixes some links

---------

Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
Co-authored-by: ccurme <chester.curme@gmail.com>
Co-authored-by: Sydney Runkle <sydneymarierunkle@gmail.com>
Co-authored-by: William FH <13333726+hinthornw@users.noreply.github.com>
This commit is contained in:
Mason Daugherty
2025-10-16 11:25:50 +00:00
committed by GitHub
co-authored by Sydney Runkle ccurme Sydney Runkle William FH
parent cedecd8ed6
commit d9e3d83894
33 changed files with 285 additions and 269 deletions
+10 -4
View File
@@ -29,7 +29,11 @@ logger = logging.getLogger(__name__)
def _transform_link(
link_name: str, scope: str, file_path: str, line_number: int, custom_title: Optional[str] = None
link_name: str,
scope: str,
file_path: str,
line_number: int,
custom_title: Optional[str] = None,
) -> Optional[str]:
"""Transform a cross-reference link based on the current scope.
@@ -38,7 +42,7 @@ def _transform_link(
scope: The current scope context ("global", "python", "js", etc.).
file_path: The file path for error reporting.
line_number: The line number for error reporting.
custom_title: Optional custom title for the link. If None, uses link_name.
custom_title: Optional custom title for the link. If `None`, uses link_name.
Returns:
A formatted markdown link if the link is found in the scope mapping,
@@ -117,7 +121,9 @@ CROSS_REFERENCE_PATTERN = re.compile(
)
def _replace_autolinks(markdown: str, file_path: str, *, default_scope: str = "python") -> str:
def _replace_autolinks(
markdown: str, file_path: str, *, default_scope: str = "python"
) -> str:
"""Preprocess markdown lines to handle @[links] with conditional fence scopes.
This function processes markdown content to transform @[link_name] references
@@ -169,7 +175,7 @@ def _replace_autolinks(markdown: str, file_path: str, *, default_scope: str = "p
# This is @[ref] format
link_name = match.group("link_name")
custom_title = None
transformed = _transform_link(
link_name, current_scope, file_path, line_number, custom_title
)
@@ -20,16 +20,19 @@ class Package(TypedDict):
description: str
"""A brief description of what the package does."""
class ResolvedPackage(Package):
weekly_downloads: int | None
"""The weekly download count of the package."""
language: str
"""The language of the package. (either 'python' or 'js')"""
HERE = pathlib.Path(__file__).parent
PACKAGES_FILE = HERE / "packages.yml"
PACKAGES = yaml.safe_load(PACKAGES_FILE.read_text())["packages"]
def _get_pypi_downloads(package: Package) -> int:
"""Retrieve the weekly download count for a package from PyPIStats."""
@@ -72,7 +75,8 @@ def _get_pypi_downloads(package: Package) -> int:
return sum(entry["downloads"] for entry in sorted_data[:7])
else:
return None
def _get_npm_downloads(package: Package) -> int:
"""Retrieve the weekly download count for a package on the npm registry."""
@@ -82,14 +86,18 @@ def _get_npm_downloads(package: Package) -> int:
npm_response = requests.get(npm_url)
npm_response.raise_for_status()
except requests.exceptions.HTTPError:
raise AssertionError(f"Package {package['name']} does not exist on npm registry")
raise AssertionError(
f"Package {package['name']} does not exist on npm registry"
)
npm_data = npm_response.json()
# Retrieve the first publish date using the 'created' timestamp from the 'time' field.
created_str = npm_data.get("time", {}).get("created")
if created_str is None:
raise AssertionError(f"Package {package['name']} has no creation time in registry data")
raise AssertionError(
f"Package {package['name']} has no creation time in registry data"
)
# Remove the trailing 'Z' if present and parse the ISO format timestamp
first_publish_date = datetime.fromisoformat(created_str.rstrip("Z"))
@@ -103,7 +111,10 @@ def _get_npm_downloads(package: Package) -> int:
else:
return None
def _get_weekly_downloads(packages: dict[str, list[Package]], fake: bool) -> list[ResolvedPackage]:
def _get_weekly_downloads(
packages: dict[str, list[Package]], fake: bool
) -> list[ResolvedPackage]:
"""Retrieve the weekly download count for a dictionary of python or js packages."""
resolved_packages: list[ResolvedPackage] = []
@@ -131,7 +142,7 @@ def _get_weekly_downloads(packages: dict[str, list[Package]], fake: bool) -> lis
num_downloads = _get_npm_downloads(package)
else:
num_downloads = None
resolved_packages.append(
{
"name": package["name"],
@@ -145,12 +156,13 @@ def _get_weekly_downloads(packages: dict[str, list[Package]], fake: bool) -> lis
return resolved_packages
def main(output_file: str, fake: bool) -> None:
"""Main function to generate package download information.
Args:
output_file: Path to the output YAML file.
fake: If True, use fake download counts for testing purposes.
fake: If `True`, use fake download counts for testing purposes.
"""
resolved_packages: list[ResolvedPackage] = _get_weekly_downloads(PACKAGES, fake)
+1 -1
View File
@@ -2,4 +2,4 @@
::: langgraph.cache.base
::: langgraph.cache.memory
::: langgraph.cache.sqlite
::: langgraph.cache.sqlite
@@ -115,12 +115,12 @@ class PostgresSaver(BasePostgresSaver):
Args:
config: The config to use for listing the checkpoints.
filter: Additional filtering criteria for metadata. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: The maximum number of checkpoints to return. Defaults to None.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: The maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of checkpoint tuples.
An iterator of checkpoint tuples.
Examples:
>>> from langgraph.checkpoint.postgres import PostgresSaver
@@ -182,7 +182,7 @@ class PostgresSaver(BasePostgresSaver):
"""Get a checkpoint tuple from the database.
This method retrieves a checkpoint tuple from the Postgres database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and timestamp is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -190,7 +190,7 @@ class PostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
Examples:
@@ -121,11 +121,11 @@ class AsyncPostgresSaver(BasePostgresSaver):
Args:
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: Maximum number of checkpoints to return.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of matching checkpoint tuples.
An asynchronous iterator of matching checkpoint tuples.
"""
where, args = self._search_where(config, filter, before)
query = self.SELECT_SQL + where + " ORDER BY checkpoint_id DESC"
@@ -169,7 +169,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Get a checkpoint tuple from the database asynchronously.
This method retrieves a checkpoint tuple from the Postgres database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and "checkpoint_id" is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -177,7 +177,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
thread_id = config["configurable"]["thread_id"]
checkpoint_id = get_checkpoint_id(config)
@@ -444,11 +444,11 @@ class AsyncPostgresSaver(BasePostgresSaver):
Args:
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
An iterator of matching checkpoint tuples.
"""
try:
# check if we are in the main thread, only bg threads can block
@@ -476,7 +476,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Get a checkpoint tuple from the database.
This method retrieves a checkpoint tuple from the Postgres database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and "checkpoint_id" is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -484,7 +484,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
try:
# check if we are in the main thread, only bg threads can block
@@ -309,7 +309,7 @@ class ShallowPostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
Examples:
@@ -672,7 +672,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
thread_id = config["configurable"]["thread_id"]
checkpoint_ns = config["configurable"].get("checkpoint_ns", "")
@@ -893,7 +893,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
try:
# check if we are in the main thread, only bg threads can block
@@ -339,7 +339,7 @@ class AsyncPostgresStore(AsyncBatchedBaseStore, BasePostgresStore[_ainternal.Con
Args:
timeout: Maximum time to wait for the task to stop, in seconds.
If None, wait indefinitely.
If `None`, wait indefinitely.
Returns:
bool: True if the task was successfully stopped or wasn't running,
@@ -868,7 +868,7 @@ class PostgresStore(BaseStore, BasePostgresStore[_pg_internal.Conn]):
Args:
timeout: Maximum time to wait for the thread to stop, in seconds.
If None, wait indefinitely.
If `None`, wait indefinitely.
Returns:
bool: True if the thread was successfully stopped or wasn't running,
@@ -184,7 +184,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
"""Get a checkpoint tuple from the database.
This method retrieves a checkpoint tuple from the SQLite database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and checkpoint ID is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -192,7 +192,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
Examples:
@@ -301,12 +301,12 @@ class SqliteSaver(BaseCheckpointSaver[str]):
Args:
config: The config to use for listing the checkpoints.
filter: Additional filtering criteria for metadata. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: The maximum number of checkpoints to return. Defaults to None.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: The maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of checkpoint tuples.
An iterator of checkpoint tuples.
Examples:
>>> from langgraph.checkpoint.sqlite import SqliteSaver
@@ -139,7 +139,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
"""Get a checkpoint tuple from the database.
This method retrieves a checkpoint tuple from the SQLite database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and checkpoint ID is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -147,7 +147,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
try:
# check if we are in the main thread, only bg threads can block
@@ -181,11 +181,11 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
Args:
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
An iterator of matching checkpoint tuples.
"""
try:
# check if we are in the main thread, only bg threads can block
@@ -316,7 +316,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
"""Get a checkpoint tuple from the database asynchronously.
This method retrieves a checkpoint tuple from the SQLite database based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and checkpoint ID is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -324,7 +324,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
await self.setup()
checkpoint_ns = config["configurable"].get("checkpoint_ns", "")
@@ -414,11 +414,11 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
Args:
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned.
limit: Maximum number of checkpoints to return.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of matching checkpoint tuples.
An asynchronous iterator of matching checkpoint tuples.
"""
await self.setup()
where, params = search_where(config, filter, before)
@@ -303,7 +303,7 @@ class AsyncSqliteStore(AsyncBatchedBaseStore, BaseSqliteStore):
Args:
timeout: Maximum time to wait for the task to stop, in seconds.
If None, wait indefinitely.
If `None`, wait indefinitely.
Returns:
bool: True if the task was successfully stopped or wasn't running,
@@ -1156,7 +1156,7 @@ class SqliteStore(BaseSqliteStore, BaseStore):
Args:
timeout: Maximum time to wait for the thread to stop, in seconds.
If None, wait indefinitely.
If `None`, wait indefinitely.
Returns:
bool: True if the thread was successfully stopped or wasn't running,
@@ -35,17 +35,17 @@ class CheckpointMetadata(TypedDict, total=False):
source: Literal["input", "loop", "update", "fork"]
"""The source of the checkpoint.
- "input": The checkpoint was created from an input to invoke/stream/batch.
- "loop": The checkpoint was created from inside the pregel loop.
- "update": The checkpoint was created from a manual state update.
- "fork": The checkpoint was created as a copy of another checkpoint.
- `"input"`: The checkpoint was created from an input to invoke/stream/batch.
- `"loop"`: The checkpoint was created from inside the pregel loop.
- `"update"`: The checkpoint was created from a manual state update.
- `"fork"`: The checkpoint was created as a copy of another checkpoint.
"""
step: int
"""The step number of the checkpoint.
-1 for the first "input" checkpoint.
0 for the first "loop" checkpoint.
... for the nth checkpoint afterwards.
`-1` for the first `"input"` checkpoint.
`0` for the first `"loop"` checkpoint.
`...` for the `nth` checkpoint afterwards.
"""
parents: dict[str, str]
"""The IDs of the parent checkpoints.
@@ -148,7 +148,7 @@ class BaseCheckpointSaver(Generic[V]):
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[Checkpoint]: The requested checkpoint, or None if not found.
The requested checkpoint, or `None` if not found.
"""
if value := self.get_tuple(config):
return value.checkpoint
@@ -160,7 +160,7 @@ class BaseCheckpointSaver(Generic[V]):
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[CheckpointTuple]: The requested checkpoint tuple, or None if not found.
The requested checkpoint tuple, or `None` if not found.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -184,7 +184,7 @@ class BaseCheckpointSaver(Generic[V]):
limit: Maximum number of checkpoints to return.
Returns:
Iterator[CheckpointTuple]: Iterator of matching checkpoint tuples.
Iterator of matching checkpoint tuples.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -252,7 +252,7 @@ class BaseCheckpointSaver(Generic[V]):
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[Checkpoint]: The requested checkpoint, or None if not found.
The requested checkpoint, or `None` if not found.
"""
if value := await self.aget_tuple(config):
return value.checkpoint
@@ -264,7 +264,7 @@ class BaseCheckpointSaver(Generic[V]):
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[CheckpointTuple]: The requested checkpoint tuple, or None if not found.
The requested checkpoint tuple, or `None` if not found.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -288,7 +288,7 @@ class BaseCheckpointSaver(Generic[V]):
limit: Maximum number of checkpoints to return.
Returns:
AsyncIterator[CheckpointTuple]: Async iterator of matching checkpoint tuples.
Async iterator of matching checkpoint tuples.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -133,7 +133,7 @@ class InMemorySaver(
"""Get a checkpoint tuple from the in-memory storage.
This method retrieves a checkpoint tuple from the in-memory storage based on the
provided config. If the config contains a "checkpoint_id" key, the checkpoint with
provided config. If the config contains a `checkpoint_id` key, the checkpoint with
the matching thread ID and timestamp is retrieved. Otherwise, the latest checkpoint
for the given thread ID is retrieved.
@@ -141,7 +141,7 @@ class InMemorySaver(
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
thread_id: str = config["configurable"]["thread_id"]
checkpoint_ns: str = config["configurable"].get("checkpoint_ns", "")
@@ -231,7 +231,7 @@ class InMemorySaver(
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
An iterator of matching checkpoint tuples.
"""
thread_ids = (config["configurable"]["thread_id"],) if config else self.storage
config_checkpoint_ns = (
@@ -423,16 +423,16 @@ class InMemorySaver(
del self.blobs[k]
async def aget_tuple(self, config: RunnableConfig) -> CheckpointTuple | None:
"""Asynchronous version of get_tuple.
"""Asynchronous version of `get_tuple`.
This method is an asynchronous wrapper around get_tuple that runs the synchronous
This method is an asynchronous wrapper around `get_tuple` that runs the synchronous
method in a separate thread using asyncio.
Args:
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
The retrieved checkpoint tuple, or None if no matching checkpoint was found.
"""
return self.get_tuple(config)
@@ -444,16 +444,16 @@ class InMemorySaver(
before: RunnableConfig | None = None,
limit: int | None = None,
) -> AsyncIterator[CheckpointTuple]:
"""Asynchronous version of list.
"""Asynchronous version of `list`.
This method is an asynchronous wrapper around list that runs the synchronous
This method is an asynchronous wrapper around `list` that runs the synchronous
method in a separate thread using asyncio.
Args:
config: The config to use for listing the checkpoints.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of checkpoint tuples.
An asynchronous iterator of checkpoint tuples.
"""
for item in self.list(config, filter=filter, before=before, limit=limit):
yield item
@@ -465,7 +465,7 @@ class InMemorySaver(
metadata: CheckpointMetadata,
new_versions: ChannelVersions,
) -> RunnableConfig:
"""Asynchronous version of put.
"""Asynchronous version of `put`.
Args:
config: The config to associate with the checkpoint.
@@ -485,9 +485,9 @@ class InMemorySaver(
task_id: str,
task_path: str = "",
) -> None:
"""Asynchronous version of put_writes.
"""Asynchronous version of `put_writes`.
This method is an asynchronous wrapper around put_writes that runs the synchronous
This method is an asynchronous wrapper around `put_writes` that runs the synchronous
method in a separate thread using asyncio.
Args:
@@ -57,7 +57,7 @@ class Item:
key: Unique identifier within the namespace.
namespace: Hierarchical path defining the collection in which this document resides.
Represented as a tuple of strings, allowing for nested categorization.
For example: ("documents", 'user123')
For example: `("documents", 'user123')`
created_at: Timestamp of item creation.
updated_at: Timestamp of last update.
"""
@@ -249,12 +249,12 @@ class SearchOp(NamedTuple):
The filter supports both exact matches and operator-based comparisons.
Supported Operators:
- $eq: Equal to (same as direct value comparison)
- $ne: Not equal to
- $gt: Greater than
- $gte: Greater than or equal to
- $lt: Less than
- $lte: Less than or equal to
- `$eq`: Equal to (same as direct value comparison)
- `$ne`: Not equal to
- `$gt`: Greater than
- `$gte`: Greater than or equal to
- `$lt`: Less than
- `$lte`: Less than or equal to
???+ example "Examples"
Simple exact match:
@@ -480,12 +480,12 @@ class PutOp(NamedTuple):
vector similarity search (if supported by the store implementation).
Path Syntax:
- Simple field access: "field"
- Nested fields: "parent.child.grandchild"
- Simple field access: `"field"`
- Nested fields: `"parent.child.grandchild"`
- Array indexing:
- Specific index: "array[0]"
- Last element: "array[-1]"
- All elements (each individually): "array[*]"
- Specific index: `"array[0]"`
- Last element: `"array[-1]"`
- All elements (each individually): `"array[*]"`
???+ example "Examples"
- None - Use store defaults (whole item)
@@ -509,7 +509,7 @@ class PutOp(NamedTuple):
will expire this many minutes after it was last accessed. The expiration timer
refreshes on both read operations (get/search) and write operations (put/update).
When the TTL expires, the item will be scheduled for deletion on a best-effort basis.
Defaults to None (no expiration).
Defaults to `None` (no expiration).
"""
@@ -525,18 +525,18 @@ class TTLConfig(TypedDict, total=False):
"""Configuration for TTL (time-to-live) behavior in the store."""
refresh_on_read: bool
"""Default behavior for refreshing TTLs on read operations (GET and SEARCH).
"""Default behavior for refreshing TTLs on read operations (`GET` and `SEARCH`).
If True, TTLs will be refreshed on read operations (get/search) by default.
This can be overridden per-operation by explicitly setting refresh_ttl.
Defaults to True if not configured.
If `True`, TTLs will be refreshed on read operations (get/search) by default.
This can be overridden per-operation by explicitly setting `refresh_ttl`.
Defaults to `True` if not configured.
"""
default_ttl: float | None
"""Default TTL (time-to-live) in minutes for new items.
If provided, new items will expire after this many minutes after their last access.
The expiration timer refreshes on both read and write operations.
Defaults to None (no expiration).
Defaults to `None` (no expiration).
"""
sweep_interval_minutes: int | None
"""Interval in minutes between TTL sweep operations.
@@ -550,20 +550,20 @@ class IndexConfig(TypedDict, total=False):
"""Configuration for indexing documents for semantic search in the store.
If not provided to the store, the store will not support vector search.
In that case, all `index` arguments to put() and `aput()` operations will be ignored.
In that case, all `index` arguments to `put()` and `aput()` operations will be ignored.
"""
dims: int
"""Number of dimensions in the embedding vectors.
Common embedding models have the following dimensions:
- openai:text-embedding-3-large: 3072
- openai:text-embedding-3-small: 1536
- openai:text-embedding-ada-002: 1536
- cohere:embed-english-v3.0: 1024
- cohere:embed-english-light-v3.0: 384
- cohere:embed-multilingual-v3.0: 1024
- cohere:embed-multilingual-light-v3.0: 384
- `openai:text-embedding-3-large`: `3072`
- `openai:text-embedding-3-small`: `1536`
- `openai:text-embedding-ada-002`: `1536`
- `cohere:embed-english-v3.0`: `1024`
- `cohere:embed-english-light-v3.0`: `384`
- `cohere:embed-multilingual-v3.0`: `1024`
- `cohere:embed-multilingual-light-v3.0`: `384`
"""
embed: Embeddings | EmbeddingsFunc | AEmbeddingsFunc | str
@@ -571,12 +571,12 @@ class IndexConfig(TypedDict, total=False):
Can be specified in three ways:
1. A LangChain Embeddings instance
2. A synchronous embedding function (EmbeddingsFunc)
3. An asynchronous embedding function (AEmbeddingsFunc)
4. A provider string (e.g., "openai:text-embedding-3-small")
2. A synchronous embedding function (`EmbeddingsFunc`)
3. An asynchronous embedding function (`AEmbeddingsFunc`)
4. A provider string (e.g., `"openai:text-embedding-3-small"`)
???+ example "Examples"
Using LangChain's initialization with InMemoryStore:
Using LangChain's initialization with `InMemoryStore`:
```python
from langchain.embeddings import init_embeddings
from langgraph.store.memory import InMemoryStore
@@ -589,7 +589,7 @@ class IndexConfig(TypedDict, total=False):
)
```
Using a custom embedding function with InMemoryStore:
Using a custom embedding function with `InMemoryStore`:
```python
from openai import OpenAI
from langgraph.store.memory import InMemoryStore
@@ -611,7 +611,7 @@ class IndexConfig(TypedDict, total=False):
)
```
Using an asynchronous embedding function with InMemoryStore:
Using an asynchronous embedding function with `InMemoryStore`:
```python
from openai import AsyncOpenAI
from langgraph.store.memory import InMemoryStore
@@ -639,10 +639,10 @@ class IndexConfig(TypedDict, total=False):
Controls which parts of stored items are embedded for semantic search. Follows JSON path syntax:
- ["$"]: Embeds the entire JSON object as one vector (default)
- ["field1", "field2"]: Embeds specific top-level fields
- ["parent.child"]: Embeds nested fields using dot notation
- ["array[*].field"]: Embeds field from each array element separately
- `["$"]`: Embeds the entire JSON object as one vector (default)
- `["field1", "field2"]`: Embeds specific top-level fields
- `["parent.child"]`: Embeds nested fields using dot notation
- `["array[*].field"]`: Embeds field from each array element separately
Note:
You can always override this behavior when storing an item using the
@@ -667,7 +667,7 @@ class IndexConfig(TypedDict, total=False):
Note:
- Fields missing from a document are skipped
- Array notation creates separate embeddings for each element
- Complex nested paths are supported (e.g., "a.b[*].c.d")
- Complex nested paths are supported (e.g., `"a.b[*].c.d"`)
"""
@@ -732,11 +732,11 @@ class BaseStore(ABC):
namespace: Hierarchical path for the item.
key: Unique identifier within the namespace.
refresh_ttl: Whether to refresh TTLs for the returned item.
If None (default), uses the store's default refresh_ttl setting.
If `None`, uses the store's default refresh_ttl setting.
If no TTL is specified, this argument is ignored.
Returns:
The retrieved item or None if not found.
The retrieved item or `None` if not found.
"""
return self.batch(
[GetOp(namespace, str(key), _ensure_refresh(self.ttl_config, refresh_ttl))]
@@ -966,7 +966,7 @@ class BaseStore(ABC):
key: Unique identifier within the namespace.
Returns:
The retrieved item or None if not found.
The retrieved item or `None` if not found.
"""
return (
await self.abatch(
@@ -1000,7 +1000,7 @@ class BaseStore(ABC):
limit: Maximum number of items to return.
offset: Number of items to skip before returning results.
refresh_ttl: Whether to refresh TTLs for the returned items.
If None (default), uses the store's TTLConfig.refresh_default setting.
If `None`, uses the store's TTLConfig.refresh_default setting.
If TTLConfig is not provided or no TTL is specified, this argument is ignored.
Returns:
+12 -12
View File
@@ -25,11 +25,11 @@ class TTLConfig(TypedDict, total=False):
"""Configuration for TTL (time-to-live) behavior in the store."""
refresh_on_read: bool
"""Default behavior for refreshing TTLs on read operations (GET and SEARCH).
"""Default behavior for refreshing TTLs on read operations (`GET` and `SEARCH`).
If True, TTLs will be refreshed on read operations (get/search) by default.
This can be overridden per-operation by explicitly setting refresh_ttl.
Defaults to True if not configured.
If `True`, TTLs will be refreshed on read operations (get/search) by default.
This can be overridden per-operation by explicitly setting `refresh_ttl`.
Defaults to `True` if not configured.
"""
default_ttl: Optional[float]
"""Optional. Default TTL (time-to-live) in minutes for new items.
@@ -215,7 +215,7 @@ class AuthConfig(TypedDict, total=False):
"""Optional. Whether to disable LangSmith API-key authentication for requests originating the Studio.
Defaults to False, meaning that if a particular header is set, the server will verify the `x-api-key` header
value is a valid API key for the deployment's workspace. If True, all requests will go through your custom
value is a valid API key for the deployment's workspace. If `True`, all requests will go through your custom
authentication logic, regardless of origin of the request.
"""
openapi: SecurityConfig
@@ -262,7 +262,7 @@ class CorsConfig(TypedDict, total=False):
allow_headers: list[str]
"""Optional. HTTP headers that can be used in cross-origin requests (e.g. ["Content-Type", "Authorization"])."""
allow_credentials: bool
"""Optional. If True, cross-origin requests can include credentials (cookies, auth headers).
"""Optional. If `True`, cross-origin requests can include credentials (cookies, auth headers).
Default False to avoid accidentally exposing secured endpoints to untrusted sites.
"""
@@ -317,27 +317,27 @@ class HttpConfig(TypedDict, total=False):
If provided, it can override or extend the default routes.
"""
disable_assistants: bool
"""Optional. If True, /assistants routes are removed from the server.
"""Optional. If `True`, /assistants routes are removed from the server.
Default is False (meaning /assistants is enabled).
"""
disable_threads: bool
"""Optional. If True, /threads routes are removed.
"""Optional. If `True`, /threads routes are removed.
Default is False.
"""
disable_runs: bool
"""Optional. If True, /runs routes are removed.
"""Optional. If `True`, /runs routes are removed.
Default is False.
"""
disable_store: bool
"""Optional. If True, /store routes are removed, disabling direct store interactions via HTTP.
"""Optional. If `True`, /store routes are removed, disabling direct store interactions via HTTP.
Default is False.
"""
disable_mcp: bool
"""Optional. If True, /mcp routes are removed, disabling the MCP server.
"""Optional. If `True`, /mcp routes are removed, disabling the MCP server.
Default is False.
"""
@@ -372,7 +372,7 @@ class HttpConfig(TypedDict, total=False):
Default is `middleware_first`.
"""
enable_custom_route_auth: bool
"""Optional. If True, authentication is enabled for custom routes,
"""Optional. If `True`, authentication is enabled for custom routes,
not just the routes that are protected by default.
(Routes protected by default include /assistants, /threads, and /runs).
+9 -9
View File
@@ -407,7 +407,7 @@
"properties": {
"disable_studio_auth": {
"type": "boolean",
"description": "Optional. Whether to disable LangSmith API-key authentication for requests originating the Studio.\n\nDefaults to False, meaning that if a particular header is set, the server will verify the `x-api-key` header\nvalue is a valid API key for the deployment's workspace. If True, all requests will go through your custom\nauthentication logic, regardless of origin of the request.\n"
"description": "Optional. Whether to disable LangSmith API-key authentication for requests originating the Studio.\n\nDefaults to False, meaning that if a particular header is set, the server will verify the `x-api-key` header\nvalue is a valid API key for the deployment's workspace. If `True`, all requests will go through your custom\nauthentication logic, regardless of origin of the request.\n"
},
"openapi": {
"$ref": "#/$defs/SecurityConfig",
@@ -555,11 +555,11 @@
},
"disable_assistants": {
"type": "boolean",
"description": "Optional. If True, /assistants routes are removed from the server.\n\nDefault is False (meaning /assistants is enabled).\n"
"description": "Optional. If `True`, /assistants routes are removed from the server.\n\nDefault is False (meaning /assistants is enabled).\n"
},
"disable_mcp": {
"type": "boolean",
"description": "Optional. If True, /mcp routes are removed, disabling the MCP server.\n\nDefault is False.\n"
"description": "Optional. If `True`, /mcp routes are removed, disabling the MCP server.\n\nDefault is False.\n"
},
"disable_meta": {
"type": "boolean",
@@ -567,19 +567,19 @@
},
"disable_runs": {
"type": "boolean",
"description": "Optional. If True, /runs routes are removed.\n\nDefault is False.\n"
"description": "Optional. If `True`, /runs routes are removed.\n\nDefault is False.\n"
},
"disable_store": {
"type": "boolean",
"description": "Optional. If True, /store routes are removed, disabling direct store interactions via HTTP.\n\nDefault is False.\n"
"description": "Optional. If `True`, /store routes are removed, disabling direct store interactions via HTTP.\n\nDefault is False.\n"
},
"disable_threads": {
"type": "boolean",
"description": "Optional. If True, /threads routes are removed.\n\nDefault is False.\n"
"description": "Optional. If `True`, /threads routes are removed.\n\nDefault is False.\n"
},
"enable_custom_route_auth": {
"type": "boolean",
"description": "Optional. If True, authentication is enabled for custom routes,\nnot just the routes that are protected by default.\n(Routes protected by default include /assistants, /threads, and /runs).\n\nDefault is False. This flag only affects authentication behavior\nif `app` is provided and contains custom routes.\n"
"description": "Optional. If `True`, authentication is enabled for custom routes,\nnot just the routes that are protected by default.\n(Routes protected by default include /assistants, /threads, and /runs).\n\nDefault is False. This flag only affects authentication behavior\nif `app` is provided and contains custom routes.\n"
},
"logging_headers": {
"anyOf": [
@@ -655,7 +655,7 @@
"properties": {
"allow_credentials": {
"type": "boolean",
"description": "Optional. If True, cross-origin requests can include credentials (cookies, auth headers).\n\nDefault False to avoid accidentally exposing secured endpoints to untrusted sites.\n"
"description": "Optional. If `True`, cross-origin requests can include credentials (cookies, auth headers).\n\nDefault False to avoid accidentally exposing secured endpoints to untrusted sites.\n"
},
"allow_headers": {
"type": "array",
@@ -774,7 +774,7 @@
},
"refresh_on_read": {
"type": "boolean",
"description": "Default behavior for refreshing TTLs on read operations (GET and SEARCH).\n\nIf True, TTLs will be refreshed on read operations (get/search) by default.\nThis can be overridden per-operation by explicitly setting refresh_ttl.\nDefaults to True if not configured.\n"
"description": "Default behavior for refreshing TTLs on read operations (`GET` and `SEARCH`).\n\nIf `True`, TTLs will be refreshed on read operations (get/search) by default.\nThis can be overridden per-operation by explicitly setting `refresh_ttl`.\nDefaults to `True` if not configured.\n"
},
"sweep_interval_minutes": {
"anyOf": [
+9 -9
View File
@@ -407,7 +407,7 @@
"properties": {
"disable_studio_auth": {
"type": "boolean",
"description": "Optional. Whether to disable LangSmith API-key authentication for requests originating the Studio.\n\nDefaults to False, meaning that if a particular header is set, the server will verify the `x-api-key` header\nvalue is a valid API key for the deployment's workspace. If True, all requests will go through your custom\nauthentication logic, regardless of origin of the request.\n"
"description": "Optional. Whether to disable LangSmith API-key authentication for requests originating the Studio.\n\nDefaults to False, meaning that if a particular header is set, the server will verify the `x-api-key` header\nvalue is a valid API key for the deployment's workspace. If `True`, all requests will go through your custom\nauthentication logic, regardless of origin of the request.\n"
},
"openapi": {
"$ref": "#/$defs/SecurityConfig",
@@ -555,11 +555,11 @@
},
"disable_assistants": {
"type": "boolean",
"description": "Optional. If True, /assistants routes are removed from the server.\n\nDefault is False (meaning /assistants is enabled).\n"
"description": "Optional. If `True`, /assistants routes are removed from the server.\n\nDefault is False (meaning /assistants is enabled).\n"
},
"disable_mcp": {
"type": "boolean",
"description": "Optional. If True, /mcp routes are removed, disabling the MCP server.\n\nDefault is False.\n"
"description": "Optional. If `True`, /mcp routes are removed, disabling the MCP server.\n\nDefault is False.\n"
},
"disable_meta": {
"type": "boolean",
@@ -567,19 +567,19 @@
},
"disable_runs": {
"type": "boolean",
"description": "Optional. If True, /runs routes are removed.\n\nDefault is False.\n"
"description": "Optional. If `True`, /runs routes are removed.\n\nDefault is False.\n"
},
"disable_store": {
"type": "boolean",
"description": "Optional. If True, /store routes are removed, disabling direct store interactions via HTTP.\n\nDefault is False.\n"
"description": "Optional. If `True`, /store routes are removed, disabling direct store interactions via HTTP.\n\nDefault is False.\n"
},
"disable_threads": {
"type": "boolean",
"description": "Optional. If True, /threads routes are removed.\n\nDefault is False.\n"
"description": "Optional. If `True`, /threads routes are removed.\n\nDefault is False.\n"
},
"enable_custom_route_auth": {
"type": "boolean",
"description": "Optional. If True, authentication is enabled for custom routes,\nnot just the routes that are protected by default.\n(Routes protected by default include /assistants, /threads, and /runs).\n\nDefault is False. This flag only affects authentication behavior\nif `app` is provided and contains custom routes.\n"
"description": "Optional. If `True`, authentication is enabled for custom routes,\nnot just the routes that are protected by default.\n(Routes protected by default include /assistants, /threads, and /runs).\n\nDefault is False. This flag only affects authentication behavior\nif `app` is provided and contains custom routes.\n"
},
"logging_headers": {
"anyOf": [
@@ -655,7 +655,7 @@
"properties": {
"allow_credentials": {
"type": "boolean",
"description": "Optional. If True, cross-origin requests can include credentials (cookies, auth headers).\n\nDefault False to avoid accidentally exposing secured endpoints to untrusted sites.\n"
"description": "Optional. If `True`, cross-origin requests can include credentials (cookies, auth headers).\n\nDefault False to avoid accidentally exposing secured endpoints to untrusted sites.\n"
},
"allow_headers": {
"type": "array",
@@ -774,7 +774,7 @@
},
"refresh_on_read": {
"type": "boolean",
"description": "Default behavior for refreshing TTLs on read operations (GET and SEARCH).\n\nIf True, TTLs will be refreshed on read operations (get/search) by default.\nThis can be overridden per-operation by explicitly setting refresh_ttl.\nDefaults to True if not configured.\n"
"description": "Default behavior for refreshing TTLs on read operations (`GET` and `SEARCH`).\n\nIf `True`, TTLs will be refreshed on read operations (get/search) by default.\nThis can be overridden per-operation by explicitly setting `refresh_ttl`.\nDefaults to `True` if not configured.\n"
},
"sweep_interval_minutes": {
"anyOf": [
@@ -162,14 +162,10 @@ def patch_config(
Args:
config: The config to patch.
callbacks: The callbacks to set.
Defaults to None.
recursion_limit: The recursion limit to set.
Defaults to None.
max_concurrency: The max number of concurrent steps to run, which also applies to parallelized steps.
Defaults to None.
run_name: The run name to set. Defaults to None.
run_name: The run name to set.
configurable: The configurable to set.
Defaults to None.
Returns:
RunnableConfig: The patched config.
@@ -534,9 +534,9 @@ def coerce_to_runnable(
class RunnableSeq(Runnable):
"""Sequence of Runnables, where the output of each is the input of the next.
"""Sequence of `Runnable`, where the output of each is the input of the next.
RunnableSeq is a simpler version of RunnableSequence that is internal to
`RunnableSeq` is a simpler version of `RunnableSequence` that is internal to
LangGraph.
"""
@@ -550,7 +550,7 @@ class RunnableSeq(Runnable):
Args:
steps: The steps to include in the sequence.
name: The name of the Runnable. Defaults to None.
name: The name of the `Runnable`.
Raises:
ValueError: If the sequence has less than 2 steps.
+9 -9
View File
@@ -39,13 +39,13 @@ class BaseChannel(Generic[Value, Update, Checkpoint], ABC):
def copy(self) -> Self:
"""Return a copy of the channel.
By default, delegates to checkpoint() and from_checkpoint().
By default, delegates to `checkpoint()` and `from_checkpoint()`.
Subclasses can override this method with a more efficient implementation."""
return self.from_checkpoint(self.checkpoint())
def checkpoint(self) -> Checkpoint | Any:
"""Return a serializable representation of the channel's current state.
Raises EmptyChannelError if the channel is empty (never updated yet),
Raises `EmptyChannelError` if the channel is empty (never updated yet),
or doesn't support checkpoints."""
try:
return self.get()
@@ -63,12 +63,12 @@ class BaseChannel(Generic[Value, Update, Checkpoint], ABC):
def get(self) -> Value:
"""Return the current value of the channel.
Raises EmptyChannelError if the channel is empty (never updated yet)."""
Raises `EmptyChannelError` if the channel is empty (never updated yet)."""
def is_available(self) -> bool:
"""Return True if the channel is available (not empty), False otherwise.
"""Return `True` if the channel is available (not empty), `False` otherwise.
Subclasses should override this method to provide a more efficient
implementation than calling get() and catching EmptyChannelError.
implementation than calling get() and catching `EmptyChannelError`.
"""
try:
self.get()
@@ -84,15 +84,15 @@ class BaseChannel(Generic[Value, Update, Checkpoint], ABC):
The order of the updates in the sequence is arbitrary.
This method is called by Pregel for all channels at the end of each step.
If there are no updates, it is called with an empty sequence.
Raises InvalidUpdateError if the sequence of updates is invalid.
Returns True if the channel was updated, False otherwise."""
Raises `InvalidUpdateError` if the sequence of updates is invalid.
Returns `True` if the channel was updated, `False` otherwise."""
def consume(self) -> bool:
"""Notify the channel that a subscribed task ran. By default, no-op.
A channel can use this method to modify its state, preventing the value
from being consumed again.
Returns True if the channel was updated, False otherwise.
Returns `True` if the channel was updated, `False` otherwise.
"""
return False
@@ -100,6 +100,6 @@ class BaseChannel(Generic[Value, Update, Checkpoint], ABC):
"""Notify the channel that the Pregel run is finishing. By default, no-op.
A channel can use this method to modify its state, preventing finish.
Returns True if the channel was updated, False otherwise.
Returns `True` if the channel was updated, `False` otherwise.
"""
return False
+1 -1
View File
@@ -28,7 +28,7 @@ class Topic(
Args:
typ: The type of the value stored in the channel.
accumulate: Whether to accumulate values across steps. If False, the channel will be emptied after each step.
accumulate: Whether to accumulate values across steps. If `False`, the channel will be emptied after each step.
"""
__slots__ = ("values", "accumulate")
+3 -3
View File
@@ -50,7 +50,7 @@ class GraphRecursionError(RecursionError):
Troubleshooting Guides:
- [GRAPH_RECURSION_LIMIT](https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT)
- [GRAPH_RECURSION_LIMIT](https://docs.langchain.com/oss/python/langgraph/GRAPH_RECURSION_LIMIT)
Examples:
@@ -70,8 +70,8 @@ class InvalidUpdateError(Exception):
Troubleshooting Guides:
- [INVALID_CONCURRENT_GRAPH_UPDATE](https://python.langchain.com/docs/troubleshooting/errors/INVALID_CONCURRENT_GRAPH_UPDATE)
- [INVALID_GRAPH_NODE_RETURN_VALUE](https://python.langchain.com/docs/troubleshooting/errors/INVALID_GRAPH_NODE_RETURN_VALUE)
- [INVALID_CONCURRENT_GRAPH_UPDATE](https://docs.langchain.com/oss/python/langgraph/INVALID_CONCURRENT_GRAPH_UPDATE)
- [INVALID_GRAPH_NODE_RETURN_VALUE](https://docs.langchain.com/oss/python/langgraph/INVALID_GRAPH_NODE_RETURN_VALUE)
"""
pass
+10 -10
View File
@@ -130,12 +130,12 @@ def task(
The `task` decorator supports both sync and async functions. To use async
functions, ensure that you are using Python 3.11 or higher.
Tasks can only be called from within an [entrypoint][langgraph.func.entrypoint] or
from within a StateGraph. A task can be called like a regular function with the
Tasks can only be called from within an [`entrypoint`][langgraph.func.entrypoint] or
from within a `StateGraph`. A task can be called like a regular function with the
following differences:
- When a checkpointer is enabled, the function inputs and outputs must be serializable.
- The decorated function can only be called from within an entrypoint or StateGraph.
- The decorated function can only be called from within an entrypoint or `StateGraph`.
- Calling the function produces a future. This makes it easy to parallelize tasks.
Args:
@@ -240,11 +240,11 @@ class entrypoint(Generic[ContextT]):
The decorated function can request access to additional parameters
that will be injected automatically at run time. These parameters include:
| Parameter | Description |
|------------------|----------------------------------------------------------------------------------------------------|
| **`config`** | A configuration object (aka RunnableConfig) that holds run-time configuration values. |
| **`previous`** | The previous return value for the given thread (available only when a checkpointer is provided). |
| **`runtime`** | A Runtime object that contains information about the current run, including context, store, writer | |
| Parameter | Description |
|------------------|------------------------------------------------------------------------------------------------------|
| **`config`** | A configuration object (aka `RunnableConfig`) that holds run-time configuration values. |
| **`previous`** | The previous return value for the given thread (available only when a checkpointer is provided). |
| **`runtime`** | A `Runtime` object that contains information about the current run, including context, store, writer |
The entrypoint decorator can be applied to sync functions or async functions.
@@ -462,11 +462,11 @@ class entrypoint(Generic[ContextT]):
"""
value: R
"""Value to return. A value will always be returned even if it is None."""
"""Value to return. A value will always be returned even if it is `None`."""
save: S
"""The value for the state for the next checkpoint.
A value will always be saved even if it is None.
A value will always be saved even if it is `None`.
"""
def __call__(self, func: Callable[..., Any]) -> Pregel:
+6 -6
View File
@@ -74,15 +74,15 @@ def add_messages(
left: The base list of messages.
right: The list of messages (or single message) to merge
into the base list.
format: The format to return messages in. If None then messages will be
returned as is. If 'langchain-openai' then messages will be returned as
BaseMessage objects with their contents formatted to match OpenAI message
format, meaning contents can be string, 'text' blocks, or 'image_url' blocks
and tool responses are returned as their own ToolMessages.
format: The format to return messages in. If `None` then messages will be
returned as is. If `langchain-openai` then messages will be returned as
`BaseMessage` objects with their contents formatted to match OpenAI message
format, meaning contents can be string, `'text'` blocks, or `'image_url'` blocks
and tool responses are returned as their own `ToolMessage` objects.
!!! important "Requirement"
Must have ``langchain-core>=0.3.11`` installed to use this feature.
Must have `langchain-core>=0.3.11` installed to use this feature.
Returns:
A new list of messages with the messages from `right` merged into `left`.
+19 -16
View File
@@ -125,7 +125,7 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
Args:
state_schema: The schema class that defines the state.
context_schema: The schema class that defines the runtime context.
Use this to expose immutable context data to your nodes, like user_id, db_conn, etc.
Use this to expose immutable context data to your nodes, like `user_id`, `db_conn`, etc.
input_schema: The schema class that defines the input to the graph.
output_schema: The schema class that defines the output from the graph.
@@ -370,19 +370,21 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
Args:
node: The function or runnable this node will run.
If a string is provided, it will be used as the node name, and action will be used as the function or runnable.
action: The action associated with the node. (default: None)
action: The action associated with the node.
Will be used as the node function or runnable if `node` is a string (node name).
defer: Whether to defer the execution of the node until the run is about to end.
metadata: The metadata associated with the node. (default: None)
metadata: The metadata associated with the node.
input_schema: The input schema for the node. (default: the graph's state schema)
retry_policy: The retry policy for the node. (default: None)
retry_policy: The retry policy for the node.
If a sequence is provided, the first matching policy will be applied.
cache_policy: The cache policy for the node. (default: None)
cache_policy: The cache policy for the node.
destinations: Destinations that indicate where a node can route to.
This is useful for edgeless graphs with nodes that return `Command` objects.
If a dict is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.
If a tuple is provided, the values will be used as the target node names.
NOTE: this is only used for graph rendering and doesn't have any effect on the graph execution.
!!! note
This is only used for graph rendering and doesn't have any effect on the graph execution.
Example:
```python
@@ -571,7 +573,7 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
end_key: The key of the end node of the edge.
Raises:
ValueError: If the start key is 'END' or if the start key or end key is not present in the graph.
ValueError: If the start key is `'END'` or if the start key or end key is not present in the graph.
Returns:
Self: The instance of the state graph, allowing for method chaining.
@@ -628,14 +630,15 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
exiting this node.
path: The callable that determines the next
node or nodes. If not specifying `path_map` it should return one or
more nodes. If it returns END, the graph will stop execution.
more nodes. If it returns `'END'`, the graph will stop execution.
path_map: Optional mapping of paths to node
names. If omitted the paths returned by `path` should be node names.
Returns:
Self: The instance of the graph, allowing for method chaining.
Note: Without typehints on the `path` function's return value (e.g., `-> Literal["foo", "__end__"]:`)
!!! warning
Without typehints on the `path` function's return value (e.g., `-> Literal["foo", "__end__"]:`)
or a path_map, the graph visualization assumes the edge could transition to any node in the graph.
""" # noqa: E501
@@ -669,13 +672,13 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
"""Add a sequence of nodes that will be executed in the provided order.
Args:
nodes: A sequence of StateNodes (callables that accept a state arg) or (name, StateNode) tuples.
If no names are provided, the name will be inferred from the node object (e.g. a runnable or a callable name).
nodes: A sequence of `StateNode` (callables that accept a `state` arg) or `(name, StateNode)` tuples.
If no names are provided, the name will be inferred from the node object (e.g. a `Runnable` or a `Callable` name).
Each node will be executed in the order provided.
Raises:
ValueError: if the sequence is empty.
ValueError: if the sequence contains duplicate node names.
ValueError: If the sequence is empty.
ValueError: If the sequence contains duplicate node names.
Returns:
Self: The instance of the state graph, allowing for method chaining.
@@ -818,10 +821,10 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
Args:
checkpointer: A checkpoint saver object or flag.
If provided, this Checkpointer serves as a fully versioned "short-term memory" for the graph,
If provided, this `Checkpointer` serves as a fully versioned "short-term memory" for the graph,
allowing it to be paused, resumed, and replayed from any point.
If None, it may inherit the parent graph's checkpointer when used as a subgraph.
If False, it will not use or inherit any checkpointer.
If `None`, it may inherit the parent graph's checkpointer when used as a subgraph.
If `False`, it will not use or inherit any checkpointer.
interrupt_before: An optional list of node names to interrupt before.
interrupt_after: An optional list of node names to interrupt after.
debug: A flag indicating whether to enable debug mode.
+2 -2
View File
@@ -392,11 +392,11 @@ def prepare_next_tasks(
processes: The mapping of process names to PregelNode instances.
channels: The mapping of channel names to BaseChannel instances.
managed: The mapping of managed value names to functions.
config: The runnable configuration.
config: The `Runnable` configuration.
step: The current step.
for_execution: Whether the tasks are being prepared for execution.
store: An instance of BaseStore to make it available for usage within tasks.
checkpointer: Checkpointer instance used for saving checkpoints.
checkpointer: `Checkpointer` instance used for saving checkpoints.
manager: The parent run manager to use for the tasks.
trigger_to_nodes: Optional: Mapping of channel names to the set of nodes
that are can be triggered by that channel.
+36 -37
View File
@@ -211,7 +211,7 @@ class NodeBuilder:
Args:
channels: Channel name(s) to subscribe to
read: If True, the channels will be included in the input to the node.
read: If `True`, the channels will be included in the input to the node.
Otherwise, they will trigger the node without being sent in input.
Returns:
@@ -591,26 +591,25 @@ class Pregel(
input_channels: str | Sequence[str]
step_timeout: float | None = None
"""Maximum time to wait for a step to complete, in seconds. Defaults to None."""
"""Maximum time to wait for a step to complete, in seconds."""
debug: bool
"""Whether to print debug information during execution. Defaults to False."""
"""Whether to print debug information during execution."""
checkpointer: Checkpointer = None
"""Checkpointer used to save and load graph state. Defaults to None."""
"""`Checkpointer` used to save and load graph state."""
store: BaseStore | None = None
"""Memory store to use for SharedValues. Defaults to None."""
"""Memory store to use for SharedValues."""
cache: BaseCache | None = None
"""Cache to use for storing node results. Defaults to None."""
"""Cache to use for storing node results."""
retry_policy: Sequence[RetryPolicy] = ()
"""Retry policies to use when running tasks. Empty set disables retries."""
cache_policy: CachePolicy | None = None
"""Cache policy to use for all nodes. Can be overridden by individual nodes.
Defaults to None."""
"""Cache policy to use for all nodes. Can be overridden by individual nodes."""
context_schema: type[ContextT] | None = None
"""Specifies the schema for the context object that will be passed to the workflow."""
@@ -928,10 +927,10 @@ class Pregel(
Args:
namespace: The namespace to filter the subgraphs by.
recurse: Whether to recurse into the subgraphs.
If False, only the immediate subgraphs will be returned.
If `False`, only the immediate subgraphs will be returned.
Returns:
Iterator[tuple[str, PregelProtocol]]: An iterator of the (namespace, subgraph) pairs.
An iterator of the (namespace, subgraph) pairs.
"""
for name, node in self.nodes.items():
# filter by prefix
@@ -967,10 +966,10 @@ class Pregel(
Args:
namespace: The namespace to filter the subgraphs by.
recurse: Whether to recurse into the subgraphs.
If False, only the immediate subgraphs will be returned.
If `False`, only the immediate subgraphs will be returned.
Returns:
AsyncIterator[tuple[str, PregelProtocol]]: An iterator of the (namespace, subgraph) pairs.
An iterator of the (namespace, subgraph) pairs.
"""
for name, node in self.get_subgraphs(namespace=namespace, recurse=recurse):
yield name, node
@@ -1423,7 +1422,7 @@ class Pregel(
Args:
config: The config to apply the updates to.
supersteps: A list of supersteps, each including a list of updates to apply sequentially to a graph state.
Each update is a tuple of the form `(values, as_node, task_id)` where task_id is optional.
Each update is a tuple of the form `(values, as_node, task_id)` where `task_id` is optional.
Raises:
ValueError: If no checkpointer is set or no updates are provided.
@@ -1890,7 +1889,7 @@ class Pregel(
Args:
config: The config to apply the updates to.
supersteps: A list of supersteps, each including a list of updates to apply sequentially to a graph state.
Each update is a tuple of the form `(values, as_node, task_id)` where task_id is optional.
Each update is a tuple of the form `(values, as_node, task_id)` where `task_id` is optional.
Raises:
ValueError: If no checkpointer is set or no updates are provided.
@@ -2473,7 +2472,7 @@ class Pregel(
- `"custom"`: Emit custom data from inside nodes or tasks using `StreamWriter`.
- `"messages"`: Emit LLM messages token-by-token together with metadata for any LLM invocations inside nodes or tasks.
Will be emitted as 2-tuples `(LLM token, metadata)`.
- `"checkpoints"`: Emit an event when a checkpoint is created, in the same format as returned by get_state().
- `"checkpoints"`: Emit an event when a checkpoint is created, in the same format as returned by `get_state()`.
- `"tasks"`: Emit events when tasks start and finish, including their results and errors.
You can pass a list as the `stream_mode` parameter to stream multiple modes at once.
@@ -2484,12 +2483,12 @@ class Pregel(
output_keys: The keys to stream, defaults to all non-context channels.
interrupt_before: Nodes to interrupt before, defaults to all nodes in the graph.
interrupt_after: Nodes to interrupt after, defaults to all nodes in the graph.
durability: The durability mode for the graph execution, defaults to "async". Options are:
durability: The durability mode for the graph execution, defaults to `"async"`. Options are:
- `"sync"`: Changes are persisted synchronously before the next step starts.
- `"async"`: Changes are persisted asynchronously while the next step executes.
- `"exit"`: Changes are persisted only when the graph exits.
subgraphs: Whether to stream events from inside subgraphs, defaults to False.
If True, the events will be emitted as tuples `(namespace, data)`,
If `True`, the events will be emitted as tuples `(namespace, data)`,
or `(namespace, mode, data)` if `stream_mode` is a list,
where `namespace` is a tuple with the path to the node where a subgraph is invoked,
e.g. `("parent_node:<task_id>", "child_node:<task_id>")`.
@@ -2497,7 +2496,7 @@ class Pregel(
See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.
Yields:
The output of each step in the graph. The output shape depends on the stream_mode.
The output of each step in the graph. The output shape depends on the `stream_mode`.
"""
if (checkpoint_during := kwargs.get("checkpoint_during")) is not None:
warnings.warn(
@@ -2749,12 +2748,12 @@ class Pregel(
output_keys: The keys to stream, defaults to all non-context channels.
interrupt_before: Nodes to interrupt before, defaults to all nodes in the graph.
interrupt_after: Nodes to interrupt after, defaults to all nodes in the graph.
durability: The durability mode for the graph execution, defaults to "async". Options are:
durability: The durability mode for the graph execution, defaults to `"async"`. Options are:
- `"sync"`: Changes are persisted synchronously before the next step starts.
- `"async"`: Changes are persisted asynchronously while the next step executes.
- `"exit"`: Changes are persisted only when the graph exits.
subgraphs: Whether to stream events from inside subgraphs, defaults to False.
If True, the events will be emitted as tuples `(namespace, data)`,
If `True`, the events will be emitted as tuples `(namespace, data)`,
or `(namespace, mode, data)` if `stream_mode` is a list,
where `namespace` is a tuple with the path to the node where a subgraph is invoked,
e.g. `("parent_node:<task_id>", "child_node:<task_id>")`.
@@ -2762,7 +2761,7 @@ class Pregel(
See [LangGraph streaming guide](https://langchain-ai.github.io/langgraph/how-tos/streaming/) for more details.
Yields:
The output of each step in the graph. The output shape depends on the stream_mode.
The output of each step in the graph. The output shape depends on the `stream_mode`.
"""
if (checkpoint_during := kwargs.get("checkpoint_during")) is not None:
warnings.warn(
@@ -3058,23 +3057,23 @@ class Pregel(
Args:
input: The input data for the graph. It can be a dictionary or any other type.
config: Optional. The configuration for the graph run.
config: The configuration for the graph run.
context: The static context to use for the run.
!!! version-added "Added in version 0.6.0"
stream_mode: Optional[str]. The stream mode for the graph run. Default is "values".
stream_mode: The stream mode for the graph run.
print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
output_keys: Optional. The output keys to retrieve from the graph run.
interrupt_before: Optional. The nodes to interrupt the graph run before.
interrupt_after: Optional. The nodes to interrupt the graph run after.
durability: The durability mode for the graph execution, defaults to "async". Options are:
output_keys: The output keys to retrieve from the graph run.
interrupt_before: The nodes to interrupt the graph run before.
interrupt_after: The nodes to interrupt the graph run after.
durability: The durability mode for the graph execution, defaults to `"async"`. Options are:
- `"sync"`: Changes are persisted synchronously before the next step starts.
- `"async"`: Changes are persisted asynchronously while the next step executes.
- `"exit"`: Changes are persisted only when the graph exits.
**kwargs: Additional keyword arguments to pass to the graph run.
Returns:
The output of the graph run. If stream_mode is "values", it returns the latest output.
If stream_mode is not "values", it returns a list of output chunks.
The output of the graph run. If `stream_mode` is `"values"`, it returns the latest output.
If `stream_mode` is not `"values"`, it returns a list of output chunks.
"""
output_keys = output_keys if output_keys is not None else self.output_channels
@@ -3143,23 +3142,23 @@ class Pregel(
Args:
input: The input data for the computation. It can be a dictionary or any other type.
config: Optional. The configuration for the computation.
config: The configuration for the computation.
context: The static context to use for the run.
!!! version-added "Added in version 0.6.0"
stream_mode: Optional. The stream mode for the computation. Default is "values".
stream_mode: The stream mode for the computation.
print_mode: Accepts the same values as `stream_mode`, but only prints the output to the console, for debugging purposes. Does not affect the output of the graph in any way.
output_keys: Optional. The output keys to include in the result. Default is None.
interrupt_before: Optional. The nodes to interrupt before. Default is None.
interrupt_after: Optional. The nodes to interrupt after. Default is None.
durability: The durability mode for the graph execution, defaults to "async". Options are:
output_keys: The output keys to include in the result.
interrupt_before: The nodes to interrupt before.
interrupt_after: The nodes to interrupt after.
durability: The durability mode for the graph execution, defaults to `"async"`. Options are:
- `"sync"`: Changes are persisted synchronously before the next step starts.
- `"async"`: Changes are persisted asynchronously while the next step executes.
- `"exit"`: Changes are persisted only when the graph exits.
**kwargs: Additional keyword arguments.
Returns:
The result of the computation. If stream_mode is "values", it returns the latest value.
If stream_mode is "chunks", it returns a list of chunks.
The result of the computation. If `stream_mode` is `"values"`, it returns the latest value.
If `stream_mode` is `"chunks"`, it returns a list of chunks.
"""
output_keys = output_keys if output_keys is not None else self.output_channels
+2 -2
View File
@@ -80,11 +80,11 @@ class Runtime(Generic[ContextT]):
1. Define a schema for the runtime context.
2. Create a store to persist memories and other information.
3. Use the runtime context to access the user_id.
3. Use the runtime context to access the `user_id`.
"""
context: ContextT = field(default=None) # type: ignore[assignment]
"""Static context for the graph run, like user_id, db_conn, etc.
"""Static context for the graph run, like `user_id`, `db_conn`, etc.
Can also be thought of as 'run dependencies'."""
+13 -13
View File
@@ -85,7 +85,7 @@ StreamMode = Literal[
If multiple updates are made in the same step (e.g. multiple nodes are run) then those updates are emitted separately.
- `"custom"`: Emit custom data using from inside nodes or tasks using `StreamWriter`.
- `"messages"`: Emit LLM messages token-by-token together with metadata for any LLM invocations inside nodes or tasks.
- `"checkpoints"`: Emit an event when a checkpoint is created, in the same format as returned by get_state().
- `"checkpoints"`: Emit an event when a checkpoint is created, in the same format as returned by `get_state()`.
- `"tasks"`: Emit events when tasks start and finish, including their results and errors.
- `"debug"`: Emit "checkpoints" and "tasks" events, for debugging purposes.
"""
@@ -93,7 +93,7 @@ StreamMode = Literal[
StreamWriter = Callable[[Any], None]
"""Callable that accepts a single argument and writes it to the output stream.
Always injected into nodes if requested as a keyword argument, but it's a no-op
when not using stream_mode="custom"."""
when not using `stream_mode="custom"`."""
if sys.version_info >= (3, 10):
_DC_SLOTS = {"slots": True}
@@ -137,7 +137,7 @@ class CachePolicy(Generic[KeyFuncT]):
Defaults to hashing the input with pickle."""
ttl: int | None = None
"""Time to live for the cache entry in seconds. If None, the entry never expires."""
"""Time to live for the cache entry in seconds. If `None`, the entry never expires."""
_DEFAULT_INTERRUPT_ID = "placeholder-id"
@@ -354,20 +354,20 @@ class Command(Generic[N], ToolOutputMixin):
Args:
graph: graph to send the command to. Supported values are:
- None: the current graph (default)
- Command.PARENT: closest parent graph
update: update to apply to the graph's state.
resume: value to resume execution with. To be used together with [`interrupt()`][langgraph.types.interrupt].
- `None`: the current graph
- `Command.PARENT`: closest parent graph
update: Update to apply to the graph's state.
resume: Value to resume execution with. To be used together with [`interrupt()`][langgraph.types.interrupt].
Can be one of the following:
- mapping of interrupt ids to resume values
- a single value with which to resume the next interrupt
goto: can be one of the following:
- Mapping of interrupt ids to resume values
- A single value with which to resume the next interrupt
goto: Can be one of the following:
- name of the node to navigate to next (any node that belongs to the specified `graph`)
- sequence of node names to navigate to next
- Name of the node to navigate to next (any node that belongs to the specified `graph`)
- Sequence of node names to navigate to next
- `Send` object (to execute a node with the input provided)
- sequence of `Send` objects
- Sequence of `Send` objects
"""
graph: str | None = None
@@ -141,7 +141,7 @@ def _handle_tool_error(
Args:
e: The exception that occurred during tool execution.
flag: Configuration for how to handle the error. Can be:
- bool: If True, use default error template
- bool: If `True`, use default error template
- str: Use this string as the error message
- Callable: Call this function with the exception to get error message
- tuple: Not used in this context (handled by caller)
@@ -314,9 +314,9 @@ class ToolNode(RunnableCallable):
tools: A sequence of tools that can be invoked by this node. Tools can be
BaseTool instances or plain functions that will be converted to tools.
name: The name identifier for this node in the graph. Used for debugging
and visualization. Defaults to "tools".
and visualization.
tags: Optional metadata tags to associate with the node for filtering
and organization. Defaults to None.
and organization.
handle_tool_errors: Configuration for error handling during tool execution.
Defaults to True. Supports multiple strategies:
@@ -330,7 +330,7 @@ class ToolNode(RunnableCallable):
and return the string result of calling it with the exception.
- False: Disable error handling entirely, allowing exceptions to propagate.
messages_key: The key in the state dictionary that contains the message list.
This same key will be used for the output ToolMessages. Defaults to "messages".
This same key will be used for the output ToolMessages.
"""
super().__init__(self._func, self._afunc, name=name, tags=tags, trace=False)
self.tools_by_name: dict[str, BaseTool] = {}
@@ -919,7 +919,7 @@ class InjectedState(InjectedToolArg):
"""Initialize InjectedState annotation.
Args:
field: Optional key to extract from the state dictionary. If None, the entire
field: Optional key to extract from the state dictionary. If `None`, the entire
state is injected. If specified, only that field's value is injected.
This allows tools to request specific state components rather than
processing the full state structure.
+1 -1
View File
@@ -13,7 +13,7 @@ class HTTPException(Exception):
Args:
status_code: HTTP status code for the error. Defaults to 401 "Unauthorized".
detail: Detailed error message. If None, uses a default
detail: Detailed error message. If `None`, uses a default
message based on the status code.
headers: Additional HTTP headers to include in the error response.
+14 -14
View File
@@ -941,7 +941,7 @@ class AssistantsClient:
Args:
assistant_id: Assistant to update.
graph_id: The ID of the graph the assistant should use.
The graph ID is normally set in your langgraph.json configuration. If None, assistant will keep pointing to same graph.
The graph ID is normally set in your langgraph.json configuration. If `None`, assistant will keep pointing to same graph.
config: Configuration to use for the graph.
context: Static context to add to the assistant.
!!! version-added "Added in version 0.6.0"
@@ -1275,7 +1275,7 @@ class ThreadsClient:
Args:
metadata: Metadata to add to thread.
thread_id: ID of thread.
If None, ID will be a randomly generated UUID.
If `None`, ID will be a randomly generated UUID.
if_exists: How to handle duplicate creation. Defaults to 'raise' under the hood.
Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread).
supersteps: Apply a list of supersteps when creating a thread, each containing a sequence of updates.
@@ -1952,7 +1952,7 @@ class RunsClient:
Args:
thread_id: the thread ID to assign to the thread.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to stream from.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -2162,7 +2162,7 @@ class RunsClient:
Args:
thread_id: the thread ID to assign to the thread.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to stream from.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -2414,7 +2414,7 @@ class RunsClient:
Args:
thread_id: the thread ID to create the run on.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to run.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -3238,7 +3238,7 @@ class StoreClient:
Args:
key: The unique identifier for the item.
namespace: Optional list of strings representing the namespace path.
refresh_ttl: Whether to refresh the TTL on this read operation. If None, uses the store's default behavior.
refresh_ttl: Whether to refresh the TTL on this read operation. If `None`, uses the store's default behavior.
Returns:
Item: The retrieved item.
@@ -3336,7 +3336,7 @@ class StoreClient:
limit: Maximum number of items to return (default is 10).
offset: Number of items to skip before returning results (default is 0).
query: Optional query for natural language search.
refresh_ttl: Whether to refresh the TTL on items returned by this search. If None, uses the store's default behavior.
refresh_ttl: Whether to refresh the TTL on items returned by this search. If `None`, uses the store's default behavior.
headers: Optional custom headers to include with the request.
params: Optional query parameters to include with the request.
@@ -4200,7 +4200,7 @@ class SyncAssistantsClient:
Args:
assistant_id: Assistant to update.
graph_id: The ID of the graph the assistant should use.
The graph ID is normally set in your langgraph.json configuration. If None, assistant will keep pointing to same graph.
The graph ID is normally set in your langgraph.json configuration. If `None`, assistant will keep pointing to same graph.
config: Configuration to use for the graph.
context: Static context to add to the assistant.
!!! version-added "Added in version 0.6.0"
@@ -4521,7 +4521,7 @@ class SyncThreadsClient:
Args:
metadata: Metadata to add to thread.
thread_id: ID of thread.
If None, ID will be a randomly generated UUID.
If `None`, ID will be a randomly generated UUID.
if_exists: How to handle duplicate creation. Defaults to 'raise' under the hood.
Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread).
supersteps: Apply a list of supersteps when creating a thread, each containing a sequence of updates.
@@ -5186,7 +5186,7 @@ class SyncRunsClient:
Args:
thread_id: the thread ID to assign to the thread.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to stream from.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -5392,7 +5392,7 @@ class SyncRunsClient:
Args:
thread_id: the thread ID to assign to the thread.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to stream from.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -5644,7 +5644,7 @@ class SyncRunsClient:
Args:
thread_id: the thread ID to create the run on.
If None will create a stateless run.
If `None` will create a stateless run.
assistant_id: The assistant ID or graph name to run.
If using graph name, will default to first assistant created from that graph.
input: The input to the graph.
@@ -6441,7 +6441,7 @@ class SyncStoreClient:
Args:
key: The unique identifier for the item.
namespace: Optional list of strings representing the namespace path.
refresh_ttl: Whether to refresh the TTL on this read operation. If None, uses the store's default behavior.
refresh_ttl: Whether to refresh the TTL on this read operation. If `None`, uses the store's default behavior.
headers: Optional custom headers to include with the request.
Returns:
@@ -6539,7 +6539,7 @@ class SyncStoreClient:
limit: Maximum number of items to return (default is 10).
offset: Number of items to skip before returning results (default is 0).
query: Optional query for natural language search.
refresh_ttl: Whether to refresh the TTL on items returned by this search. If None, uses the store's default behavior.
refresh_ttl: Whether to refresh the TTL on items returned by this search. If `None`, uses the store's default behavior.
headers: Optional custom headers to include with the request.
params: Optional query parameters to include with the request.