Skip to content

feat: add adv #983

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 2 commits into from
Jun 7, 2025
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
5 changes: 5 additions & 0 deletions scrapegraphai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
__init__.py file for scrapegraphai folder
"""

from .utils.logging import get_logger, set_verbosity_info

logger = get_logger(__name__)
set_verbosity_info()
12 changes: 11 additions & 1 deletion scrapegraphai/graphs/abstract_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import asyncio
import uuid
import warnings
import time
from abc import ABC, abstractmethod
from typing import Optional, Type

Expand All @@ -14,8 +15,13 @@

from ..helpers import models_tokens
from ..models import CLoD, DeepSeek, OneApi, XAI
from ..utils.logging import set_verbosity_info, set_verbosity_warning
from ..utils.logging import set_verbosity_info, set_verbosity_warning, get_logger
from ..telemetry import log_graph_execution

logger = get_logger(__name__)

# ANSI escape sequence for hyperlink
CLICKABLE_URL = "\033]8;;https://scrapegraphai.com\033\\https://scrapegraphai.com\033]8;;\033\\"

class AbstractGraph(ABC):
"""
Expand Down Expand Up @@ -316,6 +322,10 @@ def run(self) -> str:
"""
Abstract method to execute the graph and return the result.
"""
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
self.final_state, self.execution_info = self.graph.execute(inputs)
result = self.final_state.get("answer", "No answer found.")
return result

async def run_safe_async(self) -> str:
"""
Expand Down
24 changes: 22 additions & 2 deletions scrapegraphai/graphs/base_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

from ..telemetry import log_graph_execution
from ..utils import CustomLLMCallbackManager
from ..utils.logging import get_logger

logger = get_logger(__name__)

# ANSI escape sequence for hyperlink
CLICKABLE_URL = "\033]8;;https://scrapegraphai.com\033\\https://scrapegraphai.com\033]8;;\033\\"

class BaseGraph:
"""
Expand Down Expand Up @@ -353,9 +358,24 @@ def execute(self, initial_state: dict) -> Tuple[dict, list]:

bridge = BurrBridge(self, self.burr_config)
result = bridge.execute(initial_state)
return (result["_state"], [])
state, exec_info = (result["_state"], [])
else:
return self._execute_standard(initial_state)
state, exec_info = self._execute_standard(initial_state)

# Print the result first
if "answer" in state:
print(state["answer"])
elif "parsed_doc" in state:
print(state["parsed_doc"])
elif "generated_code" in state:
print(state["generated_code"])
elif "merged_script" in state:
print(state["merged_script"])

# Then show the message ONLY ONCE
print(f"✨ Try enhanced version of ScrapegraphAI at {CLICKABLE_URL} ✨")

return state, exec_info

def append_node(self, node):
"""
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading