langchain/libs/core/langchain_core
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
..
_api core[patch]: deprecation docstring with lib (#18350) 2024-03-01 00:44:13 +00:00
beta core: upgrade mypy to recent mypy (#18753) 2024-03-07 15:25:19 -05:00
callbacks [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
document_loaders community: If load() has been overridden, use it in default lazy_load() (#18690) 2024-03-07 11:52:19 -05:00
documents core[minor]: move document compressor base (#17910) 2024-02-26 17:20:50 -08:00
embeddings core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
example_selectors docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
globals IMPROVEMENT: filter global warnings properly (#13754) 2023-11-22 16:26:37 -08:00
language_models [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
load core[patch]: Change structured prompt lc id to match js (#19099) 2024-03-14 20:02:52 -07:00
messages core[minor]: generation info on msg (#18592) 2024-03-12 04:43:17 +00:00
output_parsers core[minor]: add streaming support to OAI tool parsers (#18940) 2024-03-11 21:53:56 -07:00
outputs docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
prompts core[patch]: Change structured prompt lc id to match js (#19099) 2024-03-14 20:02:52 -07:00
pydantic_v1 Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00
runnables [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
tracers core[major]: On Tool End Observation Casting Fix (#18798) 2024-03-11 10:59:04 -04:00
utils core[patch]: fixed circular dependency with json schema (#18657) 2024-03-12 05:42:45 +00:00
__init__.py core[patch], community[patch]: mark runnable context, lc load as beta (#15603) 2024-01-05 17:54:26 -05:00
agents.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
caches.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
chat_history.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
chat_sessions.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
env.py core[patch]: update langchain-core runtime library name (#14884) 2023-12-20 14:35:48 -08:00
exceptions.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
memory.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
prompt_values.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
py.typed core[minor], langchain[patch], experimental[patch]: Added missing py.typed to langchain_core (#14143) 2023-12-01 19:15:23 -08:00
retrievers.py [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
stores.py core: upgrade mypy to recent mypy (#18753) 2024-03-07 15:25:19 -05:00
sys_info.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
tools.py [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
vectorstores.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00