ó
    ýÞ jã  ã                   óœ   • S SK r S SKrS SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
JrJr  S SKJr  S\S	S4S
 jrS	\4S jrS	\	4S jrS	\4S jrg)é    N)ÚAny)ÚRunnableConfig)Úvar_child_runnable_config)Ú	BaseStore)ÚCONFÚCONFIG_KEY_RUNTIME)ÚStreamWriterÚcÚreturnc                 ó   • g )N© )r
   s    ÚJ/var/www/html/gaurav/venv/lib/python3.13/site-packages/langgraph/config.pyÚ_no_op_stream_writerr      s   € Øó    c                  óê   • [         R                  S:  a'   [        R                  " 5       (       a  [	        S5      e [
        R                  " 5       =n (       a  U $ [	        S5      e! [         a     N5f = f)N)é   é   z=Python 3.11 or later required to use this in an async contextz/Called get_config outside of a runnable context)ÚsysÚversion_infoÚasyncioÚcurrent_taskÚRuntimeErrorr   Úget)Ú
var_configs    r   Ú
get_configr      su   € Ü
×Ñ˜'Ó!ð	Ü×#Ò#×%Ñ%Ü"ØSóð ð &ô /×2Ò2Ó4Ð4€zÕ4ØÐäÐLÓMÐMøô ó 	Ùð	ús   –%A% Á%
A2Á1A2c                  óF   • [        5       [           [           R                  $ )a™  Access LangGraph store from inside a graph node or entrypoint task at runtime.

Can be called from inside any [`StateGraph`][langgraph.graph.StateGraph] node or
functional API [`task`][langgraph.func.task], as long as the `StateGraph` or the [`entrypoint`][langgraph.func.entrypoint]
was initialized with a store, e.g.:

```python
# with StateGraph
graph = (
    StateGraph(...)
    ...
    .compile(store=store)
)

# or with entrypoint
@entrypoint(store=store)
def workflow(inputs):
    ...
```

!!! warning "Async with Python < 3.11"

    If you are using Python < 3.11 and are running LangGraph asynchronously,
    `get_store()` won't work since it uses [`contextvar`](https://docs.python.org/3/library/contextvars.html) propagation (only available in [Python >= 3.11](https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task)).


Example: Using with `StateGraph`
    ```python
    from typing_extensions import TypedDict
    from langgraph.graph import StateGraph, START
    from langgraph.store.memory import InMemoryStore
    from langgraph.config import get_store

    store = InMemoryStore()
    store.put(("values",), "foo", {"bar": 2})


    class State(TypedDict):
        foo: int


    def my_node(state: State):
        my_store = get_store()
        stored_value = my_store.get(("values",), "foo").value["bar"]
        return {"foo": stored_value + 1}


    graph = (
        StateGraph(State)
        .add_node(my_node)
        .add_edge(START, "my_node")
        .compile(store=store)
    )

    graph.invoke({"foo": 1})
    ```

    ```pycon
    {"foo": 3}
    ```

Example: Using with functional API
    ```python
    from langgraph.func import entrypoint, task
    from langgraph.store.memory import InMemoryStore
    from langgraph.config import get_store

    store = InMemoryStore()
    store.put(("values",), "foo", {"bar": 2})


    @task
    def my_task(value: int):
        my_store = get_store()
        stored_value = my_store.get(("values",), "foo").value["bar"]
        return stored_value + 1


    @entrypoint(store=store)
    def workflow(value: int):
        return my_task(value).result()


    workflow.invoke(1)
    ```

    ```pycon
    3
    ```
)r   r   r   Ústorer   r   r   Ú	get_storer       s   € ôv ‹<œÑÔ0Ñ1×7Ñ7Ð7r   c                  óJ   • [        5       [           [           n U R                  $ )aH  Access LangGraph [`StreamWriter`][langgraph.types.StreamWriter] from inside a graph node or entrypoint task at runtime.

Can be called from inside any [`StateGraph`][langgraph.graph.StateGraph] node or
functional API [`task`][langgraph.func.task].

!!! warning "Async with Python < 3.11"

    If you are using Python < 3.11 and are running LangGraph asynchronously,
    `get_stream_writer()` won't work since it uses [`contextvar`](https://docs.python.org/3/library/contextvars.html) propagation (only available in [Python >= 3.11](https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task)).

Example: Using with `StateGraph`
    ```python
    from typing_extensions import TypedDict
    from langgraph.graph import StateGraph, START
    from langgraph.config import get_stream_writer


    class State(TypedDict):
        foo: int


    def my_node(state: State):
        my_stream_writer = get_stream_writer()
        my_stream_writer({"custom_data": "Hello!"})
        return {"foo": state["foo"] + 1}


    graph = (
        StateGraph(State)
        .add_node(my_node)
        .add_edge(START, "my_node")
        .compile(store=store)
    )

    for chunk in graph.stream({"foo": 1}, stream_mode="custom"):
        print(chunk)
    ```

    ```pycon
    {"custom_data": "Hello!"}
    ```

Example: Using with functional API
    ```python
    from langgraph.func import entrypoint, task
    from langgraph.config import get_stream_writer


    @task
    def my_task(value: int):
        my_stream_writer = get_stream_writer()
        my_stream_writer({"custom_data": "Hello!"})
        return value + 1


    @entrypoint(store=store)
    def workflow(value: int):
        return my_task(value).result()


    for chunk in workflow.stream(1, stream_mode="custom"):
        print(chunk)
    ```

    ```pycon
    {"custom_data": "Hello!"}
    ```
)r   r   r   Ústream_writer)Úruntimes    r   Úget_stream_writerr"   ~   s#   € ôJ ‹lœ4Ñ Ô!3Ñ4€GØ× Ñ Ð r   )r   r   Útypingr   Úlangchain_core.runnablesr   Úlangchain_core.runnables.configr   Úlanggraph.store.baser   Úlanggraph._internal._constantsr   r   Úlanggraph.typesr	   r   r   r   r"   r   r   r   Ú<module>r)      s[   ðÛ Û 
Ý å 3Ý EÝ *ç CÝ (ð	˜Cð 	 Dô 	ðN�Nô Nð[8�9ô [8ð|F!˜<õ F!r   