diff --git a/libs/community/tests/unit_tests/load/__snapshots__/test_dump.ambr b/libs/community/tests/unit_tests/load/__snapshots__/test_dump.ambr index 2789472be2212..e8bb230bbb28f 100644 --- a/libs/community/tests/unit_tests/load/__snapshots__/test_dump.ambr +++ b/libs/community/tests/unit_tests/load/__snapshots__/test_dump.ambr @@ -87,44 +87,7 @@ "template": "hello {name}!", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" }, "llm": { "lc": 1, @@ -154,44 +117,7 @@ "max_retries": 2, "disallowed_special": "all" }, - "name": "OpenAI", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "OpenAIInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "llms", - "openai", - "OpenAI" - ], - "name": "OpenAI" - } - }, - { - "id": 2, - "type": "schema", - "data": "OpenAIOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "OpenAI" }, "output_key": "text", "output_parser": { @@ -204,85 +130,11 @@ "StrOutputParser" ], "kwargs": {}, - "name": "StrOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "StrOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "output_parser", - "StrOutputParser" - ], - "name": "StrOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "StrOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "StrOutputParser" }, "return_final_only": true }, - "name": "LLMChain", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ChainInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "chains", - "llm", - "LLMChain" - ], - "name": "LLMChain" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChainOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "LLMChain" } ''' # --- @@ -338,87 +190,13 @@ "template": "hello {name}!", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "llm": { "lc": 1, @@ -443,44 +221,7 @@ "max_retries": 2, "n": 1 }, - "name": "ChatOpenAI", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ChatOpenAIInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "chat_models", - "openai", - "ChatOpenAI" - ], - "name": "ChatOpenAI" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatOpenAIOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatOpenAI" }, "output_key": "text", "output_parser": { @@ -493,85 +234,11 @@ "StrOutputParser" ], "kwargs": {}, - "name": "StrOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "StrOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "output_parser", - "StrOutputParser" - ], - "name": "StrOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "StrOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "StrOutputParser" }, "return_final_only": true }, - "name": "LLMChain", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ChainInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "chains", - "llm", - "LLMChain" - ], - "name": "LLMChain" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChainOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "LLMChain" } ''' # --- @@ -603,44 +270,7 @@ "template": "hello {name}!", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" }, "llm": { "lc": 1, @@ -670,44 +300,7 @@ "max_retries": 2, "disallowed_special": "all" }, - "name": "OpenAI", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "OpenAIInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "llms", - "openai", - "OpenAI" - ], - "name": "OpenAI" - } - }, - { - "id": 2, - "type": "schema", - "data": "OpenAIOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "OpenAI" }, "output_key": "text", "output_parser": { @@ -720,85 +313,11 @@ "StrOutputParser" ], "kwargs": {}, - "name": "StrOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "StrOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "output_parser", - "StrOutputParser" - ], - "name": "StrOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "StrOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "StrOutputParser" }, "return_final_only": true }, - "name": "LLMChain", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ChainInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "chains", - "llm", - "LLMChain" - ], - "name": "LLMChain" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChainOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "LLMChain" } ''' # --- @@ -832,44 +351,7 @@ "max_retries": 2, "disallowed_special": "all" }, - "name": "OpenAI", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "OpenAIInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "llms", - "openai", - "OpenAI" - ], - "name": "OpenAI" - } - }, - { - "id": 2, - "type": "schema", - "data": "OpenAIOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "OpenAI" } ''' # --- diff --git a/libs/core/langchain_core/callbacks/manager.py b/libs/core/langchain_core/callbacks/manager.py index ba42a274a9d6d..ce38bc53b8293 100644 --- a/libs/core/langchain_core/callbacks/manager.py +++ b/libs/core/langchain_core/callbacks/manager.py @@ -1354,7 +1354,7 @@ def on_chat_model_start( def on_chain_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], inputs: Union[Dict[str, Any], Any], run_id: Optional[UUID] = None, **kwargs: Any, @@ -1362,7 +1362,7 @@ def on_chain_start( """Run when chain starts running. Args: - serialized (Dict[str, Any]): The serialized chain. + serialized (Optional[Dict[str, Any]]): The serialized chain. inputs (Union[Dict[str, Any], Any]): The inputs to the chain. run_id (UUID, optional): The ID of the run. Defaults to None. **kwargs (Any): Additional keyword arguments. @@ -1398,7 +1398,7 @@ def on_chain_start( def on_tool_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], input_str: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, @@ -1453,7 +1453,7 @@ def on_tool_start( def on_retriever_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], query: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, @@ -1462,7 +1462,7 @@ def on_retriever_start( """Run when the retriever starts running. Args: - serialized (Dict[str, Any]): The serialized retriever. + serialized (Optional[Dict[str, Any]]): The serialized retriever. query (str): The query. run_id (UUID, optional): The ID of the run. Defaults to None. parent_run_id (UUID, optional): The ID of the parent run. Defaults to None. @@ -1840,7 +1840,7 @@ async def on_chat_model_start( async def on_chain_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], inputs: Union[Dict[str, Any], Any], run_id: Optional[UUID] = None, **kwargs: Any, @@ -1848,7 +1848,7 @@ async def on_chain_start( """Async run when chain starts running. Args: - serialized (Dict[str, Any]): The serialized chain. + serialized (Optional[Dict[str, Any]]): The serialized chain. inputs (Union[Dict[str, Any], Any]): The inputs to the chain. run_id (UUID, optional): The ID of the run. Defaults to None. **kwargs (Any): Additional keyword arguments. @@ -1886,7 +1886,7 @@ async def on_chain_start( async def on_tool_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], input_str: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, @@ -1895,7 +1895,7 @@ async def on_tool_start( """Run when the tool starts running. Args: - serialized (Dict[str, Any]): The serialized tool. + serialized (Optional[Dict[str, Any]]): The serialized tool. input_str (str): The input to the tool. run_id (UUID, optional): The ID of the run. Defaults to None. parent_run_id (UUID, optional): The ID of the parent run. @@ -1975,7 +1975,7 @@ async def on_custom_event( async def on_retriever_start( self, - serialized: Dict[str, Any], + serialized: Optional[Dict[str, Any]], query: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, @@ -1984,7 +1984,7 @@ async def on_retriever_start( """Run when the retriever starts running. Args: - serialized (Dict[str, Any]): The serialized retriever. + serialized (Optional[Dict[str, Any]]): The serialized retriever. query (str): The query. run_id (UUID, optional): The ID of the run. Defaults to None. parent_run_id (UUID, optional): The ID of the parent run. Defaults to None. diff --git a/libs/core/langchain_core/prompts/base.py b/libs/core/langchain_core/prompts/base.py index 5b4951e6d1a4a..bacffe2e7db59 100644 --- a/libs/core/langchain_core/prompts/base.py +++ b/libs/core/langchain_core/prompts/base.py @@ -19,6 +19,7 @@ import yaml +from langchain_core.load import dumpd from langchain_core.output_parsers.base import BaseOutputParser from langchain_core.prompt_values import ( ChatPromptValueConcrete, @@ -188,6 +189,7 @@ def invoke( input, config, run_type="prompt", + serialized=dumpd(self), ) async def ainvoke( @@ -212,6 +214,7 @@ async def ainvoke( input, config, run_type="prompt", + serialized=dumpd(self), ) @abstractmethod diff --git a/libs/core/langchain_core/retrievers.py b/libs/core/langchain_core/retrievers.py index 2e51a95897961..1785c19ebe439 100644 --- a/libs/core/langchain_core/retrievers.py +++ b/libs/core/langchain_core/retrievers.py @@ -30,7 +30,6 @@ from langchain_core._api import deprecated from langchain_core.documents import Document -from langchain_core.load.dump import dumpd from langchain_core.runnables import ( Runnable, RunnableConfig, @@ -235,9 +234,9 @@ def invoke( local_metadata=self.metadata, ) run_manager = callback_manager.on_retriever_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=kwargs.pop("run_id", None), ) try: @@ -298,9 +297,9 @@ async def ainvoke( local_metadata=self.metadata, ) run_manager = await callback_manager.on_retriever_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=kwargs.pop("run_id", None), ) try: diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py index 21ec7caad386c..5ace57e763416 100644 --- a/libs/core/langchain_core/runnables/base.py +++ b/libs/core/langchain_core/runnables/base.py @@ -38,7 +38,6 @@ from typing_extensions import Literal, get_args from langchain_core._api import beta_decorator -from langchain_core.load.dump import dumpd from langchain_core.load.serializable import ( Serializable, SerializedConstructor, @@ -1763,6 +1762,7 @@ def _call_with_config( input: Input, config: Optional[RunnableConfig], run_type: Optional[str] = None, + serialized: Optional[Dict[str, Any]] = None, **kwargs: Optional[Any], ) -> Output: """Helper method to transform an Input value to an Output value, @@ -1770,7 +1770,7 @@ def _call_with_config( config = ensure_config(config) callback_manager = get_callback_manager_for_config(config) run_manager = callback_manager.on_chain_start( - dumpd(self), + serialized, input, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -1811,6 +1811,7 @@ async def _acall_with_config( input: Input, config: Optional[RunnableConfig], run_type: Optional[str] = None, + serialized: Optional[Dict[str, Any]] = None, **kwargs: Optional[Any], ) -> Output: """Helper method to transform an Input value to an Output value, @@ -1818,7 +1819,7 @@ async def _acall_with_config( config = ensure_config(config) callback_manager = get_async_callback_manager_for_config(config) run_manager = await callback_manager.on_chain_start( - dumpd(self), + serialized, input, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -1871,7 +1872,7 @@ def _batch_with_config( callback_managers = [get_callback_manager_for_config(c) for c in configs] run_managers = [ callback_manager.on_chain_start( - dumpd(self), + None, input, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -1944,7 +1945,7 @@ async def _abatch_with_config( run_managers: List[AsyncCallbackManagerForChainRun] = await asyncio.gather( *( callback_manager.on_chain_start( - dumpd(self), + None, input, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -2023,7 +2024,7 @@ def _transform_stream_with_config( config = ensure_config(config) callback_manager = get_callback_manager_for_config(config) run_manager = callback_manager.on_chain_start( - dumpd(self), + None, {"input": ""}, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -2123,7 +2124,7 @@ async def _atransform_stream_with_config( config = ensure_config(config) callback_manager = get_async_callback_manager_for_config(config) run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, {"input": ""}, run_type=run_type, name=config.get("run_name") or self.get_name(), @@ -2325,7 +2326,6 @@ def to_json(self) -> Union[SerializedConstructor, SerializedNotImplemented]: dumped = super().to_json() try: dumped["name"] = self.get_name() - dumped["graph"] = self.get_graph().to_json() except Exception: pass return dumped @@ -2857,7 +2857,7 @@ def invoke( callback_manager = get_callback_manager_for_config(config) # start the root run run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), @@ -2897,7 +2897,7 @@ async def ainvoke( callback_manager = get_async_callback_manager_for_config(config) # start the root run run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), @@ -2962,7 +2962,7 @@ def batch( # start the root runs, one per input run_managers = [ cm.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), @@ -3089,7 +3089,7 @@ async def abatch( run_managers: List[AsyncCallbackManagerForChainRun] = await asyncio.gather( *( cm.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), @@ -3544,7 +3544,7 @@ def invoke( ) # start the root run run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), @@ -3596,7 +3596,7 @@ async def ainvoke( callback_manager = get_async_callback_manager_for_config(config) # start the root run run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), diff --git a/libs/core/langchain_core/runnables/branch.py b/libs/core/langchain_core/runnables/branch.py index 9b52d04091b5f..61c7f583103ea 100644 --- a/libs/core/langchain_core/runnables/branch.py +++ b/libs/core/langchain_core/runnables/branch.py @@ -14,7 +14,6 @@ cast, ) -from langchain_core.load.dump import dumpd from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables.base import ( Runnable, @@ -207,9 +206,9 @@ def invoke( config = ensure_config(config) callback_manager = get_callback_manager_for_config(config) run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) @@ -246,7 +245,7 @@ def invoke( except BaseException as e: run_manager.on_chain_error(e) raise - run_manager.on_chain_end(dumpd(output)) + run_manager.on_chain_end(output) return output async def ainvoke( @@ -256,9 +255,9 @@ async def ainvoke( config = ensure_config(config) callback_manager = get_async_callback_manager_for_config(config) run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) try: @@ -294,7 +293,7 @@ async def ainvoke( except BaseException as e: await run_manager.on_chain_error(e) raise - await run_manager.on_chain_end(dumpd(output)) + await run_manager.on_chain_end(output) return output def stream( @@ -320,9 +319,9 @@ def stream( config = ensure_config(config) callback_manager = get_callback_manager_for_config(config) run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) final_output: Optional[Output] = None @@ -407,9 +406,9 @@ async def astream( config = ensure_config(config) callback_manager = get_async_callback_manager_for_config(config) run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) final_output: Optional[Output] = None diff --git a/libs/core/langchain_core/runnables/fallbacks.py b/libs/core/langchain_core/runnables/fallbacks.py index e3a1b2b1cfb33..6d57bbe2fe615 100644 --- a/libs/core/langchain_core/runnables/fallbacks.py +++ b/libs/core/langchain_core/runnables/fallbacks.py @@ -18,7 +18,6 @@ cast, ) -from langchain_core.load.dump import dumpd from langchain_core.pydantic_v1 import BaseModel from langchain_core.runnables.base import Runnable, RunnableSerializable from langchain_core.runnables.config import ( @@ -163,9 +162,9 @@ def invoke( callback_manager = get_callback_manager_for_config(config) # start the root run run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) first_error = None @@ -214,9 +213,9 @@ async def ainvoke( callback_manager = get_async_callback_manager_for_config(config) # start the root run run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) @@ -287,9 +286,9 @@ def batch( # start the root runs, one per input run_managers = [ cm.on_chain_start( - dumpd(self), + None, input if isinstance(input, dict) else {"input": input}, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) for cm, input, config in zip(callback_managers, inputs, configs) @@ -380,9 +379,9 @@ async def abatch( run_managers: List[AsyncCallbackManagerForChainRun] = await asyncio.gather( *( cm.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) for cm, input, config in zip(callback_managers, inputs, configs) @@ -458,9 +457,9 @@ def stream( callback_manager = get_callback_manager_for_config(config) # start the root run run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) first_error = None @@ -521,9 +520,9 @@ async def astream( callback_manager = get_async_callback_manager_for_config(config) # start the root run run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), run_id=config.pop("run_id", None), ) first_error = None diff --git a/libs/core/langchain_core/tracers/event_stream.py b/libs/core/langchain_core/tracers/event_stream.py index 62ee2466759fa..a34a5e3528f00 100644 --- a/libs/core/langchain_core/tracers/event_stream.py +++ b/libs/core/langchain_core/tracers/event_stream.py @@ -73,14 +73,15 @@ class RunInfo(TypedDict): parent_run_id: Optional[UUID] -def _assign_name(name: Optional[str], serialized: Dict[str, Any]) -> str: +def _assign_name(name: Optional[str], serialized: Optional[Dict[str, Any]]) -> str: """Assign a name to a run.""" if name is not None: return name - if "name" in serialized: - return serialized["name"] - elif "id" in serialized: - return serialized["id"][-1] + if serialized is not None: + if "name" in serialized: + return serialized["name"] + elif "id" in serialized: + return serialized["id"][-1] return "Unnamed" diff --git a/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr b/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr index 901b35e75c719..1e3bd9dee4d3c 100644 --- a/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +++ b/libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr @@ -1236,43 +1236,6 @@ # --- # name: test_chat_prompt_w_msgs_placeholder_ser_des[chat_prompt] dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'chat', - 'ChatPromptTemplate', - ]), - 'name': 'ChatPromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ChatPromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1293,43 +1256,6 @@ ]), 'kwargs': dict({ 'prompt': dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1372,43 +1298,6 @@ ]), 'kwargs': dict({ 'prompt': dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1453,43 +1342,6 @@ # --- # name: test_chat_tmpl_serdes dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'chat', - 'ChatPromptTemplate', - ]), - 'name': 'ChatPromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ChatPromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1514,43 +1366,6 @@ ]), 'kwargs': dict({ 'prompt': dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1582,43 +1397,6 @@ 'kwargs': dict({ 'prompt': list([ dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1650,43 +1428,6 @@ ]), 'kwargs': dict({ 'prompt': dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1718,43 +1459,6 @@ 'kwargs': dict({ 'prompt': list([ dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1772,43 +1476,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1826,43 +1493,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'prompt', - 'PromptTemplate', - ]), - 'name': 'PromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'PromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1880,43 +1510,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1936,43 +1529,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -1992,43 +1548,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -2048,43 +1567,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -2105,43 +1587,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -2160,43 +1605,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', @@ -2215,43 +1623,6 @@ 'type': 'constructor', }), dict({ - 'graph': dict({ - 'edges': list([ - dict({ - 'source': 0, - 'target': 1, - }), - dict({ - 'source': 1, - 'target': 2, - }), - ]), - 'nodes': list([ - dict({ - 'data': 'PromptInput', - 'id': 0, - 'type': 'schema', - }), - dict({ - 'data': dict({ - 'id': list([ - 'langchain', - 'prompts', - 'image', - 'ImagePromptTemplate', - ]), - 'name': 'ImagePromptTemplate', - }), - 'id': 1, - 'type': 'runnable', - }), - dict({ - 'data': 'ImagePromptTemplateOutput', - 'id': 2, - 'type': 'schema', - }), - ]), - }), 'id': list([ 'langchain', 'prompts', diff --git a/libs/core/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr b/libs/core/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr index 5161738472b57..a5e3dd8231817 100644 --- a/libs/core/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +++ b/libs/core/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr @@ -35,44 +35,7 @@ } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - } - ] - } + "name": "RunnableParallel" }, "last": { "lc": 1, @@ -110,44 +73,7 @@ "template": "what did baz say to {buz}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" }, "last": { "lc": 1, @@ -159,101 +85,10 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['foo'], i=1)", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" }, "fallbacks": [ { @@ -282,44 +117,7 @@ "template": "what did baz say to {buz}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" }, "last": { "lc": 1, @@ -331,101 +129,10 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['bar'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ], "exceptions_to_handle": [ @@ -440,101 +147,10 @@ } ] }, - "name": "RunnableWithFallbacks", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableWithFallbacks" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -571,85 +187,11 @@ "RunnablePassthrough" ], "kwargs": {}, - "name": "RunnablePassthrough", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PassthroughInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 2, - "type": "schema", - "data": "PassthroughOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnablePassthrough" } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - } - ] - } + "name": "RunnableParallel" }, "last": { "lc": 1, @@ -698,101 +240,10 @@ ], "exception_key": "exception" }, - "name": "RunnableWithFallbacks", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "_raise_error_input" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 2, - "type": "schema", - "data": "_raise_error_output" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableWithFallbacks" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 3, - "type": "schema", - "data": "_raise_error_output" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -818,44 +269,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['foo'], i=1)", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" }, "fallbacks": [ { @@ -868,44 +282,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['bar'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } ], "exceptions_to_handle": [ @@ -920,44 +297,7 @@ } ] }, - "name": "RunnableWithFallbacks", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableWithFallbacks" } ''' # --- @@ -983,44 +323,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['foo'], i=1)", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" }, "fallbacks": [ { @@ -1033,44 +336,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['baz'], i=1)", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" }, { "lc": 1, @@ -1082,44 +348,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['bar'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } ], "exceptions_to_handle": [ @@ -1134,44 +363,7 @@ } ] }, - "name": "RunnableWithFallbacks", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnableWithFallbacks" - ], - "name": "WithFallbacks" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableWithFallbacks" } ''' # --- diff --git a/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr b/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr index c75e39a78ef1d..985ab3f48ce16 100644 --- a/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +++ b/libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr @@ -49,44 +49,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -116,87 +79,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -209,44 +98,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo, bar'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } ], "last": { @@ -259,118 +111,10 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 4, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -436,44 +180,7 @@ "template": "You are a nicer assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -503,87 +210,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, { "lc": 1, @@ -595,44 +228,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['baz, qux'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } ], "last": { @@ -645,135 +241,10 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "LambdaInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 5, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 3, - "target": 4 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -827,44 +298,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -894,87 +328,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -987,44 +347,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo, bar'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" }, { "lc": 1, @@ -1036,44 +359,7 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" }, { "lc": 1, @@ -1124,44 +410,7 @@ "template": "You are a nicer assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -1191,87 +440,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, { "lc": 1, @@ -1283,44 +458,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['baz, qux'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } ], "last": { @@ -1333,192 +471,16 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 5, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 7, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 8, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 3, - "target": 4 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 5, - "target": 6 - }, - { - "source": 7, - "target": 8 - }, - { - "source": 6, - "target": 7 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_combining_sequences.3 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'repr': "RunnableLambda(lambda x: {'question': x[0] + x[1]})"}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nicer assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['baz, qux'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 4, 'type': 'runnable', 'data': {'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'name': 'Lambda'}}, {'id': 5, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 6, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 7, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 8, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 2, 'target': 3}, {'source': 3, 'target': 4}, {'source': 4, 'target': 5}, {'source': 5, 'target': 6}, {'source': 7, 'target': 8}, {'source': 6, 'target': 7}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['baz', 'qux']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo, bar'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo, bar', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo, bar', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='foo, bar', id='00000000-0000-4000-8000-000000000004')}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003'), Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='RunnableLambda', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'repr': "RunnableLambda(lambda x: {'question': x[0] + x[1]})"}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': ['foo', 'bar']}, outputs={'question': 'foobar'}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:4'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000005'), Run(id=UUID('00000000-0000-4000-8000-000000000006'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nicer assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'foobar'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nicer assistant.'), HumanMessage(content='foobar')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:5'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000006'), Run(id=UUID('00000000-0000-4000-8000-000000000007'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['baz, qux'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['baz, qux'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nicer assistant.\nHuman: foobar']}, outputs={'generations': [[{'text': 'baz, qux', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'baz, qux', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000006-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:6'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000007'), Run(id=UUID('00000000-0000-4000-8000-000000000008'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='baz, qux', id='00000000-0000-4000-8000-000000000009')}, outputs={'output': ['baz', 'qux']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:7'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000008')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['baz', 'qux']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo, bar'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo, bar', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo, bar', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='foo, bar', id='00000000-0000-4000-8000-000000000004')}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003'), Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='RunnableLambda', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': ['foo', 'bar']}, outputs={'question': 'foobar'}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:4'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000005'), Run(id=UUID('00000000-0000-4000-8000-000000000006'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nicer assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'foobar'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nicer assistant.'), HumanMessage(content='foobar')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:5'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000006'), Run(id=UUID('00000000-0000-4000-8000-000000000007'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['baz, qux'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['baz, qux'])", 'name': 'FakeListChatModel'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nicer assistant.\nHuman: foobar']}, outputs={'generations': [[{'text': 'baz, qux', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'baz, qux', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000006-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:6'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000007'), Run(id=UUID('00000000-0000-4000-8000-000000000008'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='baz, qux', id='00000000-0000-4000-8000-000000000009')}, outputs={'output': ['baz', 'qux']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:7'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000008')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_each @@ -1571,44 +533,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -1638,87 +563,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -1731,44 +582,7 @@ "FakeStreamingListLLM" ], "repr": "FakeStreamingListLLM(responses=['first item, second item, third item'])", - "name": "FakeStreamingListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeStreamingListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeStreamingListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeStreamingListLLM" }, { "lc": 1, @@ -1781,45 +595,7 @@ "FakeSplitIntoListParser" ], "kwargs": {}, - "name": "FakeSplitIntoListParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeSplitIntoListParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeSplitIntoListParser" - ], - "name": "FakeSplitIntoListParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeSplitIntoListParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeSplitIntoListParser" } ], "last": { @@ -1842,176 +618,13 @@ "FakeStreamingListLLM" ], "repr": "FakeStreamingListLLM(responses=['this', 'is', 'a', 'test'])", - "name": "FakeStreamingListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeStreamingListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeStreamingListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeStreamingListLLM" } }, - "name": "RunnableEach", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeStreamingListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeStreamingListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableEach" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeSplitIntoListParser" - ], - "name": "FakeSplitIntoListParser" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 5, - "type": "schema", - "data": "FakeStreamingListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 3, - "target": 4 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -2073,106 +686,11 @@ } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - } - ] - } + "name": "RunnableParallel" } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - } - ] - } + "name": "RunnableParallel" }, "last": { "lc": 1, @@ -2186,155 +704,7 @@ "repr": "RunnableLambda(router)" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 4, - "type": "schema", - "data": "router_input" - }, - { - "id": 5, - "type": "schema", - "data": "router_output" - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 7, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 8, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 9, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - }, - { - "source": 6, - "target": 7 - }, - { - "source": 4, - "target": 6 - }, - { - "source": 7, - "target": 5 - }, - { - "source": 8, - "target": 9 - }, - { - "source": 4, - "target": 8 - }, - { - "source": 9, - "target": 5 - }, - { - "source": 1, - "target": 4 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -2394,44 +764,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -2461,87 +794,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "last": { "lc": 1, @@ -2553,107 +812,16 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_chat_model.2 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 3, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 2, 'target': 3}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': AIMessage(content='foo', id='00000000-0000-4000-8000-000000000003')}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': AIMessage(content='foo', id='00000000-0000-4000-8000-000000000003')}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_chat_model_and_parser @@ -2706,44 +874,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -2773,87 +904,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -2866,44 +923,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo, bar'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } ], "last": { @@ -2916,124 +936,16 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 4, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_chat_model_and_parser.1 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 4, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 3, 'target': 4}, {'source': 2, 'target': 3}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo, bar'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo, bar', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo, bar', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='foo, bar', id='00000000-0000-4000-8000-000000000004')}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo, bar'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo, bar'])", 'name': 'FakeListChatModel'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo, bar', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo, bar', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': AIMessage(content='foo, bar', id='00000000-0000-4000-8000-000000000004')}, outputs={'output': ['foo', 'bar']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_chat_model_async @@ -3092,44 +1004,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -3159,87 +1034,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "last": { "lc": 1, @@ -3251,107 +1052,16 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_chat_model_async.2 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 3, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 2, 'target': 3}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': AIMessage(content='foo', id='00000000-0000-4000-8000-000000000003')}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListChatModelInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'name': 'FakeListChatModel'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListChatModelOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': AIMessage(content='foo', id='00000000-0000-4000-8000-000000000003')}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListChatModel', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo'], '_type': 'fake-list-chat-model', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelistchatmodel', 'ls_model_type': 'chat'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake_chat_models', 'FakeListChatModel'], 'repr': "FakeListChatModel(responses=['foo'])", 'name': 'FakeListChatModel'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'ChatGeneration', 'message': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'messages', 'AIMessage'], 'kwargs': {'content': 'foo', 'type': 'ai', 'id': 'run-00000000-0000-4000-8000-000000000002-0', 'tool_calls': [], 'invalid_tool_calls': []}}}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_llm @@ -3404,44 +1114,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -3471,87 +1144,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "last": { "lc": 1, @@ -3563,113 +1162,22 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['foo', 'bar'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_llm.1 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 3, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 2, 'target': 3}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_llm.2 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 3, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 2, 'target': 3}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'bar'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'bar', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), - Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 3, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 2, 'target': 3}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000004'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your favorite color?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000003'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003.20230101T000000000000Z00000000-0000-4000-8000-000000000004'), Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your favorite color?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000003'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003.20230101T000000000000Z00000000-0000-4000-8000-000000000005')], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'bar'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'bar', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000004'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your favorite color?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000003'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003.20230101T000000000000Z00000000-0000-4000-8000-000000000004'), Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'], i=1)", 'name': 'FakeListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your favorite color?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000003'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003.20230101T000000000000Z00000000-0000-4000-8000-000000000005')], trace_id=UUID('00000000-0000-4000-8000-000000000003'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000003'), ]) # --- # name: test_prompt_with_llm_and_async_lambda @@ -3722,44 +1230,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -3789,87 +1260,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -3882,44 +1279,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['foo', 'bar'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } ], "last": { @@ -3934,84 +1294,13 @@ "repr": "RunnableLambda(afunc=passthrough)" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "passthrough" - } - }, - { - "id": 4, - "type": "schema", - "data": "passthrough_output" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_llm_and_async_lambda.1 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'repr': 'RunnableLambda(afunc=passthrough)'}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'name': 'passthrough'}}, {'id': 4, 'type': 'schema', 'data': 'passthrough_output'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 3, 'target': 4}, {'source': 2, 'target': 3}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'name': 'FakeListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='passthrough', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'runnables', 'base', 'RunnableLambda'], 'repr': 'RunnableLambda(afunc=passthrough)'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'foo'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['foo', 'bar'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakelist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeListLLM'], 'repr': "FakeListLLM(responses=['foo', 'bar'])", 'name': 'FakeListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'foo', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='passthrough', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'foo'}, outputs={'output': 'foo'}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_llm_parser @@ -4064,44 +1353,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -4131,87 +1383,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -4224,44 +1402,7 @@ "FakeStreamingListLLM" ], "repr": "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'])", - "name": "FakeStreamingListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeStreamingListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeStreamingListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeStreamingListLLM" } ], "last": { @@ -4274,130 +1415,22 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeStreamingListLLM" - ], - "name": "FakeStreamingListLLM" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 4, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- # name: test_prompt_with_llm_parser.1 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'])", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 4, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 3, 'target': 4}, {'source': 2, 'target': 3}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'])", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'bear, dog, cat', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'bear, dog, cat'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 1, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'])", 'name': 'FakeStreamingListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'bear, dog, cat', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'bear, dog, cat'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), ]) # --- # name: test_prompt_with_llm_parser.2 list([ - Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 4, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 3, 'target': 4}, {'source': 2, 'target': 3}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['tomato', 'lettuce', 'onion']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'tomato, lettuce, onion', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'tomato, lettuce, onion'}, outputs={'output': ['tomato', 'lettuce', 'onion']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), - Run(id=UUID('00000000-0000-4000-8000-000000000004'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'schema', 'runnable', 'RunnableSequence'], 'kwargs': {'first': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, 'middle': [{'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}], 'last': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}, 'name': 'RunnableSequence', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 3, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 4, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}, {'source': 3, 'target': 4}, {'source': 2, 'target': 3}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'name': 'PromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'PromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}}}]}, 'name': 'ChatPromptTemplate', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'PromptInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'name': 'ChatPromptTemplate'}}, {'id': 2, 'type': 'schema', 'data': 'ChatPromptTemplateOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your favorite color?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000005'), Run(id=UUID('00000000-0000-4000-8000-000000000006'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'FakeStreamingListLLMInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'name': 'FakeStreamingListLLM'}}, {'id': 2, 'type': 'schema', 'data': 'FakeStreamingListLLMOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your favorite color?']}, outputs={'generations': [[{'text': 'bear, dog, cat', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000006'), Run(id=UUID('00000000-0000-4000-8000-000000000007'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'kwargs': {}, 'name': 'CommaSeparatedListOutputParser', 'graph': {'nodes': [{'id': 0, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserInput'}, {'id': 1, 'type': 'runnable', 'data': {'id': ['langchain', 'output_parsers', 'list', 'CommaSeparatedListOutputParser'], 'name': 'CommaSeparatedListOutputParser'}}, {'id': 2, 'type': 'schema', 'data': 'CommaSeparatedListOutputParserOutput'}], 'edges': [{'source': 0, 'target': 1}, {'source': 1, 'target': 2}]}}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'bear, dog, cat'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000007')], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004'), + Run(id=UUID('00000000-0000-4000-8000-000000000000'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ['tomato', 'lettuce', 'onion']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000001'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your name?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your name?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000001'), Run(id=UUID('00000000-0000-4000-8000-000000000002'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your name?']}, outputs={'generations': [[{'text': 'tomato, lettuce, onion', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000002'), Run(id=UUID('00000000-0000-4000-8000-000000000003'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'tomato, lettuce, onion'}, outputs={'output': ['tomato', 'lettuce', 'onion']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000000'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000.20230101T000000000000Z00000000-0000-4000-8000-000000000003')], trace_id=UUID('00000000-0000-4000-8000-000000000000'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000000'), + Run(id=UUID('00000000-0000-4000-8000-000000000004'), name='RunnableSequence', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='chain', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=None, tags=[], child_runs=[Run(id=UUID('00000000-0000-4000-8000-000000000005'), name='ChatPromptTemplate', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='prompt', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized={'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'ChatPromptTemplate'], 'kwargs': {'input_variables': ['question'], 'messages': [{'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'SystemMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': [], 'template': 'You are a nice assistant.', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}, {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'chat', 'HumanMessagePromptTemplate'], 'kwargs': {'prompt': {'lc': 1, 'type': 'constructor', 'id': ['langchain', 'prompts', 'prompt', 'PromptTemplate'], 'kwargs': {'input_variables': ['question'], 'template': '{question}', 'template_format': 'f-string'}, 'name': 'PromptTemplate'}}}]}, 'name': 'ChatPromptTemplate'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'question': 'What is your favorite color?'}, outputs={'output': ChatPromptValue(messages=[SystemMessage(content='You are a nice assistant.'), HumanMessage(content='What is your favorite color?')])}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:1'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000005'), Run(id=UUID('00000000-0000-4000-8000-000000000006'), name='FakeStreamingListLLM', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='llm', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={'invocation_params': {'responses': ['bear, dog, cat', 'tomato, lettuce, onion'], '_type': 'fake-list', 'stop': None}, 'options': {'stop': None}, 'batch_size': 2, 'metadata': {'ls_provider': 'fakestreaminglist', 'ls_model_type': 'llm'}}, error=None, serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain_core', 'language_models', 'fake', 'FakeStreamingListLLM'], 'repr': "FakeStreamingListLLM(responses=['bear, dog, cat', 'tomato, lettuce, onion'], i=1)", 'name': 'FakeStreamingListLLM'}, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'prompts': ['System: You are a nice assistant.\nHuman: What is your favorite color?']}, outputs={'generations': [[{'text': 'bear, dog, cat', 'generation_info': None, 'type': 'Generation'}]], 'llm_output': None, 'run': None}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:2'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000006'), Run(id=UUID('00000000-0000-4000-8000-000000000007'), name='CommaSeparatedListOutputParser', start_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), run_type='parser', end_time=FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), extra={}, error=None, serialized=None, events=[{'name': 'start', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}, {'name': 'end', 'time': FakeDatetime(2023, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)}], inputs={'input': 'bear, dog, cat'}, outputs={'output': ['bear', 'dog', 'cat']}, reference_example_id=None, parent_run_id=UUID('00000000-0000-4000-8000-000000000004'), tags=['seq:step:3'], child_runs=[], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004.20230101T000000000000Z00000000-0000-4000-8000-000000000007')], trace_id=UUID('00000000-0000-4000-8000-000000000004'), dotted_order='20230101T000000000000Z00000000-0000-4000-8000-000000000004'), ]) # --- # name: test_router_runnable @@ -4458,106 +1491,11 @@ } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - } - ] - } + "name": "RunnableParallel" } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - } - ] - } + "name": "RunnableParallel" }, "last": { "lc": 1, @@ -4620,87 +1558,13 @@ "template": "You are a math genius. Answer the question: {question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "last": { "lc": 1, @@ -4712,101 +1576,10 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['4'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" }, "english": { "lc": 1, @@ -4858,87 +1631,13 @@ "template": "You are an english major. Answer the question: {question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "last": { "lc": 1, @@ -4950,229 +1649,17 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=['2'])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" } } }, - "name": "RouterRunnable", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "RouterRunnableInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RouterRunnable" - ], - "name": "RouterRunnable" - } - }, - { - "id": 2, - "type": "schema", - "data": "RouterRunnableOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RouterRunnable" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RouterRunnable" - ], - "name": "RouterRunnable" - } - }, - { - "id": 5, - "type": "schema", - "data": "RouterRunnableOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 1, - "target": 4 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -10404,44 +6891,7 @@ "RunnablePassthrough" ], "kwargs": {}, - "name": "RunnablePassthrough", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PassthroughInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 2, - "type": "schema", - "data": "PassthroughOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnablePassthrough" }, "last": { "lc": 1, @@ -10455,61 +6905,7 @@ "repr": "RunnableLambda(...)" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PassthroughInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "schema", - "data": "LambdaOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" }, "documents": { "lc": 1, @@ -10543,103 +6939,10 @@ "FakeRetriever" ], "repr": "FakeRetriever()", - "name": "FakeRetriever", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeRetrieverInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeRetriever" - ], - "name": "FakeRetriever" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeRetrieverOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeRetriever" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "LambdaInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeRetriever" - ], - "name": "FakeRetriever" - } - }, - { - "id": 3, - "type": "schema", - "data": "FakeRetrieverOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 2, - "target": 3 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "RunnableSequence" }, "just_to_test_lambda": { "lc": 1, @@ -10654,121 +6957,7 @@ } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 5, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeRetriever" - ], - "name": "FakeRetriever" - } - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 2, - "target": 3 - }, - { - "source": 0, - "target": 2 - }, - { - "source": 3, - "target": 1 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 0, - "target": 4 - }, - { - "source": 5, - "target": 1 - }, - { - "source": 0, - "target": 6 - }, - { - "source": 6, - "target": 1 - } - ] - } + "name": "RunnableParallel" }, "middle": [ { @@ -10810,44 +6999,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -10878,87 +7030,13 @@ "template": "Context:\n{documents}\n\nQuestion:\n{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, { "lc": 1, @@ -10970,44 +7048,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=['foo, bar'])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" } ], "last": { @@ -11020,221 +7061,10 @@ "CommaSeparatedListOutputParser" ], "kwargs": {}, - "name": "CommaSeparatedListOutputParser", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "CommaSeparatedListOutputParserInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 2, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "CommaSeparatedListOutputParser" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain", - "schema", - "runnable", - "RunnablePassthrough" - ], - "name": "Passthrough" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 5, - "type": "runnable", - "data": { - "id": [ - "tests", - "unit_tests", - "runnables", - "test_runnable", - "FakeRetriever" - ], - "name": "FakeRetriever" - } - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 7, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 8, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 9, - "type": "runnable", - "data": { - "id": [ - "langchain", - "output_parsers", - "list", - "CommaSeparatedListOutputParser" - ], - "name": "CommaSeparatedListOutputParser" - } - }, - { - "id": 10, - "type": "schema", - "data": "CommaSeparatedListOutputParserOutput" - } - ], - "edges": [ - { - "source": 2, - "target": 3 - }, - { - "source": 0, - "target": 2 - }, - { - "source": 3, - "target": 1 - }, - { - "source": 4, - "target": 5 - }, - { - "source": 0, - "target": 4 - }, - { - "source": 5, - "target": 1 - }, - { - "source": 0, - "target": 6 - }, - { - "source": 6, - "target": 1 - }, - { - "source": 1, - "target": 7 - }, - { - "source": 7, - "target": 8 - }, - { - "source": 9, - "target": 10 - }, - { - "source": 8, - "target": 9 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -11298,44 +7128,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -11364,88 +7157,14 @@ ], "template": "{question}", "template_format": "f-string" - }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } - } - } - } - ] - }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 + }, + "name": "PromptTemplate" + } + } } ] - } + }, + "name": "ChatPromptTemplate" }, "middle": [ { @@ -11481,44 +7200,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=[\"i'm a chatbot\"])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" }, "llm": { "lc": 1, @@ -11530,210 +7212,14 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=[\"i'm a textbot\"])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - } - ] - } + "name": "RunnableParallel" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 4, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 5, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 5 - }, - { - "source": 5, - "target": 4 - }, - { - "source": 3, - "target": 6 - }, - { - "source": 6, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- @@ -11787,44 +7273,7 @@ "template": "You are a nice assistant.", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } }, @@ -11854,87 +7303,13 @@ "template": "{question}", "template_format": "f-string" }, - "name": "PromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "prompt", - "PromptTemplate" - ], - "name": "PromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "PromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "PromptTemplate" } } } ] }, - "name": "ChatPromptTemplate", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "schema", - "data": "ChatPromptTemplateOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "ChatPromptTemplate" }, "middle": [ { @@ -11980,44 +7355,7 @@ "FakeListChatModel" ], "repr": "FakeListChatModel(responses=[\"i'm a chatbot\"])", - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" }, "kwargs": { "stop": [ @@ -12025,45 +7363,7 @@ ] } }, - "name": "FakeListChatModel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListChatModelInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - }, - "metadata": {} - }, - { - "id": 2, - "type": "schema", - "data": "FakeListChatModelOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListChatModel" }, "llm": { "lc": 1, @@ -12075,44 +7375,7 @@ "FakeListLLM" ], "repr": "FakeListLLM(responses=[\"i'm a textbot\"])", - "name": "FakeListLLM", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "FakeListLLMInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 2, - "type": "schema", - "data": "FakeListLLMOutput" - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - } - ] - } + "name": "FakeListLLM" }, "passthrough": { "lc": 1, @@ -12127,213 +7390,10 @@ } } }, - "name": "RunnableParallel", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 1, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - }, - "metadata": {} - }, - { - "id": 3, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 4, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 2 - }, - { - "source": 2, - "target": 1 - }, - { - "source": 0, - "target": 3 - }, - { - "source": 3, - "target": 1 - }, - { - "source": 0, - "target": 4 - }, - { - "source": 4, - "target": 1 - } - ] - } + "name": "RunnableParallel" } }, - "name": "RunnableSequence", - "graph": { - "nodes": [ - { - "id": 0, - "type": "schema", - "data": "PromptInput" - }, - { - "id": 1, - "type": "runnable", - "data": { - "id": [ - "langchain", - "prompts", - "chat", - "ChatPromptTemplate" - ], - "name": "ChatPromptTemplate" - } - }, - { - "id": 2, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - }, - { - "id": 3, - "type": "schema", - "data": "ParallelInput" - }, - { - "id": 4, - "type": "schema", - "data": "ParallelOutput" - }, - { - "id": 5, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake_chat_models", - "FakeListChatModel" - ], - "name": "FakeListChatModel" - }, - "metadata": {} - }, - { - "id": 6, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "language_models", - "fake", - "FakeListLLM" - ], - "name": "FakeListLLM" - } - }, - { - "id": 7, - "type": "runnable", - "data": { - "id": [ - "langchain_core", - "runnables", - "base", - "RunnableLambda" - ], - "name": "Lambda" - } - } - ], - "edges": [ - { - "source": 0, - "target": 1 - }, - { - "source": 1, - "target": 2 - }, - { - "source": 3, - "target": 5 - }, - { - "source": 5, - "target": 4 - }, - { - "source": 3, - "target": 6 - }, - { - "source": 6, - "target": 4 - }, - { - "source": 3, - "target": 7 - }, - { - "source": 7, - "target": 4 - }, - { - "source": 2, - "target": 3 - } - ] - } + "name": "RunnableSequence" } ''' # --- diff --git a/libs/core/tests/unit_tests/runnables/test_runnable.py b/libs/core/tests/unit_tests/runnables/test_runnable.py index 242a59d65e8d2..daba2beec28c2 100644 --- a/libs/core/tests/unit_tests/runnables/test_runnable.py +++ b/libs/core/tests/unit_tests/runnables/test_runnable.py @@ -2520,7 +2520,7 @@ async def test_stream_log_retriever() -> None: "ChatPromptTemplate", "FakeListLLM", "FakeListLLM:2", - "Retriever", + "FakeRetriever", "RunnableLambda", "RunnableParallel", "RunnableParallel", diff --git a/libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py b/libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py index c2230f560a5fa..74a5c27a71d6b 100644 --- a/libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py +++ b/libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py @@ -1280,7 +1280,7 @@ def format_docs(docs: List[Document]) -> str: "data": {"input": {"query": "hello"}}, "event": "on_retriever_start", "metadata": {}, - "name": "Retriever", + "name": "HardCodedRetriever", "run_id": "", "parent_ids": [], "tags": ["seq:step:1"], @@ -1302,7 +1302,7 @@ def format_docs(docs: List[Document]) -> str: }, "event": "on_retriever_end", "metadata": {}, - "name": "Retriever", + "name": "HardCodedRetriever", "run_id": "", "parent_ids": [], "tags": ["seq:step:1"], diff --git a/libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py b/libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py index 59fc49ca5eab9..e021dce177daf 100644 --- a/libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py +++ b/libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py @@ -23,7 +23,6 @@ from langchain_core.chat_history import BaseChatMessageHistory from langchain_core.documents import Document from langchain_core.language_models import FakeStreamingListLLM, GenericFakeChatModel -from langchain_core.load import dumpd from langchain_core.messages import ( AIMessage, AIMessageChunk, @@ -2080,7 +2079,7 @@ async def astream( config = ensure_config(config) callback_manager = get_callback_manager_for_config(config) run_manager = callback_manager.on_chain_start( - dumpd(self), + None, input, name=config.get("run_name", self.get_name()), run_id=config.get("run_id"), diff --git a/libs/langchain/langchain/chains/base.py b/libs/langchain/langchain/chains/base.py index 4c1dcc07eb231..d6b0e362b2d9b 100644 --- a/libs/langchain/langchain/chains/base.py +++ b/libs/langchain/langchain/chains/base.py @@ -18,7 +18,6 @@ CallbackManagerForChainRun, Callbacks, ) -from langchain_core.load.dump import dumpd from langchain_core.memory import BaseMemory from langchain_core.outputs import RunInfo from langchain_core.pydantic_v1 import BaseModel, Field, root_validator, validator @@ -143,7 +142,7 @@ def invoke( new_arg_supported = inspect.signature(self._call).parameters.get("run_manager") run_manager = callback_manager.on_chain_start( - dumpd(self), + None, inputs, run_id, name=run_name, @@ -195,7 +194,7 @@ async def ainvoke( ) new_arg_supported = inspect.signature(self._acall).parameters.get("run_manager") run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, inputs, run_id, name=run_name, diff --git a/libs/langchain/langchain/chains/llm.py b/libs/langchain/langchain/chains/llm.py index feb3468fc44e4..62de205347460 100644 --- a/libs/langchain/langchain/chains/llm.py +++ b/libs/langchain/langchain/chains/llm.py @@ -17,7 +17,6 @@ BaseLanguageModel, LanguageModelInput, ) -from langchain_core.load.dump import dumpd from langchain_core.messages import BaseMessage from langchain_core.output_parsers import BaseLLMOutputParser, StrOutputParser from langchain_core.outputs import ChatGeneration, Generation, LLMResult @@ -240,7 +239,7 @@ def apply( callbacks, self.callbacks, self.verbose ) run_manager = callback_manager.on_chain_start( - dumpd(self), + None, {"input_list": input_list}, ) try: @@ -260,7 +259,7 @@ async def aapply( callbacks, self.callbacks, self.verbose ) run_manager = await callback_manager.on_chain_start( - dumpd(self), + None, {"input_list": input_list}, ) try: diff --git a/libs/langchain/langchain/retrievers/ensemble.py b/libs/langchain/langchain/retrievers/ensemble.py index bf2cc46376c21..a7d96d0f171b9 100644 --- a/libs/langchain/langchain/retrievers/ensemble.py +++ b/libs/langchain/langchain/retrievers/ensemble.py @@ -24,7 +24,6 @@ CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document -from langchain_core.load.dump import dumpd from langchain_core.pydantic_v1 import root_validator from langchain_core.retrievers import BaseRetriever, RetrieverLike from langchain_core.runnables import RunnableConfig @@ -106,9 +105,9 @@ def invoke( local_metadata=self.metadata, ) run_manager = callback_manager.on_retriever_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), **kwargs, ) try: @@ -139,9 +138,9 @@ async def ainvoke( local_metadata=self.metadata, ) run_manager = await callback_manager.on_retriever_start( - dumpd(self), + None, input, - name=config.get("run_name"), + name=config.get("run_name") or self.get_name(), **kwargs, ) try: