MCPcopy
hub / github.com/langchain-ai/langchain / get_graph

Method get_graph

libs/core/langchain_core/runnables/base.py:391–407  ·  view source on GitHub ↗

Return a graph representation of this runnable.

(self, config: Optional[RunnableConfig] = None)

Source from the content-addressed store, hash-verified

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

Callers 12

get_promptsMethod · 0.95
test_graph_sequenceFunction · 0.45
test_graph_sequence_mapFunction · 0.45
to_jsonMethod · 0.45
get_graphMethod · 0.45
get_graphMethod · 0.45
get_graphMethod · 0.45
get_graphMethod · 0.45
get_graphMethod · 0.45

Calls 7

add_nodeMethod · 0.95
get_input_schemaMethod · 0.95
get_nameMethod · 0.95
get_output_schemaMethod · 0.95
add_edgeMethod · 0.95
GraphClass · 0.90
create_modelFunction · 0.90