mirror of
https://github.com/dataforcanada/d4c-service-geo-assistant.git
synced 2026-06-13 14:31:01 +02:00
Add satellite image summarization tool (#7)
* Add dspy & jupyterlab as dependency * Add image summarizer agent tool * Add test for summarize tool * Remove try except --------- Co-authored-by: Daniel Wiesmann <yellowcap@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bcc331bd5e
commit
2d34ee0a16
@@ -0,0 +1,30 @@
|
||||
"""Tests for the satellite image summarization tool."""
|
||||
|
||||
import pytest
|
||||
import uuid
|
||||
|
||||
from langchain_core.tools.base import ToolCall
|
||||
from geo_assistant.tools.summarize import summarize_sat_img
|
||||
|
||||
# Sample test data
|
||||
TEST_IMAGE_URL = "https://petapixel.com/assets/uploads/2022/08/French-Officials-Use-Satellite-Photos-and-AI-to-Spot-Unregistered-Pools-1536x806.jpg"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"img_url,summary",
|
||||
[
|
||||
(TEST_IMAGE_URL, "building"),
|
||||
],
|
||||
)
|
||||
def test_summarize_sat_img(img_url, summary):
|
||||
command = summarize_sat_img.invoke(
|
||||
ToolCall(
|
||||
name="summarize_sat_img",
|
||||
type="tool_call",
|
||||
args={"img_url": img_url},
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
)
|
||||
|
||||
print(command.update.get("messages"))
|
||||
assert summary in command.update.get("messages")[-1].content
|
||||
Reference in New Issue
Block a user