File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1010from ..utils .logging import get_logger
1111from ..utils .research_web import search_on_web
1212from .base_node import BaseNode
13+ from ..models import Ollama
1314
1415
1516class SearchInternetNode (BaseNode ):
@@ -94,7 +95,14 @@ def execute(self, state: dict) -> dict:
9495
9596 # Execute the chain to get the search query
9697 search_answer = search_prompt | self .llm_model | output_parser
97- search_query = search_answer .invoke ({"user_prompt" : user_prompt })[0 ]
98+
99+ # Ollama: Use no json format when creating the search query
100+ if isinstance (self .llm_model , Ollama ) and self .llm_model .format == 'json' :
101+ self .llm_model .format = None
102+ search_query = search_answer .invoke ({"user_prompt" : user_prompt })[0 ]
103+ self .llm_model .format = 'json'
104+ else :
105+ search_query = search_answer .invoke ({"user_prompt" : user_prompt })[0 ]
98106
99107 self .logger .info (f"Search Query: { search_query } " )
100108
You can’t perform that action at this time.
0 commit comments