■ AIMessage 클래스의 response_metadata 속성을 사용하는 방법을 보여준다. (ChatMistralAI 객체 사용시)
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from langchain_mistralai import ChatMistralAI chatMistralAI = ChatMistralAI() aiMessage = chatMistralAI.invoke([("human", "What's the oldest known example of cuneiform")]) print(aiMessage.response_metadata) """ { 'token_usage' : { 'prompt_tokens' : 19, 'total_tokens' : 141, 'completion_tokens' : 122 }, 'model' : 'mistral-small', 'finish_reason' : 'stop' } """ |