Skip to content

Python scraper based on AI

Merge branch 'main' into temp-1

Marco Vinciguerra886bab78e72e
diff --cc CHANGELOG.md
index cf226b3c,6a87a873..1890eb64
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,98 -1,33 +1,123 @@@
+## [1.11.0-beta.10](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.9...v1.11.0-beta.10) (2024-08-02)
+
+
+### Bug Fixes
+
+* **AbstractGraph:** instantiation of Azure GPT models ([ade28fc](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/ade28fca2c3fdf40f28a80854e3b8435a52a6930)), closes [#498](https://github.com/ScrapeGraphAI/Scrapegraph-ai/issues/498)
+
+## [1.11.0-beta.9](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.8...v1.11.0-beta.9) (2024-08-02)
+
+
+### Features
+
+* refactoring of the code ([9355507](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/9355507a2dc73342f325b6649e871df48ae13567))
+
+## [1.11.0-beta.8](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.7...v1.11.0-beta.8) (2024-08-01)
+
+
+### Features
+
+* add integration in the abstract grapgh ([5ecdbe7](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5ecdbe715f4bb223fa1be834fda07ccea2a51cb9))
+
+
+### Bug Fixes
+
+* fixed bug on fetch_node ([968c69e](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/968c69e217d9c180b9b8c2aa52ca59b9a1733525))
+
+## [1.11.0-beta.7](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.6...v1.11.0-beta.7) (2024-08-01)
+ ## [1.10.0-beta.7](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.10.0-beta.6...v1.10.0-beta.7) (2024-07-23)
+
+ ## [1.11.3](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.2...v1.11.3) (2024-07-25)
+
+
### Bug Fixes
++
+* abstract_graph and removed unused embeddings ([0b4cfd6](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/0b4cfd6522dcad0eb418f0badd0f7824a1efd534))
+
+
+### Refactor
+
+* move embeddings code from AbstractGraph to RAGNode ([a94ebcd](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/a94ebcde0078d66d33e67f7e0a87850efb92d408))
+* reuse code for common interface models ([bb73d91](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/bb73d916a1a7b378438038ec928eeda6d8f6ac9d))
+
+## [1.11.0-beta.6](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.5...v1.11.0-beta.6) (2024-07-31)
+
+
+### Features
+
+* intregration of firebase ([4caed54](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/4caed545e5030460b2d5e46f9ad90546ce36f0ee))
+
+## [1.11.0-beta.5](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.4...v1.11.0-beta.5) (2024-07-30)
+
+
+### Features
+
+* fix tests ([1db164e](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/1db164e9e682eefbc1414989a043fefa2e9009c2))
+
+
+### chore
+
+* remove unused import ([88710f1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/88710f1a7c7d50f57108456112da30d1a12a1ba1))
+
+
+### Refactor
+
+* **Ollama:** integrate new LangChain chat init ([d177afb](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/d177afb68be036465ede1f567d2562b145d77d36))
+* **OpenAI:** integrate new LangChain chat init ([5e3eb6e](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5e3eb6e43df4bd4c452d34b49f254235e9ff1b22))
+* remove LangChain wrappers ([2c5f934](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/2c5f934f101e319ec4e61009d4c464ca4626c1ff))
+* remove LangChain wrappers for Ollama ([25066b2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/25066b2bc51517e50058231664230b8edef365b9))
+* remove redundant LangChain wrappers ([9275486](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/927548624034b3c30eca60011d216720102d1815))
+* remove redundant wrappers for Ernie and Nvidia ([bc2c996](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/bc2c9967d2f13ade6eeb7b23e9b423f6e79aa890))
+
+## [1.11.0-beta.4](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.3...v1.11.0-beta.4) (2024-07-25)
+
+
+### Features
+
+* add generate_answer node paralellization ([0c4b290](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/0c4b2908d98efbb2b0a6faf68618a801d726bb5f))
+
+
+### chore
+
+* rebuild requirements ([2edad66](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/2edad66788cbd92f197e3b37db13c44bfa39e36a))
+
+## [1.11.0-beta.3](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.2...v1.11.0-beta.3) (2024-07-25)
++=======
+ * add llama 3.1 ([f872bdd](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/f872bdd24f9874660eea04f9ade570c96b6e7e93))
+
+
+ ### Docs
+
+ * prev version ([5c08eea](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5c08eea189d7ede6f29399a67d897aa3b3f6a7b0))
+
+
+ ## [1.11.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.1...v1.11.2) (2024-07-23)
### Bug Fixes
+* add llama 3.1 ([f336c95](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/f336c95c2d1833d1f829d61ae7fa415ac2caf250))
+
+## [1.11.0-beta.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0-beta.1...v1.11.0-beta.2) (2024-07-24)
+
+
+### Features
+
+* pdate models_tokens.py ([377d679](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/377d679eecd62611c0c9a3cba8202c6f0719ed31))
+
+## [1.11.0-beta.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.10.4...v1.11.0-beta.1) (2024-07-23)
+ * md conversion ([1d41f6e](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/1d41f6eafe8ed0e191bb6a258d54c6388ff283c6))
+
+ ## [1.11.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.11.0...v1.11.1) (2024-07-23)
+
+
+ ### Bug Fixes
+
+ * md conversion ([5a45e9f](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5a45e9f2d86a1c58b8ea321e3df9718bc00f9c28))
+
+ ## [1.11.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.10.4...v1.11.0) (2024-07-23)
### Features
diff --cc pyproject.toml
index 576861bc,168f79cc..768e9415
--- a/pyproject.toml
+++ b/pyproject.toml
@@@ -1,19 -1,20 +1,23 @@@
[project]
name = "scrapegraphai"
-version = "1.12.1b1"
+
+version = "1.11.0b10"
+
description = "A web scraping library based on LangChain which uses LLM and direct graph logic to create scraping pipelines."
+
authors = [
{ name = "Marco Vinciguerra", email = "[email protected]" },
{ name = "Marco Perini", email = "[email protected]" },
{ name = "Lorenzo Padoan", email = "[email protected]" }
]
--dependencies = [
"langchain>=0.2.10",
++
+ "langchain-fireworks>=0.1.3",
+ "langchain_community>=0.2.9",
++
"langchain-google-genai>=1.0.7",
- "langchain-google-vertexai",
+ "langchain-google-vertexai>=1.0.7",
"langchain-openai>=0.1.17",
"langchain-groq>=0.1.3",
"langchain-aws>=0.1.3",
diff --cc requirements-dev.lock
index d14f9d42,3925a66a..cd2e2612
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@@ -218,11 -212,8 +218,13 @@@ httpx==0.27.
# via openai
httpx-sse==0.4.0
# via fireworks-ai
+huggingface-hub==0.24.0
+ # via langchain-huggingface
+ # via sentence-transformers
+ huggingface-hub==0.24.1
++
# via tokenizers
+ # via transformers
idna==3.7
# via anyio
# via email-validator
@@@ -293,9 -280,7 +295,11 @@@ langchain-google-vertexai==1.0.
# via scrapegraphai
langchain-groq==0.1.6
# via scrapegraphai
+langchain-huggingface==0.0.3
+ # via scrapegraphai
+langchain-nvidia-ai-endpoints==0.1.6
++
+ langchain-nvidia-ai-endpoints==0.1.7
# via scrapegraphai
langchain-openai==0.1.17
# via scrapegraphai
@@@ -386,8 -361,7 +390,8 @@@ pillow==10.4.
# via streamlit
platformdirs==4.2.2
# via pylint
- playwright==1.45.0
- # via browserbase
++
+ playwright==1.45.1
# via scrapegraphai
# via undetected-playwright
pluggy==1.5.0
diff --cc requirements.lock
index 7dbac1f3,5b34025c..1c5b514e
--- a/requirements.lock
+++ b/requirements.lock
@@@ -162,11 -156,8 +162,9 @@@ httpx==0.27.
# via openai
httpx-sse==0.4.0
# via fireworks-ai
- huggingface-hub==0.24.0
- # via langchain-huggingface
- # via sentence-transformers
+ huggingface-hub==0.24.1
# via tokenizers
+ # via transformers
idna==3.7
# via anyio
# via httpx
@@@ -215,9 -201,7 +213,10 @@@ langchain-google-vertexai==1.0.
# via scrapegraphai
langchain-groq==0.1.6
# via scrapegraphai
+langchain-huggingface==0.0.3
+ # via scrapegraphai
- langchain-nvidia-ai-endpoints==0.1.6
+ langchain-nvidia-ai-endpoints==0.1.7
++
# via scrapegraphai
langchain-openai==0.1.17
# via scrapegraphai
@@@ -271,15 -245,12 +270,14 @@@ packaging==24.
# via huggingface-hub
# via langchain-core
# via marshmallow
- # via transformers
++
pandas==2.2.2
# via scrapegraphai
pillow==10.4.0
# via fireworks-ai
# via langchain-nvidia-ai-endpoints
- # via sentence-transformers
- playwright==1.45.0
- # via browserbase
++
+ playwright==1.45.1
# via scrapegraphai
# via undetected-playwright
proto-plus==1.24.0
@@@ -420,7 -365,6 +418,7 @@@ typing-extensions==4.12.
# via pydantic-core
# via pyee
# via sqlalchemy
- # via torch
++
# via typing-inspect
typing-inspect==0.9.0
# via dataclasses-json
diff --cc requirements.txt
index 9c11363c,af7ee2ed..0116a466
--- a/requirements.txt
+++ b/requirements.txt
@@@ -1,6 -1,8 +1,12 @@@
langchain>=0.2.10
+langchain-google-genai>=1.0.7
+langchain-google-vertexai
++
+ langchain-fireworks>=0.1.3
+ langchain_community>=0.2.9
+ langchain-google-genai>=1.0.7
+ langchain-google-vertexai>=1.0.7
++
langchain-openai>=0.1.17
langchain-groq>=0.1.3
langchain-aws>=0.1.3
@@@ -20,7 -22,3 +26,8 @@@ playwright>=1.43.
google>=3.0.0
undetected-playwright>=0.3.0
semchunk>=1.0.1
+langchain-fireworks>=0.1.3
+langchain-community>=0.2.9
+langchain-huggingface>=0.0.3
+browserbase==0.3.0
++
diff --cc scrapegraphai/nodes/fetch_node.py
index 11cbb5fb,5f55b6e6..aa9496eb
--- a/scrapegraphai/nodes/fetch_node.py
+++ b/scrapegraphai/nodes/fetch_node.py
@@@ -165,10 -163,10 +165,13 @@@ class FetchNode(BaseNode)
if not source.strip():
raise ValueError("No HTML body content found in the local source.")
- if (not self.script_creator) or (self.force and not self.script_creator):
+ parsed_content = source
+
+ if isinstance(self.llm_model, ChatOpenAI) and not self.script_creator or self.force and not self.script_creator:
++
parsed_content = convert_to_md(source)
+ else:
+ parsed_content = source
compressed_document = [
Document(page_content=parsed_content, metadata={"source": "local_dir"})
@@@ -184,9 -184,8 +187,10 @@@
if not self.cut:
parsed_content = cleanup_html(response, source)
- if (not self.script_creator) or (self.force and not self.script_creator):
- parsed_content = convert_to_md(parsed_content, source)
+ if (isinstance(self.llm_model, ChatOpenAI)
+ and not self.script_creator) or (self.force and not self.script_creator):
+ parsed_content = convert_to_md(source, input_data[0])
++
compressed_document = [Document(page_content=parsed_content)]
else:
self.logger.warning(
@@@ -214,9 -206,11 +218,10 @@@
raise ValueError("No HTML body content found in the document fetched by ChromiumLoader.")
parsed_content = document[0].page_content
- if (not self.script_creator) or (self.force and not self.script_creator and not self.openai_md_enabled):
-
- parsed_content = convert_to_md(document[0].page_content, source)
+ if isinstance(self.llm_model, ChatOpenAI) and not self.script_creator or self.force and not self.script_creator and not self.openai_md_enabled:
+ parsed_content = convert_to_md(document[0].page_content, input_data[0])
+
compressed_document = [
Document(page_content=parsed_content, metadata={"source": "html file"})
]