Return a graph representation of this runnable.
(self, config: Optional[RunnableConfig] = None)
| 389 | ) |
| 390 | |
| 391 | def get_graph(self, config: Optional[RunnableConfig] = None) -> Graph: |
| 392 | """Return a graph representation of this runnable.""" |
| 393 | from langchain_core.runnables.graph import Graph |
| 394 | |
| 395 | graph = Graph() |
| 396 | try: |
| 397 | input_node = graph.add_node(self.get_input_schema(config)) |
| 398 | except TypeError: |
| 399 | input_node = graph.add_node(create_model(self.get_name("Input"))) |
| 400 | runnable_node = graph.add_node(self) |
| 401 | try: |
| 402 | output_node = graph.add_node(self.get_output_schema(config)) |
| 403 | except TypeError: |
| 404 | output_node = graph.add_node(create_model(self.get_name("Output"))) |
| 405 | graph.add_edge(input_node, runnable_node) |
| 406 | graph.add_edge(runnable_node, output_node) |
| 407 | return graph |
| 408 | |
| 409 | def get_prompts( |
| 410 | self, config: Optional[RunnableConfig] = None |