-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide the LLM the ability to fetch all or specific container logs w…
…ithin a pod (#207) - Adds a handful of tools for LLM to get all container logs from a pod - Tags llm tests and run these only once per push
- Loading branch information
Showing
9 changed files
with
242 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Evaluate LLM test cases | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Python dependencies and build | ||
# if you change something here, you must also change it in .github/workflows/build-binaries-and-brew.yaml | ||
run: | | ||
python -m pip install --upgrade pip setuptools pyinstaller | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
poetry config virtualenvs.create false | ||
poetry install --no-root | ||
poetry run python -m playwright install --with-deps firefox | ||
- name: Run tests | ||
shell: bash | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
run: | | ||
poetry run pytest -m "llm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
[pytest] | ||
markers = | ||
llm: Evaluate LLM behaviour (prompt, tools, etc.) |
100 changes: 100 additions & 0 deletions
100
tests/fixtures/test_chat/8_multi_container_pod/kubectl_container_logs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{"toolset_name":"kubernetes/core","tool_name":"kubectl_container_logs","match_params":{"pod_name":"customer-orders-67889fd856-k94k7","container_name":"fastapi-app","namespace":"default"}} | ||
stdout: | ||
INFO: Started server process [1] | ||
INFO: Waiting for application startup. | ||
INFO: Application startup complete. | ||
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) | ||
INFO: 10.244.0.16:46364 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:33610 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:47000 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:53562 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO: 10.244.0.16:59206 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Database call completed in 8.01 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 8.01 seconds. | ||
INFO: 127.0.0.1:34748 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:56156 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:41600 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:35976 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:35584 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO:app:Database call completed in 7.00 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 7.00 seconds. | ||
INFO: 127.0.0.1:59258 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:39944 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:39850 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:55216 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:51152 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO: 10.244.0.16:47072 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Database call completed in 9.00 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 9.00 seconds. | ||
INFO: 127.0.0.1:39504 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:42586 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:52628 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:38852 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:40626 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO:app:Database call completed in 7.01 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 7.01 seconds. | ||
INFO: 127.0.0.1:49094 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:34684 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:43422 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:49774 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:57556 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO: 10.244.0.16:58876 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Database call completed in 8.01 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 8.01 seconds. | ||
INFO: 127.0.0.1:45622 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:44866 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:54794 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:39550 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:49456 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO:app:Database call completed in 8.01 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 8.01 seconds. | ||
INFO: 127.0.0.1:55750 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:55426 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:55114 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:33410 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:40844 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Received request for checkout page. | ||
INFO:app:Connecting to promotions database to see if we should try to upsell user | ||
INFO:app:Connecting to database at None | ||
INFO:app:Fetching data using stored procedure: sp_CheckUserNotifications | ||
INFO: 10.244.0.16:38884 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO:app:Database call completed in 7.01 seconds. | ||
INFO:app:Promotions result: True | ||
INFO:app:Page rendered in 7.01 seconds. | ||
INFO: 127.0.0.1:50872 - "GET / HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:40396 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:40466 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:58458 - "GET /metrics HTTP/1.1" 200 OK | ||
INFO: 10.244.0.16:34996 - "GET /metrics HTTP/1.1" 200 OK | ||
|
||
stderr: |
65 changes: 65 additions & 0 deletions
65
tests/fixtures/test_chat/8_multi_container_pod/kubectl_logs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{"toolset_name":"kubernetes/core","tool_name":"kubectl_logs","match_params":{"name":"customer-orders-67889fd856-k94k7","namespace":"default"}} | ||
stdout: | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
<html> | ||
<head> | ||
<title>Checkout Status</title> | ||
</head> | ||
<body> | ||
<h1>Success!</h1> | ||
<p>Promotions: True</p> | ||
</body> | ||
</html> | ||
|
||
stderr: | ||
Defaulted container "curl-sidecar" out of: curl-sidecar, fastapi-app |
6 changes: 6 additions & 0 deletions
6
tests/fixtures/test_chat/8_multi_container_pod/kubectl_logs_grep.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"toolset_name":"kubernetes/core","tool_name":"kubectl_logs_grep","match_params":{"name":"customer-orders-67889fd856-k94k7","namespace":"default","search_term":"render time"}} | ||
Command `kubectl logs customer-orders-67889fd856-k94k7 -n default | grep 'render time'` failed with return code 1 | ||
stdout: | ||
|
||
stderr: | ||
Defaulted container "curl-sidecar" out of: curl-sidecar, fastapi-app |
6 changes: 6 additions & 0 deletions
6
tests/fixtures/test_chat/8_multi_container_pod/test_case.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
user_prompt: "How are the page render times for pod customer-orders-67889fd856-k94k7" | ||
expected_output: "Page render times for `customer-orders-67889fd856-k94k7` range from 7.00 to 9.00 seconds." | ||
evaluation: | ||
answer_relevancy: .5 | ||
faithfulness: .5 | ||
contextual_precision: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters