8000 Copybara import of the project: · CentML/adk-python@6157db7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6157db7

Browse files
whoisarpitcopybara-github
authored andcommitted
Copybara import of the project:
-- bdb2ddf by Arpit Roopchandani <17565234+whoisarpit@users.noreply.github.com>: Fix: Set output_schema correctly for LiteLllm COPYBARA_INTEGRATE_REVIEW=google#580 from whoisarpit:fix/lite_llm_response_schema 08bdb5a PiperOrigin-RevId: 764524765
1 parent 9d4ca4e commit 6157db7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/google/adk/models/lite_llm.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def _get_completion_inputs(
477477
llm_request: The LlmRequest to convert.
478478
479479
Returns:
480-
The litellm inputs (message list and tool dictionary).
480+
The litellm inputs (message list, tool dictionary and response format).
481481
"""
482482
messages = []
483483
for content in llm_request.contents or []:
@@ -506,7 +506,13 @@ def _get_completion_inputs(
506506
_function_declaration_to_tool_param(tool)
507507
for tool in llm_request.config.tools[0].function_declarations
508508
]
509-
return messages, tools
509+
510+
response_format = None
511+
512+
if llm_request.config.response_schema:
513+
response_format = llm_request.config.response_schema
514+
515+
return messages, tools, response_format
510516

511517

512518
def _build_function_declaration_log(
@@ -643,12 +649,13 @@ async def generate_content_async(
643649
self._maybe_append_user_content(llm_request)
644650
logger.debug(_build_request_log(llm_request))
645651

646-
messages, tools = _get_completion_inputs(llm_request)
652+
messages, tools, response_format = _get_completion_inputs(llm_request)
647653

648654
completion_args = {
649655
"model": self.model,
650656
"messages": messages,
651657
"tools": tools,
658+
"response_format": response_format,
652659
}
653660
completion_args.update(self._additional_args)
654661

0 commit comments

Comments
 (0)
0