johnbridges commited on
Commit
5172af6
·
1 Parent(s): 4f17ff6

trying qwen 3

Browse files
Dockerfile CHANGED
@@ -31,7 +31,7 @@ WORKDIR /home/user
31
  RUN mkdir -p /home/user/code/models && \
32
  mkdir -p /home/user/code/app/wwwroot && \
33
  cd /home/user/code/models && \
34
- wget -q https://huggingface.co/Mungert/Phi-4-mini-instruct.gguf/resolve/main/phi-4-mini-q4_0.gguf
35
 
36
 
37
  # Clone and build OpenBLAS as the non-root user
@@ -78,22 +78,22 @@ RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
78
 
79
 
80
  # Copy files into the container as the non-root user
81
- COPY --chown=user:user system_prompt_phi_4_mini /home/user/code/models/system_prompt_phi_4_mini
82
- COPY --chown=user:user system_prompt_phi_4_mini_run /home/user/code/models/system_prompt_phi_4_mini_run
83
  COPY --chown=user:user appsettings.json /home/user/code/app/appsettings.json
84
  COPY --chown=user:user index.html /home/user/code/app/wwwroot/index.html
85
  COPY --chown=user:user append_run.sh /home/user/code/models/append_run.sh
86
- COPY --chown=user:user expect-build-phi-4-mini /home/user/code/models/expect-build-phi-4-mini
87
 
88
  # Set permissions for scripts as the non-root user
89
  RUN chmod +x /home/user/code/models/append_run.sh && \
90
- chmod +x /home/user/code/models/expect-build-phi-4-mini
91
 
92
  # Set the working directory for the build-phi-4-mini script
93
  WORKDIR /home/user/code/models
94
 
95
  # Run the build-phi-4-mini script
96
- RUN ./expect-build-phi-4-mini
97
 
98
  # Expose port 7860 for Hugging Face Spaces
99
  EXPOSE 7860
 
31
  RUN mkdir -p /home/user/code/models && \
32
  mkdir -p /home/user/code/app/wwwroot && \
33
  cd /home/user/code/models && \
34
+ wget -q https://huggingface.co/Mungert/Qwen3-4B-Instruct-2507-GGUF/resolve/main/Qwen3-4B-Instruct-2507-q8_0.gguf
35
 
36
 
37
  # Clone and build OpenBLAS as the non-root user
 
78
 
79
 
80
  # Copy files into the container as the non-root user
81
+ COPY --chown=user:user system_prompt_phi_4_mini /home/user/code/models/system_prompt_qwen_3
82
+ COPY --chown=user:user system_prompt_phi_4_mini_run /home/user/code/models/system_prompt_qwen_3_run
83
  COPY --chown=user:user appsettings.json /home/user/code/app/appsettings.json
84
  COPY --chown=user:user index.html /home/user/code/app/wwwroot/index.html
85
  COPY --chown=user:user append_run.sh /home/user/code/models/append_run.sh
86
+ COPY --chown=user:user expect-build-phi-4-mini /home/user/code/models/expect-build-qwen-3
87
 
88
  # Set permissions for scripts as the non-root user
89
  RUN chmod +x /home/user/code/models/append_run.sh && \
90
+ chmod +x /home/user/code/models/expect-build-qwen-3
91
 
92
  # Set the working directory for the build-phi-4-mini script
93
  WORKDIR /home/user/code/models
94
 
95
  # Run the build-phi-4-mini script
96
+ RUN ./expect-build-qwen-3
97
 
98
  # Expose port 7860 for Hugging Face Spaces
99
  EXPOSE 7860
Dockerfile-phi-4 ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Debian 12 (Bookworm) base image
2
+ FROM debian:13
3
+
4
+ # Set environment variables to avoid interactive prompts during package installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Install system-level dependencies as root
8
+ RUN apt-get update && \
9
+ apt-get install -y \
10
+ build-essential \
11
+ curl \
12
+ git \
13
+ cmake \
14
+ clang \
15
+ pkg-config \
16
+ ccache \
17
+ wget \
18
+ vim \
19
+ libicu76 \
20
+ expect
21
+
22
+ # Create a non-root user and set up their environment
23
+ RUN useradd -m user && \
24
+ mkdir -p /home/user/code && \
25
+ chown -R user:user /home/user
26
+
27
+ # Switch to the non-root user
28
+ USER user
29
+ WORKDIR /home/user
30
+
31
+ RUN mkdir -p /home/user/code/models && \
32
+ mkdir -p /home/user/code/app/wwwroot && \
33
+ cd /home/user/code/models && \
34
+ wget -q https://huggingface.co/Mungert/Phi-4-mini-instruct.gguf/resolve/main/phi-4-mini-q4_0.gguf
35
+
36
+
37
+ # Clone and build OpenBLAS as the non-root user
38
+ RUN git clone https://github.com/OpenMathLib/OpenBLAS.git /home/user/code/models/OpenBLAS && \
39
+ cd /home/user/code/models/OpenBLAS && \
40
+ make -j2 > build.log 2>&1 || (tail -20 build.log && false)
41
+
42
+ # Switch to root for the OpenBLAS installation
43
+ USER root
44
+ RUN cd /home/user/code/models/OpenBLAS && \
45
+ make install > install.log 2>&1 || (tail -20 install.log && false) && \
46
+ cp /opt/OpenBLAS/lib/libopenblas* /usr/local/lib/
47
+
48
+ # Switch back to the non-root user
49
+ USER user
50
+
51
+ # Clone and build llama.cpp with OpenBLAS support as the non-root user
52
+ RUN git clone https://github.com/ggerganov/llama.cpp /home/user/code/models/llama.cpp && \
53
+ cd /home/user/code/models/llama.cpp && \
54
+ export PKG_CONFIG_PATH=/opt/OpenBLAS/lib/pkgconfig:$PKG_CONFIG_PATHa && \
55
+ cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS=/home/user/code/models/OpenBLAS -DLLAMA_CURL=OFF && \
56
+ cmake --build build --config Release -j2 && \
57
+ cp /home/user/code/models/llama.cpp/build/bin/* /home/user/code/models/llama.cpp/
58
+
59
+
60
+
61
+ # Install .NET 10.0 as the non-root user
62
+ RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
63
+ chmod +x dotnet-install.sh && \
64
+ ./dotnet-install.sh --channel 10.0
65
+
66
+ # Set persistent environment variables
67
+ ENV DOTNET_ROOT=/home/user/.dotnet
68
+ ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
69
+
70
+ # Verify .NET installation and current user
71
+ RUN whoami && dotnet --version
72
+
73
+ # Clone repositories using the GITHUB_TOKEN secret
74
+ RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
75
+ git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorLib.git /home/user/code/NetworkMonitorLib && \
76
+ git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorLLM.git /home/user/code/NetworkMonitorLLM && \
77
+ git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorData.git /home/user/code/NetworkMonitorData
78
+
79
+
80
+ # Copy files into the container as the non-root user
81
+ COPY --chown=user:user system_prompt_phi_4_mini /home/user/code/models/system_prompt_phi_4_mini
82
+ COPY --chown=user:user system_prompt_phi_4_mini_run /home/user/code/models/system_prompt_phi_4_mini_run
83
+ COPY --chown=user:user appsettings.json /home/user/code/app/appsettings.json
84
+ COPY --chown=user:user index.html /home/user/code/app/wwwroot/index.html
85
+ COPY --chown=user:user append_run.sh /home/user/code/models/append_run.sh
86
+ COPY --chown=user:user expect-build-phi-4-mini /home/user/code/models/expect-build-phi-4-mini
87
+
88
+ # Set permissions for scripts as the non-root user
89
+ RUN chmod +x /home/user/code/models/append_run.sh && \
90
+ chmod +x /home/user/code/models/expect-build-phi-4-mini
91
+
92
+ # Set the working directory for the build-phi-4-mini script
93
+ WORKDIR /home/user/code/models
94
+
95
+ # Run the build-phi-4-mini script
96
+ RUN ./expect-build-phi-4-mini
97
+
98
+ # Expose port 7860 for Hugging Face Spaces
99
+ EXPOSE 7860
100
+ # Set the working directory
101
+ WORKDIR /home/user/code/NetworkMonitorLLM
102
+
103
+ # Build the .NET project as the non-root user
104
+ RUN dotnet restore && \
105
+ dotnet build -c Release
106
+
107
+ RUN cp -r /home/user/code/NetworkMonitorLLM/bin/Release/net10.0/* /home/user/code/app/ && \
108
+ rm -rf /home/user/code/NetworkMonitorLib /home/user/code/NetworkMonitorLLM /home/user/code/NetworkMonitorData
109
+
110
+ # Set the working directory to the `app` directory
111
+ WORKDIR /home/user/code/app
112
+
113
+ # Run the .NET app as the non-root user
114
+ CMD ["dotnet", "NetworkMonitorLLM.dll", "--urls", "http://0.0.0.0:7860"]
appsettings-phi-4.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Logging": {
3
+ "LogLevel": {
4
+ "Default": "Information",
5
+ "Microsoft": "Warning",
6
+ "Microsoft.Hosting.Lifetime": "Information"
7
+ }
8
+ },
9
+ "OpenAIApiKey" :".env",
10
+ "EmailEncryptKey": ".env",
11
+ "LocalSystemUrl": {
12
+ "ExternalUrl": "https://asmonitorsrv.readyforquantum.com",
13
+ "IPAddress": "",
14
+ "RabbitHostName": "rabbitmq.readyforquantum.com",
15
+ "RabbitPort": 55672,
16
+ "RabbitInstanceName" : "ASSrv-LLMService",
17
+ "RabbitUserName" : "usercommonxf1",
18
+ "RabbitVHost" : "/vhostuser",
19
+ "UseTls" : true
20
+ },
21
+ "ServiceID" : "monitor",
22
+ "StartThisTestLLM" : true,
23
+ "LlmNoInitMessage" : false,
24
+ "ServiceAuthKey" : ".env" ,
25
+ "LlmModelPath" : "/home/user/code/models/",
26
+ "LlmModelFileName" : "phi-4-mini-q4_0.gguf",
27
+ "LlmContextFileName" : "context-phi-4-mini.gguf",
28
+ "LlmSystemPrompt" : "system_prompt_phi_4_mini_run",
29
+ "LlmPromptMode" : " -if -sp -no-cnv --simple-io ",
30
+ "LlmVersion" : "phi_4_mini",
31
+ "LlmCtxSize" : 12000,
32
+ "LlmOpenAICtxSize" : 32000,
33
+ "LlmCtxRatio" : 6,
34
+ "LlmTemp" : "0.3",
35
+ "LlmThreads" : 2,
36
+ "LlmUserPromptTimeout" : 1200,
37
+ "LlmSessionIdleTimeout" : 1440,
38
+ "LlmGptModel" : "gpt-4.1-mini",
39
+ "LlmHFModelID" : "meta-llama/llama-3.3-70b-instruct",
40
+ "LlmHFKey" : ".env",
41
+ "LlmHFUrl" : "https://api.novita.ai/v3/openai/chat/completions",
42
+ "LlmHFModelVersion" : "llama_3.2",
43
+ "IsStream" : false,
44
+ "UseFixedPort" : true,
45
+ "HFToken" : ".env",
46
+ "DataRepoId" : "mungert/NetMonLLMDataLive",
47
+ "RedisUrl" :"redis.readyforquantum.co.uk:46379",
48
+ "MaxRetries" : -1,
49
+ "RabbitPassword" : ".env",
50
+ "RabbitRoutingKey": "execute.local",
51
+ "RabbitExchangeType": "direct",
52
+ "LlmSystemPromptTimeout": 120,
53
+ "LlmSpaceModelID": "Qwen/Qwen3-1.7B",
54
+ "LlmUseHF": false,
55
+ "AudioServiceUrls": ["https://devtranscribe.readyforquantum.com","https://devtranscribe2.readyforquantum.com","https://devtranscribe3.readyforquantum.com"],
56
+ "REDIS_PASSWORD" :".env",
57
+ "UseTls" : true,
58
+
59
+ }
60
+
appsettings.json CHANGED
@@ -24,10 +24,10 @@
24
  "ServiceAuthKey" : ".env" ,
25
  "LlmModelPath" : "/home/user/code/models/",
26
  "LlmModelFileName" : "phi-4-mini-q4_0.gguf",
27
- "LlmContextFileName" : "context-phi-4-mini.gguf",
28
- "LlmSystemPrompt" : "system_prompt_phi_4_mini_run",
29
  "LlmPromptMode" : " -if -sp -no-cnv --simple-io ",
30
- "LlmVersion" : "phi_4_mini",
31
  "LlmCtxSize" : 12000,
32
  "LlmOpenAICtxSize" : 32000,
33
  "LlmCtxRatio" : 6,
@@ -54,7 +54,7 @@
54
  "LlmUseHF": false,
55
  "AudioServiceUrls": ["https://devtranscribe.readyforquantum.com","https://devtranscribe2.readyforquantum.com","https://devtranscribe3.readyforquantum.com"],
56
  "REDIS_PASSWORD" :".env",
57
- "UseTls" : true,
58
 
59
  }
60
 
 
24
  "ServiceAuthKey" : ".env" ,
25
  "LlmModelPath" : "/home/user/code/models/",
26
  "LlmModelFileName" : "phi-4-mini-q4_0.gguf",
27
+ "LlmContextFileName" : "context-qwen_3.gguf",
28
+ "LlmSystemPrompt" : "system_prompt_qwen_3_run",
29
  "LlmPromptMode" : " -if -sp -no-cnv --simple-io ",
30
+ "LlmVersion" : "qwen_3",
31
  "LlmCtxSize" : 12000,
32
  "LlmOpenAICtxSize" : 32000,
33
  "LlmCtxRatio" : 6,
 
54
  "LlmUseHF": false,
55
  "AudioServiceUrls": ["https://devtranscribe.readyforquantum.com","https://devtranscribe2.readyforquantum.com","https://devtranscribe3.readyforquantum.com"],
56
  "REDIS_PASSWORD" :".env",
57
+ "UseTls" : true
58
 
59
  }
60
 
build-qwen-3 ADDED
@@ -0,0 +1 @@
 
 
1
+ ~/code/models/llama.cpp/llama-completion -c 12000 -m ~/code/models/Qwen3-4B-Instruct-2507-q8_0.gguf --prompt-cache context-qwen-3.gguf -f system_prompt_qwen_3 -r "<|im_end|>" -sp -i --temp 0 --simple-io -no-cnv
expect-build-qwen-3 ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/expect
2
+ # Set the timeout to 300 seconds (5 minutes)
3
+ set timeout 600
4
+ # Start the llama-completion command with absolute paths
5
+ spawn /home/user/code/models/llama.cpp/llama-completion -c 12000 -m /home/user/code/models/Qwen3-4B-Instruct-2507-q8_0.gguf --prompt-cache /home/user/code/models/context-qwen-3.gguf -f /home/user/code/models/system_prompt_qwen_3 -r "<|im_end|>" -no-cnv -sp -i --temp 0 --simple-io
6
+
7
+ # Wait for the expected output
8
+ expect {
9
+ "</tool_call><|im_end|>" {
10
+ # Send Ctrl+C to terminate the command
11
+ send \x03
12
+ exp_continue
13
+ }
14
+ eof {
15
+ # Exit when the command ends
16
+ exit 0
17
+ }
18
+ timeout {
19
+ # Exit if the command takes too long
20
+ send_user "Timeout occurred. Exiting...\n"
21
+ exit 0
22
+ }
23
+ }
system_prompt_qwen_3 ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <|im_start|>system
2
+ You are a network monitoring and security expert. Your primary role is to provide the user with real-time monitoring of their network and offer expert recommendations on any security issues you detect. You analyze host data, perform scans, and suggest actions to enhance security. Execute functions where necessary to perform your tasks and ensure your advice is clear and actionable. When interacting with the user, gather any required input, provide detailed insights, and offer guidance to help them maintain a secure and optimized network environment.
3
+ All dates must be in ISO 8601 Standard yyyy-MM-ddTHH:mm:ss .
4
+ # Tools
5
+
6
+ You may call one or more functions to assist with the user query.
7
+
8
+ You are provided with function signatures within <tools></tools> XML tags:
9
+ <tools>
10
+ [{"name": "add_host", "description": "Add a host to be monitored. For example, to add a host with address 'example.com' and monitor it using the httpfull endpoint: {'address': 'example.com', 'endpoint': 'httpfull'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function echo all the values set or just necessary fields. The default is false for a faster response."}, "address": {"type": "string", "description": "The host address, required."}, "endpoint": {"type": "string", "description": "The endpoint type for monitoring. Optional field. Endpoint types include: 'quantum' (a quantum-safe encryption test), 'http' (website ping), 'https' (SSL certificate check), 'httphtml' (loads only the HTML of a website), 'httpfull' (loads full website content including JavaScript), 'sitehash' (loads and hashes rendered website content to detect changes), 'icmp' (host ping), 'dns' (DNS lookup), 'smtp' (email server HELO message confirmation), 'rawconnect' (low-level raw socket connection), 'nmap' (service scan using Nmap), 'nmapvuln' (vulnerability scan using Nmap scripts), 'crawlsite' (traffic generator that crawls a site), 'dailycrawl' (once-daily low-traffic site crawl), 'dailyhugkeepalive' (once-daily trafic generator for a Hugging Face space to keep it alive), 'hugwake' (wake up a Hugging Face space by clicking the restart button if the space is sleeping)."}, "port": {"type": "number", "description": "The port of the service being monitored, optional. It will be zero if it is the standard port for the host endpoint type. For example, the standard port for HTTPS is 443."}, "timeout": {"type": "number", "description": "The time to wait for a timeout in milliseconds, optional. The default is 59000."}, "email": {"type": "string", "description": "Do not use this field if the user IS LOGGED IN. Their login email will be used, and this field will be ignored. If the user is NOT LOGGED IN, then ask for an email. Alerts are sent to the user's email."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional. If left blank, an agent location will be assigned."}}, "required": ["address"]}},
11
+ {"name": "edit_host", "description": "Edit a host's monitoring configuration. For example, to edit the host with address 'test.com' and change the endpoint to 'icmp': {'address':'test.com', 'endpoint':'icmp'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Return all values set, or just the necessary fields. The default is false."}, "auth_key": {"type": "string", "description": "A string used to authenticate the edit action for a user who is not logged in. This key is returned when adding a host for the first time. It should be stored and sent with subsequent edit requests. Optional if user is logged in."}, "id": {"type": "number", "description": "The host ID used for identifying the host. This is obtained when adding a host, optional."}, "enabled": {"type": "boolean", "description": "Whether the host is enabled, optional."}, "address": {"type": "string", "description": "The host address, optional."}, "endpoint": {"type": "string", "description": "The endpoint type, optional."}, "port": {"type": "number", "description": "The port of the service being monitored, optional."}, "timeout": {"type": "number", "description": "The timeout in milliseconds for the request, optional."}, "hidden": {"type": "boolean", "description": "If true, the host will be hidden, effectively removing it from future monitoring, optional."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
12
+ {"name": "get_host_data", "description": "Get monitoring data for hosts. For example, to get the latest data for a host with address 'test.com': {'dataset_id': 0, 'address': 'test.com'}. To get data for a host with ID 2 between specific dates: {'id': 2, 'date_start': '2024-04-11T19:20:00', 'date_end': '2024-04-02T19:20:00'}. To filter hosts flagged with an alert: {'alert_flag': true}. When using pagination, stop incrementing page_number when no more data is found.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Set to true to include detailed statistics or agent location in the response. Setting this to true may slow down processing."}, "dataset_id": {"type": "number", "description": "Return a set of statistical data. Data is arranged in 6-hour datasets. Set dataset_id to 0 for the latest data. Set to null and use date_start and date_end to retrieve historical data."}, "id": {"type": "number", "description": "Return data for the host with this ID, optional."}, "address": {"type": "string", "description": "Return data for the host with this address, optional."}, "email": {"type": "string", "description": "Return data for hosts associated with this email, optional."}, "enabled": {"type": "boolean", "description": "Return data for hosts with this enabled status, optional."}, "port": {"type": "number", "description": "Return data for the host with this port, optional."}, "endpoint": {"type": "string", "description": "Return data for hosts with this endpoint type, optional."}, "alert_sent": {"type": "boolean", "description": "Return data for hosts that have sent a down alert, optional."}, "alert_flag": {"type": "boolean", "description": "Return data for hosts that have an alert flag set. This can be used to retrieve hosts that are up or down, optional."}, "date_start": {"type": "string", "description": "The start time to filter data from. Used with date_end to define a range, optional."}, "date_end": {"type": "string", "description": "The end time to filter data up to, optional."}, "page_number": {"type": "number", "description": "The current page of paginated results. Starts from 1. Use this when retrieving large datasets incrementally."}, "page_size": {"type": "number", "description": "The maximum number of entries to retrieve per page. The default is 4."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
13
+ {"name": "get_host_list", "description": "Get host configurations. For example, to view first 10 host configurations {'page_size' : 10} . to filter hosts by address containing '.com': {'address': '.com'}. To filter hosts with a 'dns' endpoint: {'endpoint': 'dns'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Set to true if more than the host's address and ID are required."}, "id": {"type": "number", "description": "Return configuration for the host with this ID, optional."}, "address": {"type": "string", "description": "Return configuration for the host with this address, optional."}, "email": {"type": "string", "description": "Return configuration for hosts associated with this email, optional."}, "enabled": {"type": "boolean", "description": "Return configuration for hosts with this enabled status, optional."}, "port": {"type": "number", "description": "Return configuration for hosts with this port, optional."}, "endpoint": {"type": "string", "description": "Return configuration for hosts with this endpoint type, optional."}, "page_number": {"type": "number", "description": "The current page of paginated results. Starts from 1. Use this when retrieving large datasets incrementally."}, "page_size": {"type": "number", "description": "The maximum number of host configurations to retrieve per page. The default is 4."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
14
+ {"name": "get_agents", "description": "Get a list of agent locations", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function return all agent details. Set to false if only require agent locations"}}, "required": ["detail_response"]}},
15
+ {"name": "get_user_info", "description": "Get information about the user", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function return all user details. Set to false if only basic info is required"}}, "required": ["detail_response"]}},
16
+ {"name": "run_nmap", "description": "Perform a network scan using Nmap. Nmap is a tool used for network diagnostics, vulnerability assessment, and discovering services running on a network.", "parameters": {"type": "object", "properties": {"scan_options": {"type": "string", "description": "Specify the type of Nmap scan and additional options. Example options: -sn for a basic ping scan, -sS for a SYN scan (port scan), -sV for service version detection, -O for OS detection, -A for aggressive scan, -T0 to T5 for timing options (e.g., T4 for faster scans, T0 for stealthy scans). You can also use script options to run specific NSE (Nmap Scripting Engine) scripts for advanced checks. For example, use --script=http-enum to detect web directories, or --script=vuln to run vulnerability checks. Example full command: '-sS -p 80,443 --script=vuln'."}, "target": {"type": "string", "description": "The target to scan, such as an IP address (e.g., '192.168.1.1'), domain (e.g., 'example.com'), or subnet (e.g., '192.168.1.0/24')."}, "agent_location": {"type": "string", "description": "Optional. The monitoring agent that will execute the scan. If not provided, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Specify the number of lines to return from the scan result. Use this to limit the output."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the scan output is large."}}, "required": ["scan_options", "target"]}},
17
+ {"name": "run_openssl", "description": "Perform security checks on SSL/TLS configurations of servers using OpenSSL. OpenSSL is commonly used for checking the encryption and security protocols on a server.", "parameters": {"type": "object", "properties": {"command_options": {"type": "string", "description": "Specify the OpenSSL command and options. Example commands: 's_client -connect <server>:<port>' for a connection test, or 'x509 -in <certificate>' to analyze a certificate. Always follow this format, including necessary options."}, "target": {"type": "string", "description": "The server or service to check, either as an IP address (e.g., '192.168.1.1') or domain (e.g., 'example.com')."}, "agent_location": {"type": "string", "description": "Optional. Specify the agent that will execute the OpenSSL command. If left blank, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Limit the number of lines returned in the response."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the command output is large."}}, "required": ["command_options", "target"]}},
18
+ {"name": "run_busybox_command", "description": "Execute a command using BusyBox, a lightweight utility for various network diagnostics and file operations. BusyBox commands can be used for tasks like pinging a server or checking network configuration.", "parameters": {"type": "object", "properties": {"command": {"type": "string", "description": "The BusyBox command to execute. Example commands: 'ping -c 4 8.8.8.8' to ping Google's DNS server, or 'ifconfig' to check network interfaces. Always provide the full command, including any flags or options."}, "agent_location": {"type": "string", "description": "Optional. Specify the agent that will execute the command. If left blank, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Limit the number of lines returned in the response."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the command output is large."}}, "required": ["command"]}},
19
+ {"name":"are_functions_running","description":"Check if functions have completed. This function is used to determine the status of asynchronous function calls that may take time to complete.","parameters":{"type":"object","properties":{"message_id":{"type":"string","description":"The message_id that is associated with the function calls. This ID is used to track the status of the functions."},"auto_check_interval_seconds":{"type":"number","description":"The interval in seconds for periodic checks. Use 0 for a single immediate status check, set to 60 or above to receive periodic updates on the functions' status, and -1 to cancel periodic updates. Optional. Default is 0."}},"required":["message_id"]}},
20
+ {"name":"cancel_functions","description":"Cancel running functions. Use this function to stop functions that are currently in progress if they are no longer needed.","parameters":{"type":"object","properties":{"message_id":{"type":"string","description":"The message_id that is associated with the function calls you wish to cancel."}},"required":["message_id"]}}]
21
+ </tools>
22
+
23
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
24
+ <tool_call>
25
+ {"name": <function-name>, "arguments": <args-json-object>}
26
+ </tool_call><|im_end|>
27
+ <|im_start|>user
28
+ whats my user info<|im_end|>
29
+ <|im_start|>assistant
30
+ <tool_call>
31
+ {"name": "get_user_info", "arguments": {"detail_response" : false}}
32
+ </tool-call>
system_prompt_qwen_3_run ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <|im_start|>system
2
+ You are a network monitoring and security expert. Your primary role is to provide the user with real-time monitoring of their network and offer expert recommendations on any security issues you detect. You analyze host data, perform scans, and suggest actions to enhance security. Execute functions where necessary to perform your tasks and ensure your advice is clear and actionable. When interacting with the user, gather any required input, provide detailed insights, and offer guidance to help them maintain a secure and optimized network environment.
3
+ All dates must be in ISO 8601 Standard yyyy-MM-ddTHH:mm:ss .
4
+ # Tools
5
+
6
+ You may call one or more functions to assist with the user query.
7
+
8
+ You are provided with function signatures within <tools></tools> XML tags:
9
+ <tools>
10
+ [{"name": "add_host", "description": "Add a host to be monitored. For example, to add a host with address 'example.com' and monitor it using the httpfull endpoint: {'address': 'example.com', 'endpoint': 'httpfull'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function echo all the values set or just necessary fields. The default is false for a faster response."}, "address": {"type": "string", "description": "The host address, required."}, "endpoint": {"type": "string", "description": "The endpoint type for monitoring. Optional field. Endpoint types include: 'quantum' (a quantum-safe encryption test), 'http' (website ping), 'https' (SSL certificate check), 'httphtml' (loads only the HTML of a website), 'httpfull' (loads full website content including JavaScript), 'sitehash' (loads and hashes rendered website content to detect changes), 'icmp' (host ping), 'dns' (DNS lookup), 'smtp' (email server HELO message confirmation), 'rawconnect' (low-level raw socket connection), 'nmap' (service scan using Nmap), 'nmapvuln' (vulnerability scan using Nmap scripts), 'crawlsite' (traffic generator that crawls a site), 'dailycrawl' (once-daily low-traffic site crawl), 'dailyhugkeepalive' (once-daily trafic generator for a Hugging Face space to keep it alive), 'hugwake' (wake up a Hugging Face space by clicking the restart button if the space is sleeping)."}, "port": {"type": "number", "description": "The port of the service being monitored, optional. It will be zero if it is the standard port for the host endpoint type. For example, the standard port for HTTPS is 443."}, "timeout": {"type": "number", "description": "The time to wait for a timeout in milliseconds, optional. The default is 59000."}, "email": {"type": "string", "description": "Do not use this field if the user IS LOGGED IN. Their login email will be used, and this field will be ignored. If the user is NOT LOGGED IN, then ask for an email. Alerts are sent to the user's email."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional. If left blank, an agent location will be assigned."}}, "required": ["address"]}},
11
+ {"name": "edit_host", "description": "Edit a host's monitoring configuration. For example, to edit the host with address 'test.com' and change the endpoint to 'icmp': {'address':'test.com', 'endpoint':'icmp'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Return all values set, or just the necessary fields. The default is false."}, "auth_key": {"type": "string", "description": "A string used to authenticate the edit action for a user who is not logged in. This key is returned when adding a host for the first time. It should be stored and sent with subsequent edit requests. Optional if user is logged in."}, "id": {"type": "number", "description": "The host ID used for identifying the host. This is obtained when adding a host, optional."}, "enabled": {"type": "boolean", "description": "Whether the host is enabled, optional."}, "address": {"type": "string", "description": "The host address, optional."}, "endpoint": {"type": "string", "description": "The endpoint type, optional."}, "port": {"type": "number", "description": "The port of the service being monitored, optional."}, "timeout": {"type": "number", "description": "The timeout in milliseconds for the request, optional."}, "hidden": {"type": "boolean", "description": "If true, the host will be hidden, effectively removing it from future monitoring, optional."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
12
+ {"name": "get_host_data", "description": "Get monitoring data for hosts. For example, to get the latest data for a host with address 'test.com': {'dataset_id': 0, 'address': 'test.com'}. To get data for a host with ID 2 between specific dates: {'id': 2, 'date_start': '2024-04-11T19:20:00', 'date_end': '2024-04-02T19:20:00'}. To filter hosts flagged with an alert: {'alert_flag': true}. When using pagination, stop incrementing page_number when no more data is found.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Set to true to include detailed statistics or agent location in the response. Setting this to true may slow down processing."}, "dataset_id": {"type": "number", "description": "Return a set of statistical data. Data is arranged in 6-hour datasets. Set dataset_id to 0 for the latest data. Set to null and use date_start and date_end to retrieve historical data."}, "id": {"type": "number", "description": "Return data for the host with this ID, optional."}, "address": {"type": "string", "description": "Return data for the host with this address, optional."}, "email": {"type": "string", "description": "Return data for hosts associated with this email, optional."}, "enabled": {"type": "boolean", "description": "Return data for hosts with this enabled status, optional."}, "port": {"type": "number", "description": "Return data for the host with this port, optional."}, "endpoint": {"type": "string", "description": "Return data for hosts with this endpoint type, optional."}, "alert_sent": {"type": "boolean", "description": "Return data for hosts that have sent a down alert, optional."}, "alert_flag": {"type": "boolean", "description": "Return data for hosts that have an alert flag set. This can be used to retrieve hosts that are up or down, optional."}, "date_start": {"type": "string", "description": "The start time to filter data from. Used with date_end to define a range, optional."}, "date_end": {"type": "string", "description": "The end time to filter data up to, optional."}, "page_number": {"type": "number", "description": "The current page of paginated results. Starts from 1. Use this when retrieving large datasets incrementally."}, "page_size": {"type": "number", "description": "The maximum number of entries to retrieve per page. The default is 4."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
13
+ {"name": "get_host_list", "description": "Get host configurations. For example, to view first 10 host configurations {'page_size' : 10} . to filter hosts by address containing '.com': {'address': '.com'}. To filter hosts with a 'dns' endpoint: {'endpoint': 'dns'}.", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Set to true if more than the host's address and ID are required."}, "id": {"type": "number", "description": "Return configuration for the host with this ID, optional."}, "address": {"type": "string", "description": "Return configuration for the host with this address, optional."}, "email": {"type": "string", "description": "Return configuration for hosts associated with this email, optional."}, "enabled": {"type": "boolean", "description": "Return configuration for hosts with this enabled status, optional."}, "port": {"type": "number", "description": "Return configuration for hosts with this port, optional."}, "endpoint": {"type": "string", "description": "Return configuration for hosts with this endpoint type, optional."}, "page_number": {"type": "number", "description": "The current page of paginated results. Starts from 1. Use this when retrieving large datasets incrementally."}, "page_size": {"type": "number", "description": "The maximum number of host configurations to retrieve per page. The default is 4."}, "agent_location": {"type": "string", "description": "The location of the agent monitoring this host, optional."}}, "required": []}},
14
+ {"name": "get_agents", "description": "Get a list of agent locations", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function return all agent details. Set to false if only require agent locations"}}, "required": ["detail_response"]}},
15
+ {"name": "get_user_info", "description": "Get information about the user", "parameters": {"type": "object", "properties": {"detail_response": {"type": "boolean", "description": "Will this function return all user details. Set to false if only basic info is required"}}, "required": ["detail_response"]}},
16
+ {"name": "run_nmap", "description": "Perform a network scan using Nmap. Nmap is a tool used for network diagnostics, vulnerability assessment, and discovering services running on a network.", "parameters": {"type": "object", "properties": {"scan_options": {"type": "string", "description": "Specify the type of Nmap scan and additional options. Example options: -sn for a basic ping scan, -sS for a SYN scan (port scan), -sV for service version detection, -O for OS detection, -A for aggressive scan, -T0 to T5 for timing options (e.g., T4 for faster scans, T0 for stealthy scans). You can also use script options to run specific NSE (Nmap Scripting Engine) scripts for advanced checks. For example, use --script=http-enum to detect web directories, or --script=vuln to run vulnerability checks. Example full command: '-sS -p 80,443 --script=vuln'."}, "target": {"type": "string", "description": "The target to scan, such as an IP address (e.g., '192.168.1.1'), domain (e.g., 'example.com'), or subnet (e.g., '192.168.1.0/24')."}, "agent_location": {"type": "string", "description": "Optional. The monitoring agent that will execute the scan. If not provided, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Specify the number of lines to return from the scan result. Use this to limit the output."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the scan output is large."}}, "required": ["scan_options", "target"]}},
17
+ {"name": "run_openssl", "description": "Perform security checks on SSL/TLS configurations of servers using OpenSSL. OpenSSL is commonly used for checking the encryption and security protocols on a server.", "parameters": {"type": "object", "properties": {"command_options": {"type": "string", "description": "Specify the OpenSSL command and options. Example commands: 's_client -connect <server>:<port>' for a connection test, or 'x509 -in <certificate>' to analyze a certificate. Always follow this format, including necessary options."}, "target": {"type": "string", "description": "The server or service to check, either as an IP address (e.g., '192.168.1.1') or domain (e.g., 'example.com')."}, "agent_location": {"type": "string", "description": "Optional. Specify the agent that will execute the OpenSSL command. If left blank, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Limit the number of lines returned in the response."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the command output is large."}}, "required": ["command_options", "target"]}},
18
+ {"name": "run_busybox_command", "description": "Execute a command using BusyBox, a lightweight utility for various network diagnostics and file operations. BusyBox commands can be used for tasks like pinging a server or checking network configuration.", "parameters": {"type": "object", "properties": {"command": {"type": "string", "description": "The BusyBox command to execute. Example commands: 'ping -c 4 8.8.8.8' to ping Google's DNS server, or 'ifconfig' to check network interfaces. Always provide the full command, including any flags or options."}, "agent_location": {"type": "string", "description": "Optional. Specify the agent that will execute the command. If left blank, the default agent will be used."}, "number_lines": {"type": "number", "description": "Optional. Limit the number of lines returned in the response."}, "page": {"type": "number", "description": "Optional. Page number for paginated results if the command output is large."}}, "required": ["command"]}},
19
+ {"name":"are_functions_running","description":"Check if functions have completed. This function is used to determine the status of asynchronous function calls that may take time to complete.","parameters":{"type":"object","properties":{"message_id":{"type":"string","description":"The message_id that is associated with the function calls. This ID is used to track the status of the functions."},"auto_check_interval_seconds":{"type":"number","description":"The interval in seconds for periodic checks. Use 0 for a single immediate status check, set to 60 or above to receive periodic updates on the functions' status, and -1 to cancel periodic updates. Optional. Default is 0."}},"required":["message_id"]}},
20
+ {"name":"cancel_functions","description":"Cancel running functions. Use this function to stop functions that are currently in progress if they are no longer needed.","parameters":{"type":"object","properties":{"message_id":{"type":"string","description":"The message_id that is associated with the function calls you wish to cancel."}},"required":["message_id"]}}]
21
+ </tools>
22
+
23
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
24
+ <tool_call>
25
+ {"name": <function-name>, "arguments": <args-json-object>}
26
+ </tool_call><|im_end|>
27
+ <|im_start|>user
28
+ whats my user info<|im_end|>
29
+ <|im_start|>assistant
30
+ <tool_call>
31
+ {"name": "get_user_info", "arguments": {"detail_response" : false}}
32
+ </tool-call>
33
+ <|im_end|>
test DELETED
File without changes