MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / TestGraph

Class TestGraph

tests/graphs/abstract_graph_test.py:78–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77
78class TestGraph(AbstractGraph):
79 def __init__(self, prompt: str, config: dict):
80 super().__init__(prompt, config)
81
82 def _create_graph(self) -> BaseGraph:
83 fetch_node = FetchNode(
84 input="url| local_dir",
85 output=["doc"],
86 node_config={
87 "llm_model": self.llm_model,
88 "force": self.config.get("force", False),
89 "cut": self.config.get("cut", True),
90 "loader_kwargs": self.config.get("loader_kwargs", {}),
91 "browser_base": self.config.get("browser_base"),
92 },
93 )
94 parse_node = ParseNode(
95 input="doc",
96 output=["parsed_doc"],
97 node_config={"llm_model": self.llm_model, "chunk_size": self.model_token},
98 )
99 return BaseGraph(
100 nodes=[fetch_node, parse_node],
101 edges=[
102 (fetch_node, parse_node),
103 ],
104 entry_point=fetch_node,
105 graph_name=self.__class__.__name__,
106 )
107
108 def run(self) -> str:
109 inputs = {"user_prompt": self.prompt, self.input_key: self.source}
110 self.final_state, self.execution_info = self.graph.execute(inputs)
111
112 return self.final_state.get("answer", "No answer found.")
113
114
115class TestAbstractGraph:

Callers 12

test_llm_missing_tokensFunction · 0.85
test_burr_kwargsFunction · 0.85
test_set_common_paramsFunction · 0.85
test_create_llmMethod · 0.85
test_run_safe_asyncMethod · 0.85
test_get_stateMethod · 0.85
test_append_nodeMethod · 0.85

Calls

no outgoing calls

Tested by 12

test_llm_missing_tokensFunction · 0.68
test_burr_kwargsFunction · 0.68
test_set_common_paramsFunction · 0.68
test_create_llmMethod · 0.68
test_run_safe_asyncMethod · 0.68
test_get_stateMethod · 0.68
test_append_nodeMethod · 0.68