Skip to content

fix: script creator multi #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/fireworks/script_multi_generator_fireworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
# ************************************************
# 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/",
]

# ************************************************
# Create the ScriptCreatorGraph instance and run it
# ************************************************

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
)
Expand Down
7 changes: 4 additions & 3 deletions examples/mistral/script_multi_generator_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
# ************************************************

urls=[
"https://perinim.github.io/",
"https://perinim.github.io/cv/"
"https://schultzbergagency.com/emil-raste-karlsen/",
"https://schultzbergagency.com/johanna-hedberg/",
]

# ************************************************
# Create the ScriptCreatorGraph instance and run it
# ************************************************

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
)
Expand Down
7 changes: 4 additions & 3 deletions examples/nemotron/script_multi_generator_nemotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
# ************************************************

urls=[
"https://perinim.github.io/",
"https://perinim.github.io/cv/"
"https://schultzbergagency.com/emil-raste-karlsen/",
"https://schultzbergagency.com/johanna-hedberg/",
]

# ************************************************
# Create the ScriptCreatorGraph instance and run it
# ************************************************

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
)
Expand Down
7 changes: 4 additions & 3 deletions examples/openai/script_multi_generator_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
# ************************************************

urls=[
"https://perinim.github.io/",
"https://perinim.github.io/cv/"
"https://schultzbergagency.com/emil-raste-karlsen/",
"https://schultzbergagency.com/johanna-hedberg/",
]

# ************************************************
# Create the ScriptCreatorGraph instance and run it
# ************************************************

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
)
Expand Down
2 changes: 0 additions & 2 deletions scrapegraphai/graphs/json_scraper_multi_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def __init__(self, prompt: str, source: List[str],
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)
Expand Down
2 changes: 1 addition & 1 deletion scrapegraphai/graphs/markdown_scraper_multi_graph.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 6 additions & 10 deletions scrapegraphai/graphs/script_creator_multi_graph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
ScriptCreatorMultiGraph Module
"""
from copy import deepcopy
from typing import List, Optional
from pydantic import BaseModel
from .base_graph import BaseGraph
Expand Down Expand Up @@ -45,7 +46,7 @@ def __init__(self, prompt: str, source: List[str],
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:
Expand All @@ -55,19 +56,14 @@ def _create_graph(self) -> BaseGraph:
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(
Expand Down
7 changes: 0 additions & 7 deletions scrapegraphai/graphs/smart_scraper_multi_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ def _create_graph(self) -> BaseGraph:
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"],
Expand Down
10 changes: 0 additions & 10 deletions scrapegraphai/graphs/xml_scraper_multi_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def __init__(self, prompt: str, source: List[str],
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:
Expand All @@ -57,14 +55,6 @@ def _create_graph(self) -> BaseGraph:
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"],
Expand Down
Loading