From 8bcae34b9d71247880d949450fd6de76806d2c47 Mon Sep 17 00:00:00 2001 From: Yazhou Cao Date: Mon, 13 May 2024 10:43:45 -0700 Subject: [PATCH 1/4] Add runtime tag in CI job --- .github/workflows/ci_cd.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 56c31d19..75c64236 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -12,6 +12,8 @@ jobs: python-version: [3.9, 3.11] os: [ ubuntu-22.04, windows-2022, macos-12 ] runs-on: ${{ matrix.os }} + env: + RUNTIME_TAG: ci_job steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 62311eddede0c8ef805a924b8954f77c0220b0dd Mon Sep 17 00:00:00 2001 From: Yazhou Cao Date: Mon, 13 May 2024 10:48:25 -0700 Subject: [PATCH 2/4] Improve test robustness --- tests/test_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_tools.py b/tests/test_tools.py index b35cd7e3..c7d33acc 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -10,7 +10,7 @@ def test_grounding_dino(): prompt="coin", image=img, ) - assert result["labels"] == ["coin"] * 24 + assert [l.strip() for l in result["labels"]] == ["coin"] * 24 assert len(result["bboxes"]) == 24 assert len(result["scores"]) == 24 From f52282ef7a6647a599a61502e5529ce8be27d688 Mon Sep 17 00:00:00 2001 From: Yazhou Cao Date: Mon, 13 May 2024 10:58:36 -0700 Subject: [PATCH 3/4] Revert change --- tests/test_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_tools.py b/tests/test_tools.py index c7d33acc..b35cd7e3 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -10,7 +10,7 @@ def test_grounding_dino(): prompt="coin", image=img, ) - assert [l.strip() for l in result["labels"]] == ["coin"] * 24 + assert result["labels"] == ["coin"] * 24 assert len(result["bboxes"]) == 24 assert len(result["scores"]) == 24 From a528b0dda6a86af6f7dcc21ae341f6352c6f21c1 Mon Sep 17 00:00:00 2001 From: Yazhou Cao Date: Mon, 13 May 2024 11:26:01 -0700 Subject: [PATCH 4/4] Use http body instead of header for runtime_tag --- vision_agent/tools/tool_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vision_agent/tools/tool_utils.py b/vision_agent/tools/tool_utils.py index f0304653..b87689c4 100644 --- a/vision_agent/tools/tool_utils.py +++ b/vision_agent/tools/tool_utils.py @@ -14,14 +14,13 @@ def _send_inference_request( payload: Dict[str, Any], endpoint_name: str ) -> Dict[str, Any]: - # runtime_tag is used to differentiate different internal callers - runtime_tag = os.environ.get("RUNTIME_TAG", "") + if runtime_tag := os.environ.get("RUNTIME_TAG", ""): + payload["runtime_tag"] = runtime_tag res = requests.post( f"{_LND_API_URL}/model/{endpoint_name}", headers={ "Content-Type": "application/json", "apikey": _LND_API_KEY, - "runtime-tag": runtime_tag, }, json=payload, )