Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test Python

on:
push:
branches:
- main
pull_request:

permissions:
contents: read # Required to checkout repository

jobs:
pytest:
name: Pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Install a specific version of uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
version: "latest"

- name: Install dependencies
run: uv sync

- name: Run pytest
run: uv run pytest --verbose
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/geo_assistant"]

[tool.pytest.ini_options]
addopts = "--color=yes"
asyncio_mode = "auto"
10 changes: 6 additions & 4 deletions src/geo_assistant/tools/overture.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
from typing import Annotated

import duckdb
import json
from langchain_core.tools import tool
from langgraph.types import Command
from langchain_core.messages import ToolMessage
from langchain_core.tools import tool
from langchain_core.tools.base import InjectedToolCallId
from langgraph.types import Command


def create_database_connection():
Expand All @@ -15,6 +16,7 @@ def create_database_connection():

Returns:
Configured DuckDB connection

"""
connection = duckdb.connect()
connection.execute("INSTALL spatial;")
Expand All @@ -25,7 +27,7 @@ def create_database_connection():


@tool
def get_place(
async def get_place(
place_name: str, tool_call_id: Annotated[str, InjectedToolCallId] = ""
) -> Command:
"""Get place location from Overture Maps based on user input place name."""
Expand Down
45 changes: 0 additions & 45 deletions tests/test_api.py

This file was deleted.

7 changes: 4 additions & 3 deletions tests/tools/test_overture.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from langchain_core.tools.base import ToolCall

from geo_assistant.tools.overture import get_place


def test_get_place():
command = get_place.invoke(
async def test_get_place():
command = await get_place.ainvoke(
ToolCall(
name="get_place",
type="tool_call",
id="test_id",
args={"place_name": "Neighboourhood Cafe Lisbon"},
args={"place_name": "Neighbourhood Cafe Lisbon"},
)
)
assert "place" in command.update
Loading