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

Chatbot with Gradio, FastApi Endpoint, Langchain Integration #1246

Merged
merged 70 commits into from
Jan 26, 2024

Conversation

april-yyt
Copy link
Collaborator

@april-yyt april-yyt commented Dec 13, 2023

Description of changes:

UseCases

1. Gradio Interface Integration

  • A new Gradio Chat Interface has been implemented, allowing interactive conversational engagement with FlexFlow.
  • This interface generates responses based on user input through a streamlined and user-friendly web interface.

2. FastAPI Integration

  • The FastAPI application has been updated for better performance and usability.
  • The application can be run using the command uvicorn fastapi_app:app --reload --port PORT_NUMBER, and is accessible at http://localhost:PORT_NUMBER.
  • The server setup includes comprehensive API documentation accessible at http://localhost:PORT_NUMBER/docs.

3. FlexFlow and LangChain Integration

  • FlexFlowLLM Class: This class manages the initialization, configuration, and operation of the FlexFlow server.
  • FF_LLM_wrapper Class: Acts as a wrapper for FlexFlow, facilitating interaction with the LangChain library.
  • Main Execution Flow: The main execution now includes initializing FlexFlow, compiling and starting the server with generation configurations, and implementing a prompt template for response generation using LLMChain.

Usage

  1. For Gradio Interface: Run the script with an optional configuration file for custom settings, and interact with the model through the Gradio web interface.
  2. For FastAPI Application: Execute the application with Uvicorn, with the command uvicorn fastapi_app:app --reload --port PORT_NUMBER, and use the provided base URL for making API requests or accessing documentation.
  3. For FlexFlow and LangChain: Running the script would initialize the FlexFlowLLM with an optional configuration file, compile and start the server, and use the FF_LLM_wrapper with LLMChain for generating responses to predefined questions.

Related Issues:

Linked Issues:

  • Issue #

Issues closed by this PR:

  • Closes #

This change is Reviewable

@@ -148,8 +148,6 @@ def main():
results = llm.generate(prompts)
else:
result = llm.generate("Three tips for staying healthy are: ")

llm.stop_server()
Copy link
Collaborator

@goliaro goliaro Jan 19, 2024

Choose a reason for hiding this comment

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

why do we need to remove this? @april-yyt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a misdeletion, I will add it back.

@jiazhihao jiazhihao merged commit abf9fb8 into inference Jan 26, 2024
44 checks passed
@goliaro goliaro deleted the chatbot-2 branch February 2, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpecInfer Fastapi Integration
5 participants