add env variables
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import json
|
|
|
2 |
import invariant.testing.functional as F
|
3 |
from invariant.testing import TraceFactory, assert_true
|
4 |
from agent import SantaAgent
|
@@ -17,14 +18,21 @@ def run_agent(user_prompt, history, invariant_api_key):
|
|
17 |
|
18 |
agent_params = {"system_prompt": user_prompt}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# run command invariant test test_agent.py --agent-params '{"system_prompt": "you are santa"}'
|
21 |
import subprocess
|
22 |
out = subprocess.run([
|
23 |
-
"INVARIANT_API_KEY=" + invariant_api_key,
|
24 |
"invariant", "test", "test_agent.py",
|
25 |
"--agent-params", json.dumps(agent_params),
|
26 |
"--push", "--dataset_name", "santa_agent",
|
27 |
-
], capture_output=True, text=True)
|
28 |
print(out.stdout)
|
29 |
print(out.stderr)
|
30 |
|
|
|
1 |
import json
|
2 |
+
import os
|
3 |
import invariant.testing.functional as F
|
4 |
from invariant.testing import TraceFactory, assert_true
|
5 |
from agent import SantaAgent
|
|
|
18 |
|
19 |
agent_params = {"system_prompt": user_prompt}
|
20 |
|
21 |
+
|
22 |
+
env={
|
23 |
+
"INVARIANT_API_KEY": invariant_api_key,
|
24 |
+
"OPENAI_API_KEY": os.environ["OPENAI_API_KEY"],
|
25 |
+
"PATH": os.environ["PATH"]
|
26 |
+
}
|
27 |
+
# env = None
|
28 |
+
|
29 |
# run command invariant test test_agent.py --agent-params '{"system_prompt": "you are santa"}'
|
30 |
import subprocess
|
31 |
out = subprocess.run([
|
|
|
32 |
"invariant", "test", "test_agent.py",
|
33 |
"--agent-params", json.dumps(agent_params),
|
34 |
"--push", "--dataset_name", "santa_agent",
|
35 |
+
], capture_output=True, text=True, env=env)
|
36 |
print(out.stdout)
|
37 |
print(out.stderr)
|
38 |
|