Skip to content

allignmenet #521

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 7 commits into from
Aug 9, 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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
## [1.13.0-beta.6](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.13.0-beta.5...v1.13.0-beta.6) (2024-08-09)
## [1.12.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.12.1...v1.12.2) (2024-08-07)



### Bug Fixes

* generate answer node omni ([b52e4a3](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/b52e4a390bb23ca55922e47046db558e1969a047))

## [1.12.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.12.0...v1.12.1) (2024-08-07)

* **FetchNode:** missing bracket syntax error ([50edbcc](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/50edbcc7f80e419f72f3f69249fec4a37597ef9a))

## [1.13.0-beta.5](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.13.0-beta.4...v1.13.0-beta.5) (2024-08-08)


### Bug Fixes

* generate answer node pdf has a bug ([625ca9f](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/625ca9f22a91a292a844ddb45e0edc767bf24711))

* **chunking:** count tokens from words instead of characters ([5ec2de9](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5ec2de9e1a14def5596738b6cdf769f5039a246d)), closes [#513](https://github.com/ScrapeGraphAI/Scrapegraph-ai/issues/513)

## [1.13.0-beta.4](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.13.0-beta.3...v1.13.0-beta.4) (2024-08-07)
Expand Down Expand Up @@ -63,6 +70,7 @@
* **release:** 1.11.0-beta.11 [skip ci] ([579d3f3](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/579d3f394b54636673baf8e9f619f1c57a2ecce4))
* **release:** 1.11.0-beta.12 [skip ci] ([cf2a17e](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/cf2a17ed5d79c62271fd9ea8ec89793884b04b56))


## [1.12.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.3...v1.12.0) (2024-08-06)


Expand Down
5 changes: 2 additions & 3 deletions examples/local_models/smart_scraper_ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
# ************************************************
# Create the SmartScraperGraph instance and run it
# ************************************************

smart_scraper_graph = SmartScraperGraph(
prompt="List me all the titles of the website",
source="https://sport.sky.it/nba?gr=www",
prompt="Find some information about what does the company do, the name and a contact email.",
source="https://scrapegraphai.com/",
config=graph_config
)

Expand Down
2 changes: 1 addition & 1 deletion examples/openai/search_graph_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
graph_config = {
"llm": {
"api_key": openai_key,
"model": "gpt-3.5-turbo",
"model": "gpt-4o",
},
"max_results": 2,
"verbose": True,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[project]
name = "scrapegraphai"


version = "1.13.0b6"


Expand Down
2 changes: 1 addition & 1 deletion scrapegraphai/graphs/script_creator_multi_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def run(self) -> str:
"""
inputs = {"user_prompt": self.prompt, "urls": self.source}
self.final_state, self.execution_info = self.graph.execute(inputs)
return self.final_state.get("merged_script", "Failed to generate the script.")
return self.final_state.get("merged_script", "Failed to generate the script.")
2 changes: 1 addition & 1 deletion scrapegraphai/graphs/search_link_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ def run(self) -> str:
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
self.final_state, self.execution_info = self.graph.execute(inputs)

return self.final_state.get("parsed_doc", "No answer found.")
return self.final_state.get("parsed_doc", "No answer found.")
14 changes: 9 additions & 5 deletions scrapegraphai/nodes/conditional_node.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
Module for implementing the conditional node
"""

from typing import Optional, List
from .base_node import BaseNode


class ConditionalNode(BaseNode):
"""
A node that determines the next step in the graph's execution flow based on
Expand All @@ -29,16 +28,21 @@ class ConditionalNode(BaseNode):

"""

def __init__(self, key_name: str, node_name="ConditionalNode"):
def __init__(self,
input: str,
output: List[str],
node_config: Optional[dict] = None,
node_name: str = "GenerateAnswerCSV",
):
"""
Initializes the node with the key to check and the next node names based on the condition.

Args:
key_name (str): The name of the key to check in the state.
"""

super().__init__(node_name, "conditional_node")
self.key_name = key_name
super().__init__(node_name, "node", input, output, 2, node_config)


def execute(self, state: dict) -> dict:
"""
Expand Down
2 changes: 1 addition & 1 deletion scrapegraphai/nodes/generate_answer_csv_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)

self.additional_info = node_config.get("additional_info")

def execute(self, state):
Expand Down
2 changes: 1 addition & 1 deletion scrapegraphai/nodes/generate_answer_omni_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def execute(self, state: dict) -> dict:
template=template_no_chunk_omni_prompt,
input_variables=["question"],
partial_variables={
"context": chunk,
"context": doc,
"format_instructions": format_instructions,
"img_desc": imag_desc,
},
Expand Down
4 changes: 2 additions & 2 deletions scrapegraphai/nodes/generate_answer_pdf_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
self.llm_model = node_config["llm_model"]
if isinstance(node_config["llm_model"], ChatOllama):
self.llm_model.format="json"

self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)
Expand Down Expand Up @@ -114,7 +114,7 @@ def execute(self, state):
template=template_no_chunks_pdf_prompt,
input_variables=["question"],
partial_variables={
"context":chunk,
"context": doc,
"format_instructions": format_instructions,
},
)
Expand Down
Loading