mirror of https://github.com/aliasrobotics/cai.git
Add skelethon for first example
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
This commit is contained in:
parent
cbc064d1ae
commit
120345240b
|
|
@ -1,4 +1,4 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
doc// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/python-3
|
||||
{
|
||||
"name": "exploitflow_devenv",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
from cai import CAI, Agent
|
||||
import pentestperf as ptt
|
||||
|
||||
client = CAI()
|
||||
|
||||
english_agent = Agent(
|
||||
model="qwen2.5:14b",
|
||||
name="A file listing tool",
|
||||
instructions="You only speak English. If another language is detected, invoke transfer_to_spanish_agent.",
|
||||
# instructions="You only speak English.",
|
||||
# tool_choice="required", # not working with ollama and qwen2.5
|
||||
)
|
||||
|
||||
spanish_agent = Agent(
|
||||
name="Spanish Agent",
|
||||
instructions="You only speak Spanish.",
|
||||
)
|
||||
|
||||
|
||||
def transfer_to_spanish_agent():
|
||||
"""Transfer spanish speaking users immediately."""
|
||||
return spanish_agent
|
||||
|
||||
|
||||
english_agent.functions.append(transfer_to_spanish_agent)
|
||||
messages = [{"role": "user", "content": "Hola, cómo estás?"}]
|
||||
|
||||
|
||||
response = client.run(agent=english_agent, messages=messages, debug=True)
|
||||
print(response.messages[-1]["content"])
|
||||
|
||||
|
||||
# # PentestPerf setup for "picoctf_static_flag"
|
||||
# ctf = ptt.ctf(
|
||||
# "picoctf_static_flag",
|
||||
# subnet="192.168.9.0/24",
|
||||
# container_name="ancient",
|
||||
# ip_address="192.168.9.52",
|
||||
# )
|
||||
# ctf.start_ctf()
|
||||
# flag = ctf.get_flag()
|
||||
# ctf.stop_ctf()
|
||||
Loading…
Reference in New Issue