mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-07 14:03:26 +00:00
Add successful request count to OpenAI callback (#2128)
I've found it useful to track the number of successful requests to OpenAI. This gives me a better sense of the efficiency of my prompts and helps compare map_reduce/refine on a cheaper model vs. stuffing on a more expensive model with higher capacity.
This commit is contained in:
@@ -45,7 +45,8 @@
|
||||
"text": [
|
||||
"Total Tokens: 42\n",
|
||||
"Prompt Tokens: 4\n",
|
||||
"Completion Tokens: 38\n"
|
||||
"Completion Tokens: 38\n",
|
||||
"Successful Requests: 1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -54,7 +55,8 @@
|
||||
" result = llm(\"Tell me a joke\")\n",
|
||||
" print(f\"Total Tokens: {cb.total_tokens}\")\n",
|
||||
" print(f\"Prompt Tokens: {cb.prompt_tokens}\")\n",
|
||||
" print(f\"Completion Tokens: {cb.completion_tokens}\")"
|
||||
" print(f\"Completion Tokens: {cb.completion_tokens}\")\n",
|
||||
" print(f\"Successful Requests: {cb.successful_requests}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user