Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
add new test for script generator
VinciGit001107630d27bb
diff --git a/examples/readme.md b/examples/readme.mdindex 4a6a3531..3d3501fb 100644--- a/examples/readme.md+++ b/examples/readme.md@@ -13,7 +13,7 @@ The model runned for this benchmark is Mistral on Ollama with nomic-embed-text| Hardware | Example 1 | Example 2 || ----------------------- | --------- | --------- || Macbook pro 14' m1 | 11.60s | 26.61s |-| Macbook pro 16' m2 max | 8.05s | 12.17 |+| Macbook pro 16' m2 max | 8.05s | 12.17s |**Note**: the examples on Docker are not runned on other devices than the Macbook because the performance are to slow (10 times slower than Ollama). Indeed the results are the following:diff --git a/tests/Readme.md b/tests/Readme.mdindex dd992c35..c5e9126a 100644--- a/tests/Readme.md+++ b/tests/Readme.md@@ -2,3 +2,4 @@Regarding the tests for the folder graphs and nodes it was created a specific repo as a example([link of the repo](https://github.com/VinciGit00/Scrapegrah-ai-website-for-tests)). The test website is hosted [here](https://scrapegrah-ai-website-for-tests.onrender.com).+Remember to activating Ollama and having installed the LLM on your pcdiff --git a/tests/script_generator_test.py b/tests/script_generator_test.pynew file mode 100644index 00000000..00ccf142--- /dev/null+++ b/tests/script_generator_test.py@@ -0,0 +1,47 @@+import pytest+from scrapegraphai.graphs import ScriptCreatorGraph+from scrapegraphai.utils import prettify_exec_info+++def graph_config():+ return {+ "llm": {+ "model": "ollama/mistral",+ "temperature": 0,+ "format": "json",+ "base_url": "http://localhost:11434",+ },+ "embeddings": {+ "model": "ollama/nomic-embed-text",+ "temperature": 0,+ "base_url": "http://localhost:11434",+ }+ }+++def test_script_creator_graph(graph_config):+ # Create the ScriptCreatorGraph instance+ smart_scraper_graph = ScriptCreatorGraph(+ prompt="List me all the news with their description.",+ source="https://perinim.github.io/projects",+ config=graph_config+ )++ # Run the graph+ result = smart_scraper_graph.run()++ # Check that the result is not empty+ assert result is not None++ # Get graph execution info+ graph_exec_info = smart_scraper_graph.get_execution_info()++ # Check that execution info is not empty+ assert graph_exec_info is not None++ # Check that execution info is a dictionary+ assert isinstance(graph_exec_info, dict)++ # Print execution info+ print(prettify_exec_info(graph_exec_info))diff --git a/tests/smart_scraper_ollama_test.py b/tests/smart_scraper_ollama_test.pyindex 91c07291..70eb9af6 100644--- a/tests/smart_scraper_ollama_test.py+++ b/tests/smart_scraper_ollama_test.py@@ -3,7 +3,6 @@ Module for testing th smart scraper class"""import pytestfrom scrapegraphai.graphs import SmartScraperGraph-from scrapegraphai.utils import prettify_exec_info@pytest.fixture