Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Ollama: Use no json format when creating the search query
amosdinh05cf9adaa7be
diff --git a/scrapegraphai/nodes/search_internet_node.py b/scrapegraphai/nodes/search_internet_node.pyindex 97fed67b..2474ab60 100644--- a/scrapegraphai/nodes/search_internet_node.py+++ b/scrapegraphai/nodes/search_internet_node.py@@ -10,6 +10,7 @@ from langchain.prompts import PromptTemplatefrom ..utils.logging import get_loggerfrom ..utils.research_web import search_on_webfrom .base_node import BaseNode+from ..models import Ollamaclass SearchInternetNode(BaseNode):@@ -94,7 +95,14 @@ class SearchInternetNode(BaseNode):# Execute the chain to get the search querysearch_answer = search_prompt | self.llm_model | output_parser- search_query = search_answer.invoke({"user_prompt": user_prompt})[0]++ # Ollama: Use no json format when creating the search query+ if isinstance(self.llm_model, Ollama) and self.llm_model.format == 'json':+ self.llm_model.format = None+ search_query = search_answer.invoke({"user_prompt": user_prompt})[0]+ self.llm_model.format = 'json'+ else:+ search_query = search_answer.invoke({"user_prompt": user_prompt})[0]self.logger.info(f"Search Query: {search_query}")