langchain/libs/core/langchain_core/callbacks
William FH 780337488e
[Enhancement] Add support for directly providing a run_id (#18990)
The root run id (~trace id's) is useful for assigning feedback, but the
current recommended approach is to use callbacks to retrieve it, which
has some drawbacks:
1. Doesn't work for streaming until after the first event
2. Doesn't let you call other endpoints with the same trace ID in
parallel (since you have to wait until the call is completed/started to
use

This PR lets you provide = "run_id" in the runnable config.

Couple considerations:

1. For batch calls, we split the trace up into separate trees (to permit
better rendering). We keep the provided run ID for the first one and
generate a unique one for other elements of the batch.
2. For nested calls, the provided ID is ONLY used on the top root/trace.



### Example Usage


```
chain.invoke("foo", {"run_id": uuid.uuid4()})
```
2024-03-18 15:03:04 -07:00
..
__init__.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
base.py core[major]: On Tool End Observation Casting Fix (#18798) 2024-03-11 10:59:04 -04:00
manager.py [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
stdout.py core[major]: On Tool End Observation Casting Fix (#18798) 2024-03-11 10:59:04 -04:00
streaming_stdout.py core[major]: On Tool End Observation Casting Fix (#18798) 2024-03-11 10:59:04 -04:00