mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 01:41:25 -06:00
* Fix typos in docstrings of evaluation_generator.py and event.py (#101) Corrected 'resposnes' to 'responses', 'uncertainity' to 'uncertainty', 'conversaction' to 'conversation', and 'exeuction' to 'execution' in relevant docstrings for clarity. * Fix typos in docstrings and comments across multiple files Corrected 'detla' to 'delta', 'buil-in' to 'built-in', 'walkaround' to 'workaround', and 'conversaction' to 'conversation' for clarity in relevant files. Updated comments for consistency. --------- Co-authored-by: Hangfei Lin <hangfei@google.com>
This commit is contained in:
parent
d810ff7b28
commit
089c1e6428
@ -42,10 +42,10 @@ class EvaluationGenerator:
|
||||
"""Returns evaluation responses for the given dataset and agent.
|
||||
|
||||
Args:
|
||||
eval_dataset: The dataset that needs to be scraped for resposnes.
|
||||
eval_dataset: The dataset that needs to be scraped for responses.
|
||||
agent_module_path: Path to the module that contains the root agent.
|
||||
repeat_num: Number of time the eval dataset should be repeated. This is
|
||||
usually done to remove uncertainity that a single run may bring.
|
||||
usually done to remove uncertainty that a single run may bring.
|
||||
agent_name: The name of the agent that should be evaluated. This is
|
||||
usually the sub-agent.
|
||||
initial_session: Initial session for the eval data.
|
||||
@ -253,8 +253,8 @@ class EvaluationGenerator:
|
||||
all_mock_tools: set[str],
|
||||
):
|
||||
"""Recursively apply the before_tool_callback to the root agent and all its subagents."""
|
||||
# check if the agent has tools that defined by evalset
|
||||
# We use function name to check if tools match
|
||||
# Check if the agent has tools that are defined by evalset.
|
||||
# We use function names to check if tools match
|
||||
if not isinstance(agent, Agent) and not isinstance(agent, LlmAgent):
|
||||
return
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Event(LlmResponse):
|
||||
agent_2, and agent_2 is the parent of agent_3.
|
||||
|
||||
Branch is used when multiple sub-agent shouldn't see their peer agents'
|
||||
conversaction history.
|
||||
conversation history.
|
||||
"""
|
||||
|
||||
# The following are computed fields.
|
||||
@ -94,7 +94,7 @@ class Event(LlmResponse):
|
||||
not self.get_function_calls()
|
||||
and not self.get_function_responses()
|
||||
and not self.partial
|
||||
and not self.has_trailing_code_exeuction_result()
|
||||
and not self.has_trailing_code_execution_result()
|
||||
)
|
||||
|
||||
def get_function_calls(self) -> list[types.FunctionCall]:
|
||||
@ -115,7 +115,7 @@ class Event(LlmResponse):
|
||||
func_response.append(part.function_response)
|
||||
return func_response
|
||||
|
||||
def has_trailing_code_exeuction_result(
|
||||
def has_trailing_code_execution_result(
|
||||
self,
|
||||
) -> bool:
|
||||
"""Returns whether the event has a trailing code execution result."""
|
||||
|
@ -31,9 +31,9 @@ FINAL_ANSWER_TAG = '/*FINAL_ANSWER*/'
|
||||
|
||||
|
||||
class PlanReActPlanner(BasePlanner):
|
||||
"""Plan-Re-Act planner that constraints the LLM response to generate a plan before any action/observation.
|
||||
"""Plan-Re-Act planner that constrains the LLM response to generate a plan before any action/observation.
|
||||
|
||||
Note: this planner does not require the model to support buil-in thinking
|
||||
Note: this planner does not require the model to support built-in thinking
|
||||
features or setting the thinking config.
|
||||
"""
|
||||
|
||||
|
@ -108,7 +108,7 @@ class Runner:
|
||||
"""Runs the agent.
|
||||
|
||||
NOTE: This sync interface is only for local testing and convenience purpose.
|
||||
Consider to use `run_async` for production usage.
|
||||
Consider using `run_async` for production usage.
|
||||
|
||||
Args:
|
||||
user_id: The user ID of the session.
|
||||
|
@ -49,7 +49,7 @@ class State:
|
||||
return key in self._value or key in self._delta
|
||||
|
||||
def has_delta(self) -> bool:
|
||||
"""Whether the state has pending detla."""
|
||||
"""Whether the state has pending delta."""
|
||||
return bool(self._delta)
|
||||
|
||||
def get(self, key: str, default: Any = None) -> Any:
|
||||
|
@ -36,21 +36,21 @@ def assert_agent_says(
|
||||
|
||||
|
||||
def assert_agent_says_in_order(
|
||||
expected_conversaction: list[Message], agent_runner: TestRunner
|
||||
expected_conversation: list[Message], agent_runner: TestRunner
|
||||
):
|
||||
expected_conversaction_idx = len(expected_conversaction) - 1
|
||||
expected_conversation_idx = len(expected_conversation) - 1
|
||||
for event in reversed(agent_runner.get_events()):
|
||||
if event.content.parts and event.content.parts[0].text:
|
||||
assert (
|
||||
event.author
|
||||
== expected_conversaction[expected_conversaction_idx]['agent_name']
|
||||
== expected_conversation[expected_conversation_idx]['agent_name']
|
||||
)
|
||||
assert (
|
||||
event.content.parts[0].text.strip()
|
||||
== expected_conversaction[expected_conversaction_idx]['expected_text']
|
||||
== expected_conversation[expected_conversation_idx]['expected_text']
|
||||
)
|
||||
expected_conversaction_idx -= 1
|
||||
if expected_conversaction_idx < 0:
|
||||
expected_conversation_idx -= 1
|
||||
if expected_conversation_idx < 0:
|
||||
return
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ from google.genai import types
|
||||
|
||||
|
||||
class TestRunner:
|
||||
"""Agents runner for testings."""
|
||||
"""Agents runner for testing."""
|
||||
|
||||
app_name = "test_app"
|
||||
user_id = "test_user"
|
||||
|
@ -53,7 +53,7 @@ def _raise_for_any_of_if_mldev(schema: types.Schema):
|
||||
|
||||
def _update_for_default_if_mldev(schema: types.Schema):
|
||||
if schema.default is not None:
|
||||
# TODO(kech): Remove this walkaround once mldev supports default value.
|
||||
# TODO(kech): Remove this workaround once mldev supports default value.
|
||||
schema.default = None
|
||||
logger.warning(
|
||||
'Default value is not supported in function declaration schema for'
|
||||
|
@ -267,11 +267,11 @@ def test_basemodel_list():
|
||||
# TODO: comment out this test for now as crewai requires python 3.10 as minimum
|
||||
# def test_crewai_tool():
|
||||
# docs_tool = CrewaiTool(
|
||||
# name='direcotry_read_tool',
|
||||
# name='directory_read_tool',
|
||||
# description='use this to find files for you.',
|
||||
# tool=FileReadTool(),
|
||||
# )
|
||||
# function_decl = docs_tool.get_declaration()
|
||||
# assert function_decl.name == 'direcotry_read_tool'
|
||||
# assert function_decl.name == 'directory_read_tool'
|
||||
# assert function_decl.parameters.type == 'OBJECT'
|
||||
# assert function_decl.parameters.properties['file_path'].type == 'STRING'
|
||||
|
Loading…
Reference in New Issue
Block a user