Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(llm): support basic rag api(v1) #64

Merged
merged 33 commits into from
Aug 18, 2024
Merged

Conversation

ChenZiHong-Gavin
Copy link
Contributor

There may be 2 ways to integrate fastapi into the gradio app:

  1. use python client provided by Gradio
  2. encapsulate asynchronous HTTP call process

refer:

  1. https://www.gradio.app/guides/sharing-your-app
  2. https://www.gradio.app/guides/fastapi-app-with-the-gradio-client

@github-actions github-actions bot added the llm label Aug 13, 2024
Copy link
Contributor

@vichayturen vichayturen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function apply_embedding_configuration does not return a value.

hugegraph-llm/src/hugegraph_llm/demo/rag_web_demo.py Outdated Show resolved Hide resolved
…r issues and encapsulate the http api in a single package
@imbajin imbajin marked this pull request as ready for review August 17, 2024 10:58
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 17, 2024
Comment on lines 57 to 59
def rag_http_api(app: FastAPI, graph_rag_func, apply_graph_configuration_func,
apply_llm_configuration_func, apply_embedding_configuration_func):
@app.post("/rag")
def graph_rag_api(req: RAGRequest):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the proper/right way to use the fastapi?

  • method -> http_method?
  • class -> http_method?
  • directly http_method?

@@ -141,13 +134,110 @@ def build_kg(file, schema, example_prompt, build_mode): # pylint: disable=too-m
raise gr.Error(str(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme: return 'str', but context got 'dict[str, Any]'... (unify it)

image

@imbajin imbajin changed the title feat(llm): integrate fastapi feat(llm): support basic rag api(v1) Aug 17, 2024
raise gr.Error("PDF will be supported later! Try to upload text/docx now")
else:
raise gr.Error("Please input txt or docx file.")
builder = KgBuilder(LLMs().get_llm(), Embeddings().get_embedding(), get_hg_client())

if build_mode != "Rebuild vertex index":
if build_mode != BuildMode.REBUILD_VERTEX_INDEX:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be build_mode != BuildMode.REBUILD_VERTEX_INDEX.value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

vichayturen added a commit to vichayturen/incubator-hugegraph-ai that referenced this pull request Aug 18, 2024
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 18, 2024
hugegraph-llm/src/hugegraph_llm/demo/rag_web_demo.py Dismissed Show dismissed Hide dismissed
hugegraph-llm/src/hugegraph_llm/demo/rag_web_demo.py Dismissed Show dismissed Hide dismissed
@imbajin imbajin merged commit 4f6414d into apache:main Aug 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request llm size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants