Skip to content

Commit dab7410

Browse files
.
1 parent 189a721 commit dab7410

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from portkey_app import execute_chat_completion
2+
from tests.test_integrations.utils import generate_test_json
3+
4+
generate_test_json(execute_chat_completion, "portkey_app.json")
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"agentSpans": [],
3+
"baseSpans": [],
4+
"endTime": "2025-09-14T14:32:55.155Z",
5+
"environment": "development",
6+
"input": {},
7+
"llmSpans": [
8+
{
9+
"endTime": "2025-09-14T14:32:55.155Z",
10+
"input": [
11+
{
12+
"content": "Hello, how are you?",
13+
"role": "user"
14+
}
15+
],
16+
"metricCollection": "test_collection_1",
17+
"model": "gpt-4o",
18+
"name": "LLM",
19+
"output": [
20+
{
21+
"content": "<is_present>",
22+
"role": "AI"
23+
}
24+
],
25+
"prompt": {},
26+
"startTime": "2025-09-14T14:32:53.801Z",
27+
"status": "SUCCESS",
28+
"type": "llm",
29+
"uuid": "<is_present>"
30+
}
31+
],
32+
"metricCollection": "test_collection_1",
33+
"output": [
34+
{
35+
"content": "<is_present>",
36+
"role": "AI"
37+
}
38+
],
39+
"retrieverSpans": [],
40+
"startTime": "2025-09-14T14:32:53.801Z",
41+
"status": "SUCCESS",
42+
"toolSpans": [],
43+
"uuid": "<is_present>"
44+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
import os
3+
import sys
4+
import tempfile
5+
from dotenv import load_dotenv
6+
from portkey_app import execute_chat_completion
7+
from tests.test_integrations.utils import compare_trace_files
8+
9+
load_dotenv()
10+
11+
def test_exec_agent_logs():
12+
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
13+
tmp_path = tmp.name
14+
tmp.close()
15+
16+
try:
17+
original_argv = list(sys.argv)
18+
sys.argv = ["--deepeval-trace-mode=gen", f"--deepeval-trace-file-name={tmp_path}"]
19+
execute_chat_completion()
20+
sys.argv = original_argv
21+
expected_path = os.path.join(os.path.dirname(__file__), "portkey_app.json")
22+
compare_trace_files(expected_path, tmp_path)
23+
finally:
24+
if os.path.exists(tmp_path):
25+
os.remove(tmp_path)

0 commit comments

Comments
 (0)