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 10
10
from ..utils .logging import get_logger
11
11
from ..utils .research_web import search_on_web
12
12
from .base_node import BaseNode
13
+ from ..models import Ollama
13
14
14
15
15
16
class SearchInternetNode (BaseNode ):
@@ -94,7 +95,14 @@ def execute(self, state: dict) -> dict:
94
95
95
96
# Execute the chain to get the search query
96
97
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 ]
98
106
99
107
self .logger .info (f"Search Query: { search_query } " )
100
108
You can’t perform that action at this time.
0 commit comments