■ AIMessage 클래스의 response_metadata 속성을 사용하는 방법을 보여준다. (ChatAnthropic 객체 사용시)
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from langchain_anthropic import ChatAnthropic chatAnthropic = ChatAnthropic(model = "claude-3-sonnet-20240229") aiMessage = chatAnthropic.invoke([("human", "What's the oldest known example of cuneiform")]) print(aiMessage.response_metadata) """ { 'id' : 'msg_01CzQyD7BX8nkhDNfT1QqvEp', 'model' : 'claude-3-sonnet-20240229', 'stop_reason' : 'end_turn', 'stop_sequence' : None, 'usage' : {'input_tokens' : 17, 'output_tokens' : 296} } """ |