spidey121 commited on
Commit
5600c08
·
1 Parent(s): 2b683c3

fix round 1

Browse files
Files changed (1) hide show
  1. inference.py +15 -5
inference.py CHANGED
@@ -1,4 +1,4 @@
1
- import time
2
  import os
3
  import random
4
  import traceback
@@ -28,7 +28,17 @@ def choose_action(client, state):
28
  messages=[
29
  {
30
  "role": "system",
31
- "content": "You are a cybersecurity deception agent. Choose one action from: detect_attack, deploy_honeypot, fake_database, block_ip"
 
 
 
 
 
 
 
 
 
 
32
  },
33
  {
34
  "role": "user",
@@ -36,7 +46,7 @@ def choose_action(client, state):
36
  }
37
  ],
38
  max_tokens=10,
39
- temperature=0.3
40
  )
41
 
42
  action = response.choices[0].message.content.strip()
@@ -82,8 +92,8 @@ def run_task(task_name):
82
  # AI chooses action
83
  action = choose_action(client, state)
84
 
85
- # exploration
86
- if random.random() < 0.2:
87
  action = random.choice(env.action_space())
88
 
89
  # fallback
 
1
+ kimport time
2
  import os
3
  import random
4
  import traceback
 
28
  messages=[
29
  {
30
  "role": "system",
31
+ "content": """You are a cybersecurity deception agent.
32
+
33
+ Choose the best action based on the state:
34
+
35
+ - detect_attack → when attacks suspected
36
+ - deploy_honeypot → after attack detected
37
+ - fake_database → when attacker probing system
38
+ - block_ip → when attacker confirmed
39
+
40
+ Return only one action from:
41
+ detect_attack, deploy_honeypot, fake_database, block_ip"""
42
  },
43
  {
44
  "role": "user",
 
46
  }
47
  ],
48
  max_tokens=10,
49
+ temperature=0.4
50
  )
51
 
52
  action = response.choices[0].message.content.strip()
 
92
  # AI chooses action
93
  action = choose_action(client, state)
94
 
95
+ # exploration (30%)
96
+ if random.random() < 0.3:
97
  action = random.choice(env.action_space())
98
 
99
  # fallback