mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-04 21:00:36 +08:00
Ollama: Use no json format when creating the search query
This commit is contained in:
parent
5137b8aa5b
commit
05cf9adaa7
@ -10,6 +10,7 @@ from langchain.prompts import PromptTemplate
|
||||
from ..utils.logging import get_logger
|
||||
from ..utils.research_web import search_on_web
|
||||
from .base_node import BaseNode
|
||||
from ..models import Ollama
|
||||
|
||||
|
||||
class SearchInternetNode(BaseNode):
|
||||
@ -94,7 +95,14 @@ class SearchInternetNode(BaseNode):
|
||||
|
||||
# Execute the chain to get the search query
|
||||
search_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}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user