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

chore(wren-ai-service): sql 2 answer streaming #894

Merged
merged 43 commits into from
Dec 3, 2024

Conversation

cyyeh
Copy link
Member

@cyyeh cyyeh commented Nov 11, 2024

SQL Answers Router

This router handles endpoints related to initiating SQL answer operations and retrieving their results.

Endpoints:

  1. POST /sql-answers

    • Initiates an SQL answer operation
    • Request body: SqlAnswerRequest
      {
      "query": "user's question",
      "sql": "SELECT * FROM table_name WHERE condition", # Actual SQL statement
      "thread_id": "unique-thread-id", # Optional thread identifier for tracking
      "user_id": "user-id" # Optional user identifier for tracking
      }
    • Response: SqlAnswerResponse
      {
      "query_id": "unique-uuid" # Unique identifier for the initiated SQL operation
      }
  2. GET /sql-answers/{query_id}/result

    • Retrieves the status and result of a SQL answer operation
    • Path parameter: query_id (str)
    • Response: SqlAnswerResultResponse
      {
      "query_id": "unique-uuid", # Unique identifier of the SQL answer operation
      "status": "preprocessing" | "succeeded" | "failed",
      "num_rows_used_in_llm": int | None,
      "error": { # Present only if status is "failed"
      "code": "OTHERS",
      "message": "Error description"
      }
      }
  3. GET /sql-answers/{query_id}/streaming-result

    • Retrieves the streaming result of a SQL answer.
    • Path Parameter:
      • query_id: The unique identifier of the query.
    • Response:
      • Streaming response with the SQL answer.

Note: The actual SQL processing is performed in the background using FastAPI's BackgroundTasks.

@cyyeh cyyeh added module/ai-service ai-service related ci/ai-service ai-service related do-not-merge labels Nov 11, 2024
@cyyeh cyyeh requested a review from paopa November 11, 2024 09:06
@cyyeh cyyeh force-pushed the chore/ai-service/sql-2-answer-streaming branch 2 times, most recently from af907b5 to 282c5b7 Compare November 11, 2024 21:54
@cyyeh cyyeh changed the base branch from main to feat/ai-service/intent-and-chat-pipeline November 11, 2024 21:54
@cyyeh cyyeh force-pushed the feat/ai-service/intent-and-chat-pipeline branch from a187937 to 78caaa4 Compare November 12, 2024 08:47
@cyyeh cyyeh force-pushed the chore/ai-service/sql-2-answer-streaming branch 2 times, most recently from aff1072 to f9acaef Compare November 12, 2024 11:35
@cyyeh cyyeh force-pushed the chore/ai-service/sql-2-answer-streaming branch from f9acaef to cf8a334 Compare November 13, 2024 07:14
@cyyeh cyyeh changed the base branch from feat/ai-service/intent-and-chat-pipeline to main November 13, 2024 11:31
Copy link
Member

@paopa paopa left a comment

Choose a reason for hiding this comment

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

overall LGTM. thanks for the hard work. a few comments leave.

@paopa paopa self-requested a review December 2, 2024 09:54
Copy link
Member

@paopa paopa left a comment

Choose a reason for hiding this comment

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

LGTM

@cyyeh cyyeh merged commit 91a8a8f into main Dec 3, 2024
8 checks passed
@cyyeh cyyeh deleted the chore/ai-service/sql-2-answer-streaming branch December 3, 2024 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/ai-service ai-service related module/ai-service ai-service related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants