mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-01 21:00:48 +08:00
fix: script creator multi
This commit is contained in:
parent
c181fea3bd
commit
9905be8a37
@ -26,10 +26,9 @@ graph_config = {
|
||||
# ************************************************
|
||||
# Create the ScriptCreatorGraph instance and run it
|
||||
# ************************************************
|
||||
|
||||
urls=[
|
||||
"https://perinim.github.io/",
|
||||
"https://perinim.github.io/cv/"
|
||||
"https://schultzbergagency.com/emil-raste-karlsen/",
|
||||
"https://schultzbergagency.com/johanna-hedberg/",
|
||||
]
|
||||
|
||||
# ************************************************
|
||||
@ -37,7 +36,8 @@ urls=[
|
||||
# ************************************************
|
||||
|
||||
script_creator_graph = ScriptCreatorMultiGraph(
|
||||
prompt="Who is Marco Perini?",
|
||||
prompt="Find information about actors",
|
||||
# also accepts a string with the already downloaded HTML code
|
||||
source=urls,
|
||||
config=graph_config
|
||||
)
|
||||
|
||||
@ -29,8 +29,8 @@ graph_config = {
|
||||
# ************************************************
|
||||
|
||||
urls=[
|
||||
"https://perinim.github.io/",
|
||||
"https://perinim.github.io/cv/"
|
||||
"https://schultzbergagency.com/emil-raste-karlsen/",
|
||||
"https://schultzbergagency.com/johanna-hedberg/",
|
||||
]
|
||||
|
||||
# ************************************************
|
||||
@ -38,7 +38,8 @@ urls=[
|
||||
# ************************************************
|
||||
|
||||
script_creator_graph = ScriptCreatorMultiGraph(
|
||||
prompt="Who is Marco Perini?",
|
||||
prompt="Find information about actors",
|
||||
# also accepts a string with the already downloaded HTML code
|
||||
source=urls,
|
||||
config=graph_config
|
||||
)
|
||||
|
||||
@ -29,8 +29,8 @@ graph_config = {
|
||||
# ************************************************
|
||||
|
||||
urls=[
|
||||
"https://perinim.github.io/",
|
||||
"https://perinim.github.io/cv/"
|
||||
"https://schultzbergagency.com/emil-raste-karlsen/",
|
||||
"https://schultzbergagency.com/johanna-hedberg/",
|
||||
]
|
||||
|
||||
# ************************************************
|
||||
@ -38,7 +38,8 @@ urls=[
|
||||
# ************************************************
|
||||
|
||||
script_creator_graph = ScriptCreatorMultiGraph(
|
||||
prompt="Who is Marco Perini?",
|
||||
prompt="Find information about actors",
|
||||
# also accepts a string with the already downloaded HTML code
|
||||
source=urls,
|
||||
config=graph_config
|
||||
)
|
||||
|
||||
@ -29,8 +29,8 @@ graph_config = {
|
||||
# ************************************************
|
||||
|
||||
urls=[
|
||||
"https://perinim.github.io/",
|
||||
"https://perinim.github.io/cv/"
|
||||
"https://schultzbergagency.com/emil-raste-karlsen/",
|
||||
"https://schultzbergagency.com/johanna-hedberg/",
|
||||
]
|
||||
|
||||
# ************************************************
|
||||
@ -38,7 +38,8 @@ urls=[
|
||||
# ************************************************
|
||||
|
||||
script_creator_graph = ScriptCreatorMultiGraph(
|
||||
prompt="Who is Marco Perini?",
|
||||
prompt="Find information about actors",
|
||||
# also accepts a string with the already downloaded HTML code
|
||||
source=urls,
|
||||
config=graph_config
|
||||
)
|
||||
|
||||
@ -45,9 +45,7 @@ class JSONScraperMultiGraph(AbstractGraph):
|
||||
config: dict, schema: Optional[BaseModel] = None):
|
||||
|
||||
self.max_results = config.get("max_results", 3)
|
||||
|
||||
self.copy_config = safe_deepcopy(config)
|
||||
|
||||
self.copy_schema = deepcopy(schema)
|
||||
|
||||
super().__init__(prompt, config, source, schema)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"""
|
||||
MDScraperMultiGraph Module
|
||||
"""
|
||||
from copy import copy, deepcopy
|
||||
from copy import deepcopy
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel
|
||||
from .base_graph import BaseGraph
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
"""
|
||||
ScriptCreatorMultiGraph Module
|
||||
"""
|
||||
from copy import deepcopy
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel
|
||||
from .base_graph import BaseGraph
|
||||
@ -45,7 +46,7 @@ class ScriptCreatorMultiGraph(AbstractGraph):
|
||||
self.max_results = config.get("max_results", 3)
|
||||
|
||||
self.copy_config = safe_deepcopy(config)
|
||||
|
||||
self.copy_schema = deepcopy(schema)
|
||||
super().__init__(prompt, config, source, schema)
|
||||
|
||||
def _create_graph(self) -> BaseGraph:
|
||||
@ -55,19 +56,14 @@ class ScriptCreatorMultiGraph(AbstractGraph):
|
||||
BaseGraph: A graph instance representing the web scraping and searching workflow.
|
||||
"""
|
||||
|
||||
script_generator_instance = ScriptCreatorGraph(
|
||||
prompt="",
|
||||
source="",
|
||||
config=self.copy_config,
|
||||
schema=self.schema
|
||||
)
|
||||
|
||||
graph_iterator_node = GraphIteratorNode(
|
||||
input="user_prompt & urls",
|
||||
output=["scripts"],
|
||||
node_config={
|
||||
"graph_instance": script_generator_instance,
|
||||
}
|
||||
"graph_instance": ScriptCreatorGraph,
|
||||
"scraper_config": self.copy_config,
|
||||
},
|
||||
schema=self.copy_schema
|
||||
)
|
||||
|
||||
merge_scripts_node = MergeGeneratedScriptsNode(
|
||||
|
||||
@ -60,13 +60,6 @@ class SmartScraperMultiGraph(AbstractGraph):
|
||||
BaseGraph: A graph instance representing the web scraping and searching workflow.
|
||||
"""
|
||||
|
||||
# smart_scraper_instance = SmartScraperGraph(
|
||||
# prompt="",
|
||||
# source="",
|
||||
# config=self.copy_config,
|
||||
# schema=self.copy_schema
|
||||
# )
|
||||
|
||||
graph_iterator_node = GraphIteratorNode(
|
||||
input="user_prompt & urls",
|
||||
output=["results"],
|
||||
|
||||
@ -45,9 +45,7 @@ class XMLScraperMultiGraph(AbstractGraph):
|
||||
config: dict, schema: Optional[BaseModel] = None):
|
||||
|
||||
self.copy_config = safe_deepcopy(config)
|
||||
|
||||
self.copy_schema = deepcopy(schema)
|
||||
|
||||
super().__init__(prompt, config, source, schema)
|
||||
|
||||
def _create_graph(self) -> BaseGraph:
|
||||
@ -57,14 +55,6 @@ class XMLScraperMultiGraph(AbstractGraph):
|
||||
Returns:
|
||||
BaseGraph: A graph instance representing the web scraping and searching workflow.
|
||||
"""
|
||||
|
||||
# smart_scraper_instance = XMLScraperGraph(
|
||||
# prompt="",
|
||||
# source="",
|
||||
# config=self.copy_config,
|
||||
# schema=self.copy_schema
|
||||
# )
|
||||
|
||||
graph_iterator_node = GraphIteratorNode(
|
||||
input="user_prompt & jsons",
|
||||
output=["results"],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user