HTTP API

The HTTP layer is intentionally thin. Channel wrappers should call it, but the business rules stay inside Alba Core.

class app.api.routes.SearchRequest(*, message: Annotated[str, MinLen(min_length=1)], current_requirements: dict[str, Any] | None = None)[source]

Request body for a single Alba Core search turn.

current_requirements lets a channel wrapper continue a line-by-line conversation without Alba Core needing to know where the message came from.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

app.api.routes.search(request: SearchRequest) dict[str, Any][source]

Run the public Alba Core search endpoint.

Example: request body

{
  "message": "Find me a house in Auckland with 4 bedrooms under 5000",
  "current_requirements": null
}

Example: curl

curl -X POST "http://127.0.0.1:65385/alba-core/search" \
  -H "Content-Type: application/json" \
  -d "{\"message\":\"Find me a house in Auckland with 4 bedrooms under 5000\"}"

Example: Python client

import httpx

response = httpx.post(
    "http://127.0.0.1:65385/alba-core/search",
    json={"message": "Queenstown, 3 bedrooms, budget up to 5000"},
    timeout=10,
)
response.raise_for_status()

print(response.json()["match_count"])