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

Skip to content

Conversation

IHAGI-c
Copy link
Contributor

@IHAGI-c IHAGI-c commented Dec 29, 2024

[Team] Existing content development teams 3
[Title] Check Token Usage
[Version] initial
[Language] ENG
[Package] langchain, langchain-openai

LangChain Token Usage Monitoring Tutorial

  • Implemented token usage tracking using get_openai_callback in LangChain.
  • Demonstrated single and multiple query monitoring for OpenAI API calls.
  • Provided examples of calculating token usage and associated costs.

[Title] Check Token Usage
[Version] initial
[Language] ENG
[Package] langchain, langchain-openai

LangChain Token Usage Monitoring Tutorial
- Implemented token usage tracking using `get_openai_callback` in LangChain.
- Demonstrated single and multiple query monitoring for OpenAI API calls.
- Provided examples of calculating token usage and associated costs.
1. .env 관련 내용에 대한 안내 추가
2. 예제의 korea 를 United States 로 변경
3. outdated 된 import 수정:
from langchain_community.callbacks.manager
4. 따라서 langchain-community 를 dependency 에 추가
Copy link
Contributor

@teddylee777 teddylee777 left a comment

Choose a reason for hiding this comment

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

#11
변경 요청사항 수정하여 push 넣어 놨습니다. 확인 부탁 드립니다!

change suggestion

  1. .env 관련 내용에 대한 안내 추가
  2. 예제 중 하나 korea 를 United States 로 변경
  3. outdated 된 import 수정:
    from langchain_community.callbacks.manager
  4. 따라서 langchain-community 를 dependency 에 추가

- Adjusted execution counts for code cells to reflect the correct order of operations.
- Added 'langchain_community' to the list of packages for improved callback management.
- Modified the callback import statement to use the community version.
- Updated the example query to reflect a more relevant question.
- Corrected token usage output values to ensure accurate reporting of tokens used and associated costs.
…ate token usage statistics. Adjusted execution counts for code cells, added pip upgrade notice, and refined output values for total tokens and costs to ensure accurate reporting. Enhanced example queries for clarity.
@IHAGI-c IHAGI-c requested a review from teddylee777 December 29, 2024 14:19
Copy link
Contributor

@teddylee777 teddylee777 left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다.
수정 후 재 커밋 감사드립니다!
approval

@sooyoung-wind
Copy link
Contributor

수고하셨습니다. 😃

체크 사항은 다음과 같습니다.

  • 윈도우 환경에서 정상적인 실행 여부 확인

@teddylee777 teddylee777 merged commit 21ebe25 into LangChain-OpenTutorial:main Dec 29, 2024
eunhhyy pushed a commit to eunhhyy/LangChain-OpenTutorial that referenced this pull request Jan 1, 2025
…ken-usage-by-Haseom

04-Check Token Usage
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.

3 participants