|
|
|
@ -12,7 +12,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 2,
|
|
|
|
|
"execution_count": 1,
|
|
|
|
|
"id": "522686de",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"tags": []
|
|
|
|
@ -36,7 +36,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 3,
|
|
|
|
|
"execution_count": 2,
|
|
|
|
|
"id": "62e0dbc3",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"tags": []
|
|
|
|
@ -56,7 +56,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"execution_count": 3,
|
|
|
|
|
"id": "76a6e7b0-e927-4bfb-a414-1332a4149106",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"tags": []
|
|
|
|
@ -68,7 +68,7 @@
|
|
|
|
|
"AIMessage(content=\"J'aime programmer.\", additional_kwargs={})"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"execution_count": 3,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
@ -87,7 +87,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"id": "ce16ad78-8e6f-48cd-954e-98be75eb5836",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"tags": []
|
|
|
|
@ -99,7 +99,7 @@
|
|
|
|
|
"AIMessage(content=\"J'aime programmer.\", additional_kwargs={})"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"execution_count": 4,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
@ -122,7 +122,7 @@
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"id": "2b21fc52-74b6-4950-ab78-45d12c68fb4d",
|
|
|
|
|
"metadata": {
|
|
|
|
|
"tags": []
|
|
|
|
@ -131,10 +131,10 @@
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"LLMResult(generations=[[ChatGeneration(text=\"J'aime programmer.\", generation_info=None, message=AIMessage(content=\"J'aime programmer.\", additional_kwargs={}))], [ChatGeneration(text=\"J'aime l'intelligence artificielle.\", generation_info=None, message=AIMessage(content=\"J'aime l'intelligence artificielle.\", additional_kwargs={}))]], llm_output=None)"
|
|
|
|
|
"LLMResult(generations=[[ChatGeneration(text=\"J'aime programmer.\", generation_info=None, message=AIMessage(content=\"J'aime programmer.\", additional_kwargs={}))], [ChatGeneration(text=\"J'aime l'intelligence artificielle.\", generation_info=None, message=AIMessage(content=\"J'aime l'intelligence artificielle.\", additional_kwargs={}))]], llm_output={'token_usage': {'prompt_tokens': 71, 'completion_tokens': 18, 'total_tokens': 89}})"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
@ -150,7 +150,39 @@
|
|
|
|
|
" HumanMessage(content=\"Translate this sentence from English to French. I love artificial intelligence.\")\n",
|
|
|
|
|
" ],\n",
|
|
|
|
|
"]\n",
|
|
|
|
|
"chat.generate(batch_messages)"
|
|
|
|
|
"result = chat.generate(batch_messages)\n",
|
|
|
|
|
"result"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"id": "2960f50f",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"You can recover things like token usage from this LLMResult"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"id": "a6186bee",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"{'token_usage': {'prompt_tokens': 71,\n",
|
|
|
|
|
" 'completion_tokens': 18,\n",
|
|
|
|
|
" 'total_tokens': 89}}"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"result.llm_output"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|