langchain/libs/core/tests/unit_tests/runnables
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
..
__snapshots__ core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
__init__.py
test_config.py core[patch]: fix arbitrary config keys (#18827) 2024-03-08 17:35:13 -08:00
test_context.py core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
test_fallbacks.py core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
test_graph.py core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
test_history.py add methods to deserialize prompts that were old (#14857) 2023-12-18 13:45:08 -08:00
test_imports.py Fetch runnable config from context var inside runnable lambda and runnable generator (#15334) 2024-01-02 12:16:39 -08:00
test_runnable_events.py core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
test_runnable.py [Enhancement] Add support for directly providing a run_id (#18990) 2024-03-18 15:03:04 -07:00
test_utils.py