Skip to content

Commit

Permalink
docs: refactor examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PeriniM committed May 1, 2024
1 parent 0631985 commit c11fc28
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions examples/openai/custom_graph_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
fetch_node = FetchNode(
input="url | local_dir",
output=["doc"],
node_config={"headless": True, "verbose": True}
)
parse_node = ParseNode(
input="doc",
Expand Down
8 changes: 0 additions & 8 deletions examples/openai/scrape_plain_text_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,3 @@

graph_exec_info = smart_scraper_graph.get_execution_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))
2 changes: 1 addition & 1 deletion examples/openai/script_generator_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"api_key": openai_key,
"model": "gpt-3.5-turbo",
},
"library": "beautifoulsoup"
"library": "beautifulsoup"
}

# ************************************************
Expand Down
5 changes: 3 additions & 2 deletions examples/openai/xml_scraper_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
# Define the configuration for the graph
# ************************************************

gemini_key = os.getenv("GOOGLE_APIKEY")
openai_key = os.getenv("OPENAI_APIKEY")

graph_config = {
"llm": {
"api_key": gemini_key,
"api_key": openai_key,
"model": "gpt-3.5-turbo",
},
"verbose":False,
}

# ************************************************
Expand Down
4 changes: 3 additions & 1 deletion scrapegraphai/graphs/script_creator_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ class ScriptCreatorGraph(AbstractGraph):
"""

def __init__(self, prompt: str, source: str, config: dict):

self.library = config['library']

super().__init__(prompt, config, source)

self.input_key = "url" if source.startswith("http") else "local_dir"
self.library = config['library']

def _create_graph(self) -> BaseGraph:
"""
Expand Down

0 comments on commit c11fc28

Please sign in to comment.