Spaces:
Paused
Paused
frdel commited on
Commit ·
43eeb15
1
Parent(s): e1d7d65
post-PR changes
Browse filesRequirements fix, knowledge tool error handling
- python/helpers/docker.py +2 -2
- python/tools/knowledge_tool.py +14 -3
- requirements.txt +4 -2
python/helpers/docker.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import time
|
| 2 |
import docker
|
| 3 |
import atexit
|
| 4 |
-
from typing import
|
| 5 |
from python.helpers.files import get_abs_path
|
| 6 |
from python.helpers.errors import format_error
|
| 7 |
from python.helpers.print_style import PrintStyle
|
| 8 |
|
| 9 |
class DockerContainerManager:
|
| 10 |
-
def __init__(self, image: str, name: str, ports: Optional[
|
| 11 |
self.image = image
|
| 12 |
self.name = name
|
| 13 |
self.ports = ports
|
|
|
|
| 1 |
import time
|
| 2 |
import docker
|
| 3 |
import atexit
|
| 4 |
+
from typing import Optional
|
| 5 |
from python.helpers.files import get_abs_path
|
| 6 |
from python.helpers.errors import format_error
|
| 7 |
from python.helpers.print_style import PrintStyle
|
| 8 |
|
| 9 |
class DockerContainerManager:
|
| 10 |
+
def __init__(self, image: str, name: str, ports: Optional[dict[str, int]] = None, volumes: Optional[dict[str, dict[str, str]]] = None):
|
| 11 |
self.image = image
|
| 12 |
self.name = name
|
| 13 |
self.ports = ports
|
python/tools/knowledge_tool.py
CHANGED
|
@@ -31,9 +31,20 @@ class Knowledge(Tool):
|
|
| 31 |
future_memory = executor.submit(memory_tool.search, self.agent, question)
|
| 32 |
|
| 33 |
# Wait for both functions to complete
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
msg = files.read_file("prompts/tool.knowledge.response.md",
|
| 39 |
online_sources = ((perplexity_result + "\n\n") if perplexity else "") + str(duckduckgo_result),
|
|
|
|
| 31 |
future_memory = executor.submit(memory_tool.search, self.agent, question)
|
| 32 |
|
| 33 |
# Wait for both functions to complete
|
| 34 |
+
try:
|
| 35 |
+
perplexity_result = (perplexity.result() if perplexity else "") or ""
|
| 36 |
+
except Exception as e:
|
| 37 |
+
perplexity_result = "Perplexity search failed: " + str(e)
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
duckduckgo_result = duckduckgo.result()
|
| 41 |
+
except Exception as e:
|
| 42 |
+
duckduckgo_result = "DuckDuckGo search failed: " + str(e)
|
| 43 |
+
|
| 44 |
+
try:
|
| 45 |
+
memory_result = future_memory.result()
|
| 46 |
+
except Exception as e:
|
| 47 |
+
memory_result = "Memory search failed: " + str(e)
|
| 48 |
|
| 49 |
msg = files.read_file("prompts/tool.knowledge.response.md",
|
| 50 |
online_sources = ((perplexity_result + "\n\n") if perplexity else "") + str(duckduckgo_result),
|
requirements.txt
CHANGED
|
@@ -13,5 +13,7 @@ docker==7.1.0
|
|
| 13 |
paramiko==3.4.0
|
| 14 |
duckduckgo_search==6.1.12
|
| 15 |
inputimeout==1.0.4
|
| 16 |
-
|
| 17 |
-
beautifulsoup4=4.12.3
|
|
|
|
|
|
|
|
|
| 13 |
paramiko==3.4.0
|
| 14 |
duckduckgo_search==6.1.12
|
| 15 |
inputimeout==1.0.4
|
| 16 |
+
newspaper3k==0.2.8
|
| 17 |
+
beautifulsoup4==4.12.3
|
| 18 |
+
lxml_html_clean==0.2.0
|
| 19 |
+
|