mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
ADK changes
PiperOrigin-RevId: 772078053
This commit is contained in:
committed by
Copybara-Service
parent
badbcbd7a4
commit
1cfc555e70
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import json
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import Mock
|
||||
|
||||
@@ -1429,35 +1430,3 @@ async def test_generate_content_async_non_compliant_multiple_function_calls(
|
||||
assert final_response.content.parts[1].function_call.name == "function_2"
|
||||
assert final_response.content.parts[1].function_call.id == "1"
|
||||
assert final_response.content.parts[1].function_call.args == {"arg": "value2"}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
def test_get_completion_inputs_generation_params():
|
||||
# Test that generation_params are extracted and mapped correctly
|
||||
req = LlmRequest(
|
||||
contents=[
|
||||
types.Content(role="user", parts=[types.Part.from_text(text="hi")]),
|
||||
],
|
||||
config=types.GenerateContentConfig(
|
||||
temperature=0.33,
|
||||
max_output_tokens=123,
|
||||
top_p=0.88,
|
||||
top_k=7,
|
||||
stop_sequences=["foo", "bar"],
|
||||
presence_penalty=0.1,
|
||||
frequency_penalty=0.2,
|
||||
),
|
||||
)
|
||||
from google.adk.models.lite_llm import _get_completion_inputs
|
||||
|
||||
_, _, _, generation_params = _get_completion_inputs(req)
|
||||
assert generation_params["temperature"] == 0.33
|
||||
assert generation_params["max_completion_tokens"] == 123
|
||||
assert generation_params["top_p"] == 0.88
|
||||
assert generation_params["top_k"] == 7
|
||||
assert generation_params["stop"] == ["foo", "bar"]
|
||||
assert generation_params["presence_penalty"] == 0.1
|
||||
assert generation_params["frequency_penalty"] == 0.2
|
||||
# Should not include max_output_tokens
|
||||
assert "max_output_tokens" not in generation_params
|
||||
assert "stop_sequences" not in generation_params
|
||||
|
||||
Reference in New Issue
Block a user