■ AIMessage 클래스의 response_metadata 속성을 사용하는 방법을 보여준다. (ChatGroq 객체 사용시)
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from langchain_groq import ChatGroq chatGroq = ChatGroq() aiMessage = chatGroq.invoke([("human", "What's the oldest known example of cuneiform")]) print(aiMessage.response_metadata) """ { 'token_usage' : { 'completion_time' : 0.243, 'completion_tokens' : 132, 'prompt_time' : 0.022, 'prompt_tokens' : 22, 'queue_time' : None, 'total_time' : 0.265, 'total_tokens' : 154 }, 'model_name' : 'mixtral-8x7b-32768', 'system_fingerprint' : 'fp_7b44c65f25', 'finish_reason' : 'stop', 'logprobs' : None } """ |