Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jinucho
Copy link
Contributor

@jinucho jinucho commented Jan 13, 2025

{PR Message - Write freely, remove this bracket if unnecessary}

Author Checklist

  • PR Title Format: I have confirmed that the PR title follows the correct format. (e.g., [N-2] 07-Text Splitter / 07-RecursiveCharacterTextSplitter)

  • Committed Files: I have ensured that no unnecessary files (e.g., .bin, .gitignore, poetry.lock, pyproject.toml) are included. These files are not allowed.

  • ❌ Do not include unnecessary files (e.g., .bin, .gitignore, poetry.lock, pyproject.toml) or other people's code. If included, close the PR and create a new PR.

참고사항 :

  • openAI의 모델이 gpt-3.5-turbo인데 query 생성 관련하여 안정성으로 인해 4o, 4o-mini를 사용하지 않습니다.(테디님 확인 완료)
  • finance.db가 같이 commit 되었습니다.

Review Template (Intial PR)

🖥️ OS: Win/Mac/Linux   
✅ Checklist      
 - [ ] **Template**: Tutorials follows the required template. 
 - [ ] **Table of Contents(TOC) Links**: All Table of Contents links work. ((Yes/No)
 - [ ] **Image**: Image filenames follow guidelines.
 - [ ] **Imports*: All import statements use the latest versions. Ensure "langchain-teddynote" is not used. 
 - [ ] **Code Execution**: Code runs without errors.
 - Comments: {Write freely, 한국어 기술 가능}     

If no one reviews your PR within a few days, please @-mention one of teddylee777, musangk, BAEM1N

teddylee777 and others added 4 commits January 9, 2025 13:01
Add `MONGODB_ATLAS_CLUSTER_URI` to `.env_sample` this will be used in  09-VectorStore / 07-MongoDB-Atlas Tutorial File.
finance.db 추가
OpenAI의 모델이 gpt-3.5-turbo인 이유는 query 생성 안정화를 위함 입니다.
(테디님 확인 완료)
@jinucho jinucho changed the title Weeks3 [E-1] 14-Chains / 02-SQL Jan 13, 2025
- [x] Review OS:
 - Windows
- [x]Template Rule 준수 여부:
 -Template Rule 가이드를 준수하였는가? (Check 표기)
- [x] Table of Contents 링크 확인:
 - Table of Contents의 링크가 원활하게 동작하는지 확인하였는가? (Check 표기)
- [x] 이미지 파일명 검토:
 - 이미지가 포함되어 있다면, 이미지의 파일명이 가이드를 준수하였는가? (Check 표기)
- [x] 최신 import 방식 사용 여부:
 - import 구문이 예전 legacy 방식이 아닌 최신 버전을 따르는가? (Check 표기)
- [x] 코드 동작 확인:
 - 모든 코드가 오류 없이 동작하는가? (Check 표기)
- [x] Warning 발생 시 코멘트에 적어주세요.
 - 제출 파일 확인:
- [x] 꼭 필요한 파일들만 제출되었는가?
 - 튜토리얼 외 설정 파일이나 다른 분이 작업한 파일이 포함되었는지 Files Changed에서 확인 부탁드립니다. (Check 표기)
- [x] 기타 의견:
@jeong-wooseok
Copy link
Contributor

🖥️ OS: Win/Mac/Linux
✅ Checklist

  • Template: Tutorials follows the required template.
  • Table of Contents(TOC) Links: All Table of Contents links work. ((Yes/No)
  • Image: Image filenames follow guidelines.
  • *Imports: All import statements use the latest versions. Ensure "langchain-teddynote" is not used.
  • Code Execution: Code runs without errors.
  • Comments: {Write freely, 한국어 기술 가능}

코드 잘 작동하고 목차도 잘 이동하는 것 확인했습니다.
현재도 목차구성은 나쁘지 않지만 보완한다면 다음과 같이 바꾸는 건 어떨까 생각합니다.
(개인적 견해입니다.)

  • Overview
  • Environment Setup
  • Load SQL Database
  • SQL generating chain
  • Using SQL generating chain with an Agent
    : Agent에 설명을 붙여주면 테이블만 봐도 이해가 될 것 같아서 좋아보입니다.
    : Differences Between create_sql_query_chain and SQL Agent는 agent의
    하위주제 같아보여서 목차에서 제외하고 ###로 가는건 어떨까 생각합니다.
    : [Note] SQLite DB Creation는 SQL 생성기의 문맥에서 중요하지는 않아보여서 제외
  • 4o-mini로도 잘 작동하는 것 같은데 3-turbo에서 mini로 바꾸는건 어떨까요

@jinucho
Copy link
Contributor Author

jinucho commented Jan 14, 2025

PM님께서 제안 주신대로 일부 수정 및 삭제 하였습니다.

Table_contents:

  • Overview
  • Environment Setup
  • Load SQL Database
  • SQL generate chain
  • Using SQL generating chain with an Agent
  • Appendix : Chain with gpt-4o and a Post-Processing Function
  1. DB생성 코드 삭제
  2. agent_toolkits에 대한 설명 추가(Agent 자체보다는, agent_toolkit을 사용하므로 이에 대해 설명을 추가했습니다.)

" [\n",
" \"langsmith\",\n",
" \"langchain\",\n",
" \"langchain_openai\",\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
" \"langchain_openai\",\n",
" \"langchain_openai\",\n",
" \"langchain_community\",\n"

Copy link
Contributor

Choose a reason for hiding this comment

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

코랩 환경에서도 돌아가려면 필요할 것 같아서 넣어두었습니다..!

Copy link
Contributor

@ErikaPark ErikaPark left a comment

Choose a reason for hiding this comment

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

🖥️ OS: Mac
✅ Checklist

  • Template: Tutorials follows the required template.
  • Table of Contents(TOC) Links: All Table of Contents links work. ((Yes/No)
  • *Imports: All import statements use the latest versions. Ensure "langchain-teddynote" is not used.
  • Code Execution: Code runs without errors.
  • Comments:

코드는 오류 없이 잘 실행되지만, 환경설정에 langchain_community 패키지도 함께 추가하면 좋을 것 같아 수정 제안으로 넣어두었습니다. 😊
아래는 추가 설명을 보강하면 좋을 것 같은 부분입니다. 보시고 필요하다고 생각되는 부분만 반영해주시면 감사하겠습니다!

Load SQL Database

  • create_sql_query_chain 함수의 목적과 동작 방식을 간단히 설명해주시면 좋겠습니다.

  • .get_prompts() 메서드의 사용법과 다른 데이터베이스 활용 예제를 추가해주시면 좋겠습니다.

    • ex. .partial_variables수정 → chain.get_prompts()[0].partial_variables['dialect'] = 'mysql'
    • ex. create_sql_query_chain 호출 시 dialect를 직접 설정하는 방법.
  • QuerySQLDatabaseTool의 역할에 대한 설명이 추가되면 좋을 것 같습니다.

Using SQL Generating Chain with an Agent

  • create_sql_agent에 대한 설명이 추가되면 좋을 것 같습니다.

Appendix

  • 각 코드 블록의 목적과 코드 실행 흐름을 명시해 주시면 독자가 흐름을 파악하기 쉬울 것 같습니다 (ex. 코드 블록 위에 코드 흐름 설명: 자연어 질문 입력 → LLM에서 SQL 쿼리 생성 → 데이터베이스에 쿼리 실행 → 결과를 LLM이 자연어로 정리)

Copy link
Contributor

@ThePurpleCollar ThePurpleCollar left a comment

Choose a reason for hiding this comment

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

🖥️ OS: Mac
✅ Checklist

  • Template: Tutorials follows the required template.
  • Table of Contents(TOC) Links: All Table of Contents links work. ((Yes/No)
  • Image: Image filenames follow guidelines.
  • *Imports: All import statements use the latest versions. Ensure "langchain-teddynote" is not used.
  • Code Execution: Code runs without errors.

구현이 원활하고 깔끔하게 정리되어 있어 추가 코멘트는 없습니다.
고생하셧습니다.

code and contents update
add image file
@jinucho
Copy link
Contributor Author

jinucho commented Jan 15, 2025

박연서님 피드백 반영 하였습니다.

  1. create_sql_query_chain 함수에 대한 설명 추가
  2. .get_prompts() 메서드에 대한 설명 코드 추가
  3. sqlite 외 db 적용 방법 가이드 추가
  4. QuerySQLDatabaseTool 설명 추가
  5. create_sql_agent 설명 추가
  6. Appendix에 워크플로우 설명 추가 및 각 코드셀 간단한 설명 추가
  7. sql_chain work flow 이미지 추가

Copy link
Contributor

@ErikaPark ErikaPark left a comment

Choose a reason for hiding this comment

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

설명이 추가되었음에도 가독성이 좋고 깔끔합니다.
고생 많으셨습니다!

🖥️ OS: Mac
✅ Checklist

  • Template: Tutorials follows the required template.
  • Table of Contents(TOC) Links: All Table of Contents links work. ((Yes/No)
  • Image: Image filenames follow guidelines.
  • *Imports: All import statements use the latest versions. Ensure "langchain-teddynote" is not used.
  • Code Execution: Code runs without errors.

@teddylee777 teddylee777 merged commit 9fe8e9c into LangChain-OpenTutorial:main Jan 15, 2025
1 of 2 checks passed
@jinucho jinucho deleted the weeks3 branch January 20, 2025 23:41
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.

5 participants