Skip to content

Agent Zero AI framework

rag + markdown, final touches

frdel4767db3b60e5
diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile
index bb7b2cc38..14febd005 100644
--- a/docker/base/Dockerfile
+++ b/docker/base/Dockerfile
@@ -18,10 +18,11 @@ ENV TZ=UTC
# Copy contents of the project to /
COPY ./fs/ /
-# install packages software
+# install packages software (split for better cache management)
RUN bash /ins/install_base_packages1.sh
RUN bash /ins/install_base_packages2.sh
RUN bash /ins/install_base_packages3.sh
+RUN bash /ins/install_base_packages4.sh
# install python after packages to ensure version overriding
RUN bash /ins/install_python.sh
diff --git a/docker/base/fs/ins/install_base_packages3.sh b/docker/base/fs/ins/install_base_packages3.sh
index 0903810a2..c77f6d492 100644
--- a/docker/base/fs/ins/install_base_packages3.sh
+++ b/docker/base/fs/ins/install_base_packages3.sh
@@ -10,6 +10,4 @@ echo "====================BASE PACKAGES3 NPM===================="
# we shall not install npx separately, it's discontinued and some versions are broken
# npm i -g npx
-npm i -g shx
-
echo "====================BASE PACKAGES3 END===================="
diff --git a/docker/base/fs/ins/install_base_packages4.sh b/docker/base/fs/ins/install_base_packages4.sh
new file mode 100644
index 000000000..45726ddc0
--- /dev/null
+++ b/docker/base/fs/ins/install_base_packages4.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+echo "====================BASE PACKAGES4 START===================="
+
+apt-get install -y --no-install-recommends \
+ tesseract-ocr tesseract-ocr-script-latn poppler-utils
+
+echo "====================BASE PACKAGES4 END===================="
\ No newline at end of file
diff --git a/docker/run/fs/ins/install_additional.sh b/docker/run/fs/ins/install_additional.sh
index b2d79b6dc..53e78c43e 100644
--- a/docker/run/fs/ins/install_additional.sh
+++ b/docker/run/fs/ins/install_additional.sh
@@ -4,9 +4,4 @@
# bash /ins/install_playwright.sh "$@"
# searxng - moved to base image
-# bash /ins/install_searxng.sh "$@"
-
-#TODO : move to base image
-
-apt-get install -y --no-install-recommends \
- tesseract-ocr-all poppler-utils
\ No newline at end of file
+# bash /ins/install_searxng.sh "$@"
\ No newline at end of file
diff --git a/prompts/default/agent.system.tool.response.md b/prompts/default/agent.system.tool.response.md
index 215536260..57f92dac6 100644
--- a/prompts/default/agent.system.tool.response.md
+++ b/prompts/default/agent.system.tool.response.md
@@ -3,7 +3,8 @@ final answer to user
ends task processing use only when done or no task active
put result in text arg
always write full file paths
-always use markdown formatting headers bold text lists emojis improve readability
+always use markdown formatting headers bold text lists
+use emojis as icons improve readability
prefer using tables
output full file paths not only names they are clickable
images shown with ![alt](img:///path/to/image.png)
diff --git a/prompts/default/fw.document_query.optmimize_query.md b/prompts/default/fw.document_query.optmimize_query.md
index 88a6ddcef..7251a14b4 100644
--- a/prompts/default/fw.document_query.optmimize_query.md
+++ b/prompts/default/fw.document_query.optmimize_query.md
@@ -1,7 +1,28 @@
-You are an AI assistant being part of a larger RAG system based on vector similarity search.
-Your job is to take a human written question and convert it into a concise vector store search query.
-The goal is to yield as many correct results and as few false positives as possible.
-!! You will be given a "Search Query".
-!! The response should ONLY contain the optimized search query
-!! Do not include any other text, confirmations or explanations. Do not prefix your response.
-!! You are working as a tool and not as a conversational agent.
+# AI role
+- You are an AI assistant being part of a larger RAG system based on vector similarity search
+- Your job is to take a human written question and convert it into a concise vector store search query
+- The goal is to yield as many correct results and as few false positives as possible
+
+# Input
+- you are provided with original search query as user message
+
+# Response rules !!!
+- respond only with optimized result query text
+- no text before or after
+- no conversation, you are a tool agent, not a conversational agent
+
+# Optimized query
+- optimized query is consise, short and to the point
+- contains only keywords and phrases, no full sentences
+- include alternatives and variations for better coverage
+
+
+# Examples
+User: What is the capital of France?
+Agent: france capital city
+
+User: What does it say about transmission?
+Agent: transmission gearbox automatic manual
+
+User: What did John ask Monica on Tuesday?
+Agent: john monica conversation dialogue question ask tuesday
diff --git a/python/helpers/document_query.py b/python/helpers/document_query.py
index 0959e286e..62327f055 100644
--- a/python/helpers/document_query.py
+++ b/python/helpers/document_query.py
@@ -40,7 +40,7 @@ from agent import Agent
from langchain.text_splitter import RecursiveCharacterTextSplitter
-DEFAULT_SEARCH_THRESHOLD = 0.6
+DEFAULT_SEARCH_THRESHOLD = 0.5
class DocumentQueryStore:
"""