mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
format
This commit is contained in:
parent
e05ffcfb4c
commit
3b524ba5f1
2 changed files with 8 additions and 6 deletions
|
|
@ -38,8 +38,8 @@ class GenerateContentToCompletionHandler:
|
|||
completion_kwargs: Dict[str, Any] = dict(completion_request)
|
||||
|
||||
# feed metadata for custom callback
|
||||
if 'metadata' in extra_kwargs:
|
||||
completion_kwargs['metadata'] = extra_kwargs['metadata']
|
||||
if "metadata" in extra_kwargs:
|
||||
completion_kwargs["metadata"] = extra_kwargs["metadata"]
|
||||
|
||||
if stream:
|
||||
completion_kwargs["stream"] = stream
|
||||
|
|
|
|||
|
|
@ -181,9 +181,11 @@ async def google_count_tokens(request: Request, model_name: str):
|
|||
from litellm.proxy._types import TokenCountRequest
|
||||
|
||||
# Translate contents to openai format messages using the adapter
|
||||
messages = (GoogleGenAIAdapter()
|
||||
.translate_generate_content_to_completion(model_name, contents)
|
||||
.get("messages", []))
|
||||
messages = (
|
||||
GoogleGenAIAdapter()
|
||||
.translate_generate_content_to_completion(model_name, contents)
|
||||
.get("messages", [])
|
||||
)
|
||||
|
||||
token_request = TokenCountRequest(
|
||||
model=model_name,
|
||||
|
|
@ -209,7 +211,7 @@ async def google_count_tokens(request: Request, model_name: str):
|
|||
totalTokens=token_response.total_tokens or 0,
|
||||
promptTokensDetails=[],
|
||||
)
|
||||
|
||||
|
||||
#########################################################
|
||||
# Return the response in the well known format
|
||||
#########################################################
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue