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(wren-ai-service): semantics description pipeline to generate or optimize the user description #716

Merged
merged 13 commits into from
Oct 7, 2024

Conversation

paopa
Copy link
Member

@paopa paopa commented Oct 3, 2024

This PR introduces the SemanticsDescription service, which provides endpoints for generating and optimizing semantic descriptions based on user prompts and selected models.

Web API Specification

1. Generate Semantic Description

Endpoint: POST /v1/semantics-descriptions

Request Body:

{
    "selected_models": ["model1", "model2"],
    "user_prompt": "Describe the data model",
    "mdl": "..."
}

Response:

{
    "id": "unique_id",
}

2. Retrieve Semantic Description

Endpoint: GET /v1/semantics-descriptions/{id}

Path Parameter:

  • id: Unique identifier of the semantic description resource

Response:

{
   "id":"unique_id",
   "status":"finished",
   "response":{
      "model1":{
         "name":"model1",
         "columns":[
            {
               "name":"col1",
               "properties":{
                  "description":"Unique identifier for each record in the example model."
               }
            }
         ],
         "properties":{
            "description":"This model is used for analysis purposes, capturing key attributes of records."
         }
      }
   }
}

or, in case of an error:

{
    "id": "unique_id",
    "status": "failed",
    "error": {
        "code": "OTHERS",
        "message": "Error description"
    }
}

Usage

  1. Call the POST endpoint to initiate a semantic description generation.
  2. Use the returned ID to poll the GET endpoint until the status is "finished" or "failed".
  3. Once finished, retrieve the generated description from the "response" field.

Notes

  • The generation process may take some time, so implement appropriate polling intervals when checking the status.
  • Error handling has been implemented to catch and report various exceptions that may occur during the process.

Screenshots

image image

@paopa paopa added module/ai-service ai-service related ci/ai-service ai-service related labels Oct 3, 2024
@paopa paopa marked this pull request as ready for review October 3, 2024 09:11
@paopa paopa changed the title feat(wren-ai-service): generating semantics description pipeline feat(wren-ai-service): semantics description pipeline to generate or optimize the user description Oct 3, 2024
@paopa paopa requested a review from cyyeh October 3, 2024 10:26
@paopa paopa force-pushed the feat/semantics-description branch 2 times, most recently from e3edebb to bb4831c Compare October 4, 2024 08:52
@paopa paopa force-pushed the feat/semantics-description branch from 22798f0 to 2c17cbe Compare October 4, 2024 09:23
Copy link
Member

@cyyeh cyyeh left a comment

Choose a reason for hiding this comment

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

basically LGTM, thanks for hard work.

@cyyeh cyyeh merged commit 8dd2d53 into main Oct 7, 2024
8 checks passed
@cyyeh cyyeh deleted the feat/semantics-description branch October 7, 2024 05:56
AryanK1511 pushed a commit to AryanK1511/WrenAI that referenced this pull request Oct 7, 2024
…optimize the user description (Canner#716)

* feat: imple semantics description generation pipe

* chore: add the annotation for tracing

* chore: modify example inner semantics description pipe

* feat: implement the service

* feat: implement get and set item method to retrieve the cached response

* feat: web service for semantics description

* feat: impl the part in service to run pipeline

* feat: optimize the prompt for stabiliby

* feat: test case to validate service

* chore: remove status attr in response for generating semantics description task

* feat: refactor the route and service classes design

* chore: optimize the route doc

* fix: using input instead of endpoint request
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