docs: refactor examples

This commit is contained in:
Marco Perini 2024-05-02 00:44:19 +02:00
parent 0631985e61
commit c11fc28896
5 changed files with 8 additions and 12 deletions

View File

@ -40,6 +40,7 @@ robot_node = RobotsNode(
fetch_node = FetchNode(
input="url | local_dir",
output=["doc"],
node_config={"headless": True, "verbose": True}
)
parse_node = ParseNode(
input="doc",

View File

@ -52,11 +52,3 @@ print(result)
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))

View File

@ -20,7 +20,7 @@ graph_config = {
"api_key": openai_key,
"model": "gpt-3.5-turbo",
},
"library": "beautifoulsoup"
"library": "beautifulsoup"
}
# ************************************************

View File

@ -23,13 +23,14 @@ with open(file_path, 'r', encoding="utf-8") as file:
# 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,
}
# ************************************************

View File

@ -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:
"""