Skip to content

Commit

Permalink
feat: SQL query tuning for improved readability and performance
Browse files Browse the repository at this point in the history
  • Loading branch information
eddydecena committed Jul 19, 2024
1 parent 5324c81 commit b7fbcac
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 117 deletions.
151 changes: 122 additions & 29 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const docTemplate = `{
}
}
},
"/prompt": {
"/prompts/generate": {
"post": {
"description": "Create an SQL query based on a natural language prompt",
"consumes": [
Expand All @@ -277,15 +277,15 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Prompt"
"$ref": "#/definitions/models.GenerateQueryBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Activity"
"$ref": "#/definitions/models.GenerateQueryActivity"
}
},
"400": {
Expand All @@ -308,33 +308,61 @@ const docTemplate = `{
}
}
}
}
},
"definitions": {
"models.Activity": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
},
"/prompts/improve": {
"post": {
"description": "Improve an SQL query based on a natural language prompt",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"query"
],
"summary": "Improve SQL Query",
"parameters": [
{
"description": "Prompt Object",
"name": "Prompt",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ImproveQueryBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ImproveQueryActivity"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.HTTPError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/models.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/models.HTTPError"
}
}
},
"data_source_name": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"prompt": {
"type": "string"
},
"query": {
"type": "string"
}
}
},
}
},
"definitions": {
"models.DataSource": {
"type": "object",
"required": [
Expand Down Expand Up @@ -370,6 +398,44 @@ const docTemplate = `{
"PostgreSQL"
]
},
"models.GenerateQueryActivity": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"data_source_name": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"prompt": {
"type": "string"
},
"query": {
"type": "string"
}
}
},
"models.GenerateQueryBody": {
"type": "object",
"properties": {
"data_source_name": {
"type": "string"
},
"execute": {
"type": "boolean"
},
"prompt": {
"type": "string"
}
}
},
"models.HTTPError": {
"type": "object",
"properties": {
Expand All @@ -389,13 +455,40 @@ const docTemplate = `{
}
}
},
"models.Prompt": {
"models.ImproveQueryActivity": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"data_source_name": {
"type": "string"
},
"prompt": {
"improved_query": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"original_query": {
"type": "string"
}
}
},
"models.ImproveQueryBody": {
"type": "object",
"properties": {
"data_source_name": {
"type": "string"
},
"execute": {
"type": "boolean"
},
"query": {
"type": "string"
}
}
Expand Down
Loading

0 comments on commit b7fbcac

Please sign in to comment.