-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from PrompTartLab/dev
feature: launch the app
- Loading branch information
Showing
31 changed files
with
9,561 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Set to true to add reviewers to pull requests | ||
addReviewers: true | ||
|
||
# Set to true to add assignees to pull requests | ||
addAssignees: author | ||
|
||
# A list of reviewers to be added to pull requests (GitHub user name) | ||
reviewers: | ||
- DimensionSTP | ||
- thispath98 | ||
- aeolian83 | ||
- jiyoon9704 | ||
- milhaud1201 | ||
|
||
# A number of reviewers added to the pull request | ||
# Set 0 to add all the reviewers (default: 0) | ||
numberOfReviewers: 0 | ||
|
||
# A number of assignees to add to the pull request | ||
# Set to 0 to add all of the assignees. | ||
# Uses numberOfReviewers if unset. | ||
# numberOfAssignees: 1 | ||
|
||
# A list of keywords to be skipped the process that add reviewers if pull requests include it | ||
# skipKeywords: | ||
# - wip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
js: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.js" | ||
|
||
ts: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.ts" | ||
|
||
py: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.py" | ||
|
||
java: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.java" | ||
|
||
c: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.c" | ||
|
||
c++: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.cpp" | ||
|
||
c#: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.cs" | ||
|
||
swift: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.swift" | ||
|
||
kotlin: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.kt" | ||
|
||
go: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.go" | ||
|
||
elixir: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- "**/*.exs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## PR Checklist | ||
|
||
- **Tag**: Select the appropriate tag for this PR: | ||
- [ ] `feature` | ||
- [ ] `fix` | ||
- [ ] `refactor` | ||
- [ ] `test` | ||
|
||
- **Module**: Select the relevant module(s) affected by this PR: | ||
- [ ] `sql` | ||
- [ ] `rag` | ||
- [ ] `base` | ||
- [ ] `deploy` | ||
|
||
## Description | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Auto Assign and Label | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
assign-reviewers-assignees: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: kentaro-m/[email protected] | ||
|
||
label-lang: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/labeler@v5 | ||
with: | ||
repo-token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# folder | ||
.streamlit/ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class DefaultTranslateParams: | ||
def __init__(self): | ||
self.temperature = 0.0 | ||
self.template = """ | ||
You are a professional translator. Given the query "{query}", provide the best result of Korean to English. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class DefaultWebParams: | ||
def __init__(self): | ||
self.temperature = 0.0 | ||
self.template = """ | ||
You are a search assistant. Given the query "{query}", provide the best search results and a summary. | ||
""" | ||
self.serpapi_params = { | ||
"engine": "google", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
busan_general_knowledge =''' | ||
광안리는 수영구에 있다. | ||
부산역은 동구에 있다. | ||
해운대는 해운대구에 있다. | ||
부산항은 중구와 동구에 걸쳐 있다. | ||
감천항은 사하구에 있다. | ||
광안대교는 수영구와 해운대구를 연결한다. | ||
송도해수욕장은 서구에 있다. | ||
다대포해수욕장은 사하구에 있다. | ||
국제시장과 자갈치시장은 중구에 있다. | ||
영도구는 중구와 다리로 연결되어 있다. | ||
동백섬은 해운대구에 있다. | ||
송정해수욕장은 해운대구에 있다. | ||
부산 영화의 전당은 해운대구 센텀시티에 위치해 있다. | ||
충렬사는 동래구에 있다. | ||
오륜대는 연제구에 있다. | ||
태종대는 영도구에 있다. | ||
서구는 사하구, 사상구, 동구, 중구와 붙어있다. | ||
해운대구는 수영구, 동래구, 기장군과 붙어있다. | ||
남구는 수영구, 연제구, 사상구, 서구와 붙어있다. | ||
기장군은 해운대구와 동래구에 접해 있다. | ||
동래구는 연제구, 금정구, 해운대구와 붙어있다. | ||
금정구는 동래구, 연제구, 사상구와 접해 있다. | ||
연제구는 남구, 동래구, 금정구, 해운대구와 붙어있다. | ||
동구는 중구, 서구, 사하구, 남구와 접해 있다. | ||
사상구는 북구, 금정구, 서구와 접해 있다. | ||
북구는 사상구, 금정구와 접해 있다. | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from langchain_core.prompts import PromptTemplate | ||
|
||
# Template for SQL generation (initial attempt) | ||
sql_generation_template = PromptTemplate( | ||
input_variables=["question", "datasource", "schema", "external_knowledge"], | ||
template=""" | ||
You are an expert in generating SQL queries. Based on the user's question, external knowledge and the specified data source, generate an SQL query. | ||
Data source: {datasource} | ||
Table schema: {schema} | ||
External knowledge:{external_knowledge} | ||
Ensure the query matches the schema of the data source and retrieves the most relevant information. Do not filter with extra columns that are not explicitly requested in the query. | ||
Use the 'LIKE' operator instead of equal(=) to filter text-type columns such as MENU_NAME or reviews and utilize the 'IN' operator for multiple possible options. | ||
Note that all columns other than those ending in English are Korean characters, and make sure that categorical columns are selected only in Possible values. | ||
Let's think step by step; first divide the user query into several conditions, tailor each condition to a possible value in the schema, and then convert each condition into a SQL statement. | ||
After the thoughts, provide the final SQL query in the <SQL> </SQL> tag. | ||
For your information, I'll provide examples of query-answer pairs. | ||
<QUERY> 부산역 근처 돼지국밥 맛집 알려주세요. | ||
<ANSWER> "부산역 근처" indicates proximity to Busan Station. 부산역 is located in 동구. This can be addressed using the DISTRICT_NAME column. | ||
"돼지국밥" specifies the type of food, which can be matched with the MENU_NAME column. | ||
맛집" implies that the restaurant should have a high rating, likely using the RATING column. | ||
<SQL> SELECT RESTAURANT_NAME_KOREAN, ADDRESS_KOREAN FROM restaurants WHERE DISTRICT_NAME = '동구' AND MENU_NAME LIKE '%돼지국밥%' ORDER BY RATING DESC LIMIT 5; </SQL> | ||
<QUERY> 광안리 근처에서 아이들이랑 가기 좋은 식당 추천해주세요. | ||
<ANSWER> "광안리 근처" indicates proximity to 광안리. 광안리 is in 수영구. This can be addressed using the DISTRICT_NAME column. | ||
Childeren might needs menu for childeren, which can be matched with MENU_FOR_CHILDREN_YN column. This column has Boolean type. | ||
<SQL> SELECT RESTAURANT_NAME_KOREAN, MENU_NAME FROM restaurants WHERE DISTRICT_NAME = '수영구' AND MENU_FOR_CHILDREN_YN = True ORDER BY RATING DESC LIMIT 5; </SQL> | ||
<QUERY> 외국인 친구랑 갈만한 관광지 알려주세요. | ||
<ANSWER> Foreign friends may like historical experience, which can be matched with the Major_Category column with '역사관광지'. | ||
<SQL> SELECT Tourist_Spot_Name_Korean FROM foreign_tourist_spots WHERE Major_Category = '역사관광지' ORDER BY Number_of_Visit DESC LIMIT 5; </SQL> | ||
<QUERY> 서구 근처에서 할 만한 액티비티 알려주세요. | ||
<ANSWER> 서구 근처" indicates proximity to 서구. 서구 is connected to 사하구, 사상구, 동구, and 중구. This can be addressed using the District column. | ||
"액티비티" specifies the type of tour, which can be matched with the Major_Category column with '육상 레포츠' '수상 레포츠' and '레포츠소개'. | ||
<SQL> SELECT Tourist_Spot_Name_Korean FROM local_tourist_spots WHERE District IN ('사하구', '사상구', '동구', '중구') AND Major_Category IN ('육상 레포츠', '수상 레포츠', '레포츠소개') ORDER BY Number_of_Visit DESC LIMIT 5; </SQL> | ||
<QUERY> {question} | ||
<ANSWER> | ||
""" | ||
) | ||
|
||
# Template for SQL generation (retry attempt) | ||
sql_retry_template = PromptTemplate( | ||
input_variables=["question", "datasource", "schema", "external_knowledge", "previous_answer"], | ||
template=""" | ||
You are an expert in generating SQL queries. Based on the user's question, external knowledge, and the specified data source, generate an SQL query. | ||
In a prior attempt, you generated a SQL query that returned no results. Relax constraints to retrieve relevant data. | ||
Data source: {datasource} | ||
Table schema: {schema} | ||
External knowledge:{external_knowledge} | ||
Prior SQL: {previous_answer} | ||
User query: {question} | ||
Provide the final SQL query in the <SQL> </SQL> tag. | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
schemas = { | ||
"local_tourist_spots": ''' | ||
- Description: This table contains information about tourist spots for local visitors. | ||
- Columns: | ||
- Tourist_Spot_Name_Korean (TEXT): The name of the tourist spot in Korean. | ||
- District (TEXT): The district (구) where the tourist spot is located. | ||
- Major_Category (CATEGORICAL): The category of the tourist spot. Possible values: ['역사관광지', '건축/조형물', '휴양관광지', '쇼핑', '체험관광지', '자연관광지', '육상 레포츠', '음식점', '문화시설', '산업관광지', '숙박시설', '수상 레포츠', '레포츠소개']. | ||
- Number_of_Visit (INTEGER): The number of visitors to the tourist spot. | ||
''', | ||
"foreign_tourist_spots": ''' | ||
- Description: This table contains information about tourist spots for foreign visitors. | ||
- Columns: | ||
- Tourist_Spot_Name_English (TEXT): The name of the tourist spot in English. | ||
- Tourist_Spot_Name_Korean (TEXT): The name of the tourist spot in Korean. | ||
- District (TEXT): The district (구) where the tourist spot is located. | ||
- Major_Category (CATEGORICAL): The category of the tourist spot. Possible values: ['역사관광지', '휴양관광지', '체험관광지', '쇼핑', '자연관광지', '건축/조형물', '육상 레포츠', '산업관광지', '문화시설', '수상 레포츠', '음식점', '공연/행사', '숙박시설', '레포츠소개']. | ||
- Number_of_Visit (INTEGER): The number of visitors to the tourist spot. | ||
''', | ||
"restaurants":''' | ||
- Description: This table contains information about popular restaurants in Busan. | ||
- Columns: | ||
- MENU_TYPE (TEXT): The type of menu offered at the restaurant (e.g., 한식, 중식, 분식). | ||
- RESTAURANT_NAME_KOREAN (TEXT): The Korean name of the restaurant. | ||
- ADDRESS_KOREAN (TEXT): The Korean address of the restaurant. | ||
- MENU_NAME (TEXT): The list of menu items offered by the restaurant. | ||
- DISTRICT_NAME (TEXT): The district (구) where the restaurant is located. | ||
- LATITUDE (REAL): The latitude of the restaurant. | ||
- LONGITUDE (REAL): The longitude of the restaurant. | ||
- RATING (REAL): The rating of the restaurant (out of 5). | ||
- RATING_COUNT (INTEGER): The number of reviews that contributed to the restaurant's rating. | ||
- PRICE_LEVEL (INTEGER): The price level of the restaurant (1 = low, 2 = medium, 3 = high). | ||
- TAKEOUT_YN (BOOLEAN): Whether the restaurant offers takeout (True/False). | ||
- RESERVABLE (BOOLEAN): Whether the restaurant accepts reservations (True/False). | ||
- BREAKFAST_YN (BOOLEAN): Whether breakfast is served (True/False). | ||
- LUNCH_YN (BOOLEAN): Whether lunch is served (True/False). | ||
- DINNER_YN (BOOLEAN): Whether dinner is served (True/False). | ||
- BEER_YN (BOOLEAN): Whether the restaurant serves beer (True/False). | ||
- OUTDOOR_SEAT_YN (BOOLEAN): Whether the restaurant has outdoor seating (True/False). | ||
- MENU_FOR_CHILDREN_YN (BOOLEAN): Whether the restaurant offers a children's menu (True/False). | ||
- RESTROOM_YN (BOOLEAN): Whether the restaurant has restrooms (True/False). | ||
- PARKING_LOT_YN (BOOLEAN): Whether the restaurant provides parking (True/False). | ||
- PAYMENT_OPTIONS (TEXT): Payment options available (e.g., credit cards). | ||
- REVIEW (TEXT): Customer reviews for the restaurant. | ||
''' | ||
} |
Oops, something went wrong.