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

Skip to content

Conversation

r14minji
Copy link
Contributor

@r14minji r14minji commented Jan 6, 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.

  • (Optional) Related Issue: If this PR is linked to an issue, I have referenced the issue number in the PR message. (e.g., Fixes Update 01-PromptTemplate.ipynb #123)

  • ❌ 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.

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

@r14minji r14minji added the docs tutorial label Jan 6, 2025
@r14minji r14minji self-assigned this Jan 6, 2025
@r14minji
Copy link
Contributor Author

r14minji commented Jan 6, 2025

질문이 있습니다.
초반 환경 설정 후, 처음 임베딩 모델 설정해서 retriever 실행하면요.
"APIConnectionError: Connection error."가 나오거든요.

이 문제를 해결하려고 여러가지 방법을 시도해보다가

import os
from langchain_openai import OpenAIEmbeddings

os.environ["OPENAI_API_KEY"] = "your-api-key-here"

이렇게 명시적으로 추가 작성하니 오류 없이 진행이 가능하더라고요.

초반 환경 설정에서

# Load API key information
load_dotenv(override=True)

이렇게 설정해준게 효과가 없는걸까요? 어떤 해결방법이 있을까요...?

@yuneun92
Copy link
Contributor

yuneun92 commented Jan 6, 2025

리뷰에 앞서 질문에 답변부터 드리겠습니다. (리뷰는 퇴근 후 드릴게요!) env 파일을 못 찾아서 생기는 문제로 예상되는데,

import os
from dotenv import load_dotenv

root_path = os.path.dirname(os.path.abspath(__file__))
load_dotenv(dotenv_path=f"{root_path}/.env", override=True)

위와 같이 env 파일 경로를 지정하고 다시 테스트해보시겠어요?

@r14minji
Copy link
Contributor Author

r14minji commented Jan 6, 2025

@yuneun92 오오오!! 잘 실행 됩니다!! 감사합니다~
위에 알려주신 경로 설정하는 코드를 환경 설정 부분에 추가해두는게 좋겠죠??

@r14minji r14minji closed this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs tutorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants