Skip to content

Commit cfcf532

Browse files
hyperpolymathclaude
andcommitted
feat(julia-server): wire /gnn/rank to the trained solver
`api/gnn_endpoint.jl` was never included in EchidnaML nor registered with the HTTP handler — every call to POST /gnn/rank hit the main server's 404 branch, so the Rust GNN client always fell back through `reqwest` to cosine similarity regardless of model availability. Changes - EchidnaML.jl: include api/gnn_endpoint.jl after api/server.jl so GNN_MODEL / GNN_VOCAB globals and route handlers are resolvable. - api/server.jl: after `init_server_state` loads the NeuralSolver, publish it via `GNN_MODEL[]` and compose the HTTP handler with `register_gnn_routes!` so /gnn/rank and /gnn/health are served. Effect: once run_training.jl produces models/neural/final_model and the server is started against that path, /gnn/rank ranks via the trained PremiseRanker rather than the cosine fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cf581a3 commit cfcf532

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/julia/EchidnaML.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ include("training/dataloader.jl")
188188
include("training/train.jl")
189189
include("inference/predict.jl")
190190
include("api/server.jl")
191+
include("api/gnn_endpoint.jl")
191192

192193
# Initialization
193194
function __init__()

src/julia/api/server.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,25 @@ function start_api_server(model_path::String;
265265

266266
init_server_state(model_path; cache_size=cache_size, port=port, host=host)
267267

268+
# Wire the GNN endpoint into the trained solver so /gnn/rank uses it
269+
# instead of falling back to cosine similarity. The solver loaded by
270+
# `init_server_state` is a full NeuralSolver (text_encoder + premise_ranker);
271+
# publish it as the GNN model and combine the route table.
272+
GNN_MODEL[] = SERVER_STATE[].solver
273+
GNN_VOCAB[] = SERVER_STATE[].vocabulary
274+
@info "GNN endpoint wired to trained solver at $model_path"
275+
268276
@info "Endpoints:"
269277
@info " GET /health"
270278
@info " GET /metrics"
271279
@info " GET /provers"
272280
@info " POST /predict"
273281
@info " POST /suggest"
282+
@info " POST /gnn/rank"
283+
@info " GET /gnn/health"
274284

275-
server = HTTP.serve(handle_request, host, port)
285+
combined = register_gnn_routes!(handle_request)
286+
server = HTTP.serve(combined, host, port)
276287
return server
277288
end
278289

0 commit comments

Comments
 (0)