mirror of
https://github.com/TheBlewish/Automated-AI-Web-Researcher-Ollama.git
synced 2025-01-19 00:47:46 +00:00
Update Self_Improving_Search.py for windows
This commit is contained in:
parent
a53d85e284
commit
aa73019d70
|
@ -35,19 +35,20 @@ for name in ['root', 'duckduckgo_search', 'requests', 'urllib3']:
|
||||||
logging.getLogger(name).propagate = False
|
logging.getLogger(name).propagate = False
|
||||||
|
|
||||||
class OutputRedirector:
|
class OutputRedirector:
|
||||||
def __init__(self, stream=None):
|
"""Windows-compatible output redirection"""
|
||||||
self.stream = stream or StringIO()
|
def __init__(self, stream=None):
|
||||||
self.original_stdout = sys.stdout
|
self.stream = stream or StringIO()
|
||||||
self.original_stderr = sys.stderr
|
self.original_stdout = sys.stdout
|
||||||
|
self.original_stderr = sys.stderr
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
sys.stdout = self.stream
|
sys.stdout = self.stream
|
||||||
sys.stderr = self.stream
|
sys.stderr = self.stream
|
||||||
return self.stream
|
return self.stream
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
sys.stdout = self.original_stdout
|
sys.stdout = self.original_stdout
|
||||||
sys.stderr = self.original_stderr
|
sys.stderr = self.original_stderr
|
||||||
|
|
||||||
class EnhancedSelfImprovingSearch:
|
class EnhancedSelfImprovingSearch:
|
||||||
def __init__(self, llm: LLMWrapper, parser: UltimateLLMResponseParser, max_attempts: int = 5):
|
def __init__(self, llm: LLMWrapper, parser: UltimateLLMResponseParser, max_attempts: int = 5):
|
||||||
|
|
Loading…
Reference in a new issue