Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
handling the agent model
VinciGit009b9a9f204ce7
diff --git a/examples/benchmarks/SmartScraper/benchmark_docker.py b/examples/benchmarks/SmartScraper/benchmark_docker.pyindex b38a3540..e5754c4b 100644--- a/examples/benchmarks/SmartScraper/benchmark_docker.py+++ b/examples/benchmarks/SmartScraper/benchmark_docker.py@@ -2,7 +2,6 @@Basic example of scraping pipeline using SmartScraper from text"""-import osfrom scrapegraphai.graphs import SmartScraperGraphfrom scrapegraphai.utils import prettify_exec_infodiff --git a/scrapegraphai/helpers/robots.py b/scrapegraphai/helpers/robots.pyindex 420a9ebd..e89d203d 100644--- a/scrapegraphai/helpers/robots.py+++ b/scrapegraphai/helpers/robots.py@@ -5,7 +5,7 @@ Module for mapping the models in ai agentsrobots_dictionary = {"gpt-3.5-turbo": ["GPTBot", "ChatGPT-user"],"gpt-4-turbo": ["GPTBot", "ChatGPT-user"],- "claude": "Claude-Web",+ "claude": ["Claude-Web", "ClaudeBot"],"perplexity": "PerplexityBot","cohere": "cohere-ai","anthropic": "anthropic-ai"diff --git a/scrapegraphai/nodes/rag_node.py b/scrapegraphai/nodes/rag_node.pyindex b5d5433f..fc19c700 100644--- a/scrapegraphai/nodes/rag_node.py+++ b/scrapegraphai/nodes/rag_node.py@@ -9,9 +9,9 @@ from langchain.retrievers.document_compressors import EmbeddingsFilter, Documentfrom langchain_community.document_transformers import EmbeddingsRedundantFilterfrom langchain_community.embeddings import HuggingFaceHubEmbeddingsfrom langchain_community.vectorstores import FAISS+from langchain_community.embeddings import OllamaEmbeddingsfrom langchain_openai import OpenAIEmbeddings, AzureOpenAIEmbeddingsfrom ..models import OpenAI, Ollama, AzureOpenAI, HuggingFace-from langchain_community.embeddings import OllamaEmbeddingsfrom .base_node import BaseNode@@ -97,7 +97,7 @@ class RAGNode(BaseNode):# remove streaming and temperatureparams.pop("streaming", None)params.pop("temperature", None)-+embeddings = OllamaEmbeddings(**params)elif isinstance(embedding_model, HuggingFace):embeddings = HuggingFaceHubEmbeddings(model=embedding_model.model)diff --git a/scrapegraphai/nodes/robots_node.py b/scrapegraphai/nodes/robots_node.pyindex 1b5178dc..1bf58206 100644--- a/scrapegraphai/nodes/robots_node.py+++ b/scrapegraphai/nodes/robots_node.py@@ -102,11 +102,17 @@ class RobotsNode(BaseNode):document = loader.load()- # TODO: look at the agent- agent = "TODO"- # mandare la richiesta- # if errore -> manda l'eccezione- # poi faccio un return+ model = self.llm_model["model"]++ if "ollama" in model:+ model = model.split("/", maxsplit=1)[-1]++ try:+ agent = robots_dictionary[model]++ except KeyError:+ agent = model+prompt = PromptTemplate(template=template,partial_variables={"context": document,