mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-25 21:11:11 +08:00
docs: refactor examples
This commit is contained in:
parent
0631985e61
commit
c11fc28896
@ -40,6 +40,7 @@ robot_node = RobotsNode(
|
|||||||
fetch_node = FetchNode(
|
fetch_node = FetchNode(
|
||||||
input="url | local_dir",
|
input="url | local_dir",
|
||||||
output=["doc"],
|
output=["doc"],
|
||||||
|
node_config={"headless": True, "verbose": True}
|
||||||
)
|
)
|
||||||
parse_node = ParseNode(
|
parse_node = ParseNode(
|
||||||
input="doc",
|
input="doc",
|
||||||
|
|||||||
@ -52,11 +52,3 @@ print(result)
|
|||||||
|
|
||||||
graph_exec_info = smart_scraper_graph.get_execution_info()
|
graph_exec_info = smart_scraper_graph.get_execution_info()
|
||||||
print(prettify_exec_info(graph_exec_info))
|
print(prettify_exec_info(graph_exec_info))
|
||||||
|
|
||||||
|
|
||||||
# ************************************************
|
|
||||||
# Get graph execution info
|
|
||||||
# ************************************************
|
|
||||||
|
|
||||||
graph_exec_info = smart_scraper_graph.get_execution_info()
|
|
||||||
print(prettify_exec_info(graph_exec_info))
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ graph_config = {
|
|||||||
"api_key": openai_key,
|
"api_key": openai_key,
|
||||||
"model": "gpt-3.5-turbo",
|
"model": "gpt-3.5-turbo",
|
||||||
},
|
},
|
||||||
"library": "beautifoulsoup"
|
"library": "beautifulsoup"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ************************************************
|
# ************************************************
|
||||||
|
|||||||
@ -23,13 +23,14 @@ with open(file_path, 'r', encoding="utf-8") as file:
|
|||||||
# Define the configuration for the graph
|
# Define the configuration for the graph
|
||||||
# ************************************************
|
# ************************************************
|
||||||
|
|
||||||
gemini_key = os.getenv("GOOGLE_APIKEY")
|
openai_key = os.getenv("OPENAI_APIKEY")
|
||||||
|
|
||||||
graph_config = {
|
graph_config = {
|
||||||
"llm": {
|
"llm": {
|
||||||
"api_key": gemini_key,
|
"api_key": openai_key,
|
||||||
"model": "gpt-3.5-turbo",
|
"model": "gpt-3.5-turbo",
|
||||||
},
|
},
|
||||||
|
"verbose":False,
|
||||||
}
|
}
|
||||||
|
|
||||||
# ************************************************
|
# ************************************************
|
||||||
|
|||||||
@ -42,10 +42,12 @@ class ScriptCreatorGraph(AbstractGraph):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, prompt: str, source: str, config: dict):
|
def __init__(self, prompt: str, source: str, config: dict):
|
||||||
|
|
||||||
|
self.library = config['library']
|
||||||
|
|
||||||
super().__init__(prompt, config, source)
|
super().__init__(prompt, config, source)
|
||||||
|
|
||||||
self.input_key = "url" if source.startswith("http") else "local_dir"
|
self.input_key = "url" if source.startswith("http") else "local_dir"
|
||||||
self.library = config['library']
|
|
||||||
|
|
||||||
def _create_graph(self) -> BaseGraph:
|
def _create_graph(self) -> BaseGraph:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user