Nishieee opened a new pull request, #351:
URL: https://github.com/apache/hugegraph-ai/pull/351
## Summary
Closes #348.
HugeGraph-LLM already supports graph extraction through the Gradio demo, but
there was no public REST endpoint for it. This PR adds `POST /graph/extract` to
the existing FastAPI app, routing requests through `SchedulerSingleton` and
`FlowName.GRAPH_EXTRACT` — the same path the demo uses.
### Key changes
- Add `GraphExtractRequest` with validation for `texts`, `schema`,
`split_type`, and related options
- Add `graph_http_api` and register it on the existing auth router
- Make `split_type` configurable in `GraphExtractFlow` (default
`"document"`, so demo behavior is unchanged)
- Return structured JSON (`vertices` / `edges` as arrays), with optional
`warning` and `meta`
### Example request
```json
{
"texts": "Sarah is 30 and works as an attorney.",
"schema": { "vertexlabels": [], "edgelabels": [], "propertykeys": [] },
"split_type": "document",
"include_meta": true
}
```
Invalid or empty input returns `422`; scheduler failures return `500`.
### Test plan
- `cd hugegraph-llm && SKIP_EXTERNAL_SERVICES=true uv run pytest
src/tests/api/test_graph_api.py -v --tb=short`
- Regression check: `/rag`, `/text2gremlin`, `/config/graph`, and
`/graph/extract` all register
- Ruff format and lint pass
- Manual `curl` against running app with extract LLM configured
- Compare API output with Gradio graph extraction on the same input
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]