mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix: address PR review feedback on cookbook
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
23ce5b30af
commit
e7d5d26fc4
1 changed files with 4 additions and 2 deletions
|
|
@ -140,7 +140,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"litellm.success_callback = [\"langfuse\"] # or any other logger\n",
|
||||
"# litellm.success_callback = [\"langfuse\"] # uncomment if you have langfuse installed/configured\n",
|
||||
"\n",
|
||||
"# Set a custom cost for your local model ($/1M tokens)\n",
|
||||
"litellm.register_model({\n",
|
||||
|
|
@ -156,7 +156,9 @@
|
|||
" messages=[{\"role\": \"user\", \"content\": \"Test\"}],\n",
|
||||
" api_base=\"http://localhost:11434\",\n",
|
||||
")\n",
|
||||
"print(f\"Tokens used: {response.usage.total_tokens}, Cost: ${response._hidden_params.get('response_cost', 0):.6f}\")"
|
||||
"from litellm import completion_cost\n",
|
||||
"cost = completion_cost(completion_response=response)\n",
|
||||
"print(f\"Tokens used: {response.usage.total_tokens}, Cost: ${cost:.6f}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue