vichayturen commented on code in PR #64:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/64#discussion_r1719170070
##########
hugegraph-llm/src/hugegraph_llm/demo/rag_web_demo.py:
##########
@@ -433,6 +486,78 @@ def apply_embedding_configuration(arg1, arg2, arg3):
out = gr.Textbox(label="Output", show_copy_button=True)
btn = gr.Button("(BETA) Init HugeGraph test data (🚧WIP)")
btn.click(fn=init_hg_test_data, inputs=inp, outputs=out) # pylint:
disable=no-member
+ return hugegraph_llm
+
+
+def rag_web_http_api():
+ @app.post("/rag")
+ def graph_rag_api(req: RAGRequest):
+ result = graph_rag(req.query, req.raw_llm, req.vector_only,
req.graph_only, req.graph_vector)
+ return {key: value for key, value in zip(
+ ["raw_llm", "vector_only", "graph_only", "graph_vector"], result)
if getattr(req, key)}
+
+ @app.post("/graph/config")
+ def graph_config_api(req: GraphConfigRequest):
+ # Accept status code
+ status_code = apply_graph_configuration(req.ip, req.port, req.name,
req.user, req.pwd, req.gs)
+
+ if status_code == -1:
+ return {"message":"Unsupported HTTP method"}
+
+ if 200 <= status_code < 300:
+ return {"message":"Connection successful. Configured finished."}
Review Comment:
A space after the colon should be more aesthetically pleasing
--
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]