mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
docs: fixing multiple typos
Merge https://github.com/google/adk-python/pull/4221 ### Link to Issue or Description of Change N/A **2. Or, if no issue exists, describe the change:** Fixing various typos in .py files to improve quality: see commit diffs for details **Problem:** See above **Solution:** Fixing the typos ### Testing Plan N/A **Unit Tests:** N/A **Manual End-to-End (E2E) Tests:** N/A ### Checklist - [X] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [X] I have performed a self-review of my own code. - [N/A] I have commented my code, particularly in hard-to-understand areas. - [N/A ] I have added tests that prove my fix is effective or that my feature works. - [N/A] New and existing unit tests pass locally with my changes. - [N/A] I have manually tested my changes end-to-end. - [N/A ] Any dependent changes have been merged and published in downstream modules. ### Additional context N/A COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4221 from didier-durand:fix-typos-e 1bcc8e05cdc116451222dd7fd7b0657745f769c1 PiperOrigin-RevId: 859332402
This commit is contained in:
committed by
Copybara-Service
parent
295b345587
commit
91ec80c606
@@ -134,7 +134,7 @@ class RemoteA2aAgent(BaseAgent):
|
|||||||
Args:
|
Args:
|
||||||
name: Agent name (must be unique identifier)
|
name: Agent name (must be unique identifier)
|
||||||
agent_card: AgentCard object, URL string, or file path string
|
agent_card: AgentCard object, URL string, or file path string
|
||||||
description: Agent description (auto-populated from card if empty)
|
description: Agent description (autopopulated from card if empty)
|
||||||
httpx_client: Optional shared HTTP client (will create own if not
|
httpx_client: Optional shared HTTP client (will create own if not
|
||||||
provided) [deprecated] Use a2a_client_factory instead.
|
provided) [deprecated] Use a2a_client_factory instead.
|
||||||
timeout: HTTP timeout in seconds
|
timeout: HTTP timeout in seconds
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ def _setup_gcp_telemetry(
|
|||||||
# TODO - use trace_to_cloud here as well once otel_to_cloud is no
|
# TODO - use trace_to_cloud here as well once otel_to_cloud is no
|
||||||
# longer experimental.
|
# longer experimental.
|
||||||
enable_cloud_tracing=True,
|
enable_cloud_tracing=True,
|
||||||
# TODO - reenable metrics once errors during shutdown are fixed.
|
# TODO - re-enable metrics once errors during shutdown are fixed.
|
||||||
enable_cloud_metrics=False,
|
enable_cloud_metrics=False,
|
||||||
enable_cloud_logging=True,
|
enable_cloud_logging=True,
|
||||||
google_auth=(credentials, project_id),
|
google_auth=(credentials, project_id),
|
||||||
|
|||||||
@@ -1299,7 +1299,7 @@ def cli_web(
|
|||||||
):
|
):
|
||||||
"""Starts a FastAPI server with Web UI for agents.
|
"""Starts a FastAPI server with Web UI for agents.
|
||||||
|
|
||||||
AGENTS_DIR: The directory of agents, where each sub-directory is a single
|
AGENTS_DIR: The directory of agents, where each subdirectory is a single
|
||||||
agent, containing at least `__init__.py` and `agent.py` files.
|
agent, containing at least `__init__.py` and `agent.py` files.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@@ -1366,7 +1366,7 @@ def cli_web(
|
|||||||
|
|
||||||
@main.command("api_server")
|
@main.command("api_server")
|
||||||
@feature_options()
|
@feature_options()
|
||||||
# The directory of agents, where each sub-directory is a single agent.
|
# The directory of agents, where each subdirectory is a single agent.
|
||||||
# By default, it is the current working directory
|
# By default, it is the current working directory
|
||||||
@click.argument(
|
@click.argument(
|
||||||
"agents_dir",
|
"agents_dir",
|
||||||
@@ -1401,7 +1401,7 @@ def cli_api_server(
|
|||||||
):
|
):
|
||||||
"""Starts a FastAPI server for agents.
|
"""Starts a FastAPI server for agents.
|
||||||
|
|
||||||
AGENTS_DIR: The directory of agents, where each sub-directory is a single
|
AGENTS_DIR: The directory of agents, where each subdirectory is a single
|
||||||
agent, containing at least `__init__.py` and `agent.py` files.
|
agent, containing at least `__init__.py` and `agent.py` files.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ criterion to be used.
|
|||||||
In the sample below, `tool_trajectory_avg_score`, `response_match_score` and
|
In the sample below, `tool_trajectory_avg_score`, `response_match_score` and
|
||||||
`final_response_match_v2` are the standard eval metric names, represented as
|
`final_response_match_v2` are the standard eval metric names, represented as
|
||||||
keys in the dictionary. The values in the dictionary are the corresponding
|
keys in the dictionary. The values in the dictionary are the corresponding
|
||||||
criterions. For the first two metrics, we use simple threshold as the criterion,
|
criteria. For the first two metrics, we use simple threshold as the criterion,
|
||||||
the third one uses `LlmAsAJudgeCriterion`.
|
the third one uses `LlmAsAJudgeCriterion`.
|
||||||
{
|
{
|
||||||
"criteria": {
|
"criteria": {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class PerInvocationResultsAggregator(abc.ABC):
|
|||||||
"""An interface for aggregating per invocation samples.
|
"""An interface for aggregating per invocation samples.
|
||||||
|
|
||||||
AutoRaters that are backed by an LLM are known to have certain degree of
|
AutoRaters that are backed by an LLM are known to have certain degree of
|
||||||
unreliabilty to their responses. In order to counter that we sample the
|
unreliability to their responses. In order to counter that we sample the
|
||||||
autorater more than once for a single invocation.
|
autorater more than once for a single invocation.
|
||||||
|
|
||||||
The aggregator helps convert those multiple samples into a single result.
|
The aggregator helps convert those multiple samples into a single result.
|
||||||
@@ -419,7 +419,7 @@ class RubricBasedEvaluator(LlmAsJudge):
|
|||||||
"""Returns a combined result by aggregating multiple samples for the same invocation.
|
"""Returns a combined result by aggregating multiple samples for the same invocation.
|
||||||
|
|
||||||
AutoRaters that are backed by an LLM are known to have certain degree of
|
AutoRaters that are backed by an LLM are known to have certain degree of
|
||||||
unreliabilty to their responses. In order to counter that we sample the
|
unreliability to their responses. In order to counter that we sample the
|
||||||
autorater more than once for a single invocation.
|
autorater more than once for a single invocation.
|
||||||
|
|
||||||
The aggregator helps convert those multiple samples into a single result.
|
The aggregator helps convert those multiple samples into a single result.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ The Conversation Plan is sequential in nature and the User Simulator must ensure
|
|||||||
|
|
||||||
# Definition of Conversation History
|
# Definition of Conversation History
|
||||||
The Conversation History is the actual dialogue between the User Simulator and the Agent.
|
The Conversation History is the actual dialogue between the User Simulator and the Agent.
|
||||||
The Conversation History may not be complete, but the exsisting dialogue should adhere to the Conversation Plan.
|
The Conversation History may not be complete, but the existing dialogue should adhere to the Conversation Plan.
|
||||||
The Conversation History may contain instances where the User Simulator troubleshoots an incorrect/inappropriate response from the Agent in order to enforce the Conversation Plan.
|
The Conversation History may contain instances where the User Simulator troubleshoots an incorrect/inappropriate response from the Agent in order to enforce the Conversation Plan.
|
||||||
The Conversation History is finished only when the User Simulator outputs `{stop_signal}` in its response. If this token is missing, the conversation between the User Simulator and the Agent has not finished, and more turns can be generated.
|
The Conversation History is finished only when the User Simulator outputs `{stop_signal}` in its response. If this token is missing, the conversation between the User Simulator and the Agent has not finished, and more turns can be generated.
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ def _parse_llm_response(response: str) -> Label:
|
|||||||
response,
|
response,
|
||||||
)
|
)
|
||||||
|
|
||||||
# If there was not match for "is_valid", return NOT_FOUND
|
# If there was no match for "is_valid", return NOT_FOUND
|
||||||
if is_valid_match is None:
|
if is_valid_match is None:
|
||||||
return Label.NOT_FOUND
|
return Label.NOT_FOUND
|
||||||
|
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ async def _execute_single_function_call_async(
|
|||||||
function_response = altered_function_response
|
function_response = altered_function_response
|
||||||
|
|
||||||
if tool.is_long_running:
|
if tool.is_long_running:
|
||||||
# Allow long running function to return None to not provide function
|
# Allow long-running function to return None to not provide function
|
||||||
# response.
|
# response.
|
||||||
if not function_response:
|
if not function_response:
|
||||||
return None
|
return None
|
||||||
@@ -894,7 +894,7 @@ def find_matching_function_call(
|
|||||||
)
|
)
|
||||||
for i in range(len(events) - 2, -1, -1):
|
for i in range(len(events) - 2, -1, -1):
|
||||||
event = events[i]
|
event = events[i]
|
||||||
# looking for the system long running request euc function call
|
# looking for the system long-running request euc function call
|
||||||
function_calls = event.get_function_calls()
|
function_calls = event.get_function_calls()
|
||||||
if not function_calls:
|
if not function_calls:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class VertexAiRagMemoryService(BaseMemoryService):
|
|||||||
or ``{rag_corpus_id}``
|
or ``{rag_corpus_id}``
|
||||||
similarity_top_k: The number of contexts to retrieve.
|
similarity_top_k: The number of contexts to retrieve.
|
||||||
vector_distance_threshold: Only returns contexts with vector distance
|
vector_distance_threshold: Only returns contexts with vector distance
|
||||||
smaller than the threshold..
|
smaller than the threshold.
|
||||||
"""
|
"""
|
||||||
self._vertex_rag_store = types.VertexRagStore(
|
self._vertex_rag_store = types.VertexRagStore(
|
||||||
rag_resources=[
|
rag_resources=[
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ https://google.github.io/adk-docs/agents/models/#error-code-429-resource_exhaust
|
|||||||
|
|
||||||
|
|
||||||
class _ResourceExhaustedError(ClientError):
|
class _ResourceExhaustedError(ClientError):
|
||||||
"""Represents an resources exhausted error received from the Model."""
|
"""Represents a resources exhausted error received from the Model."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ _LITELLM_GLOBAL_SYMBOLS = (
|
|||||||
def _ensure_litellm_imported() -> None:
|
def _ensure_litellm_imported() -> None:
|
||||||
"""Imports LiteLLM with safe defaults.
|
"""Imports LiteLLM with safe defaults.
|
||||||
|
|
||||||
LiteLLM defaults to DEV mode, which auto-loads a local `.env` at import time.
|
LiteLLM defaults to DEV mode, which autoloads a local `.env` at import time.
|
||||||
ADK should not implicitly load `.env` just because LiteLLM is installed.
|
ADK should not implicitly load `.env` just because LiteLLM is installed.
|
||||||
|
|
||||||
Users can opt into LiteLLM's default behavior by setting LITELLM_MODE=DEV.
|
Users can opt into LiteLLM's default behavior by setting LITELLM_MODE=DEV.
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class BasePlugin(ABC):
|
|||||||
callback in the chain. For example, if a plugin modifies the tool input with
|
callback in the chain. For example, if a plugin modifies the tool input with
|
||||||
before_tool_callback, the modified tool input will be passed to the
|
before_tool_callback, the modified tool input will be passed to the
|
||||||
before_tool_callback of the next plugin, and further passed to the agent
|
before_tool_callback of the next plugin, and further passed to the agent
|
||||||
callbacks if not short circuited.
|
callbacks if not short-circuited.
|
||||||
|
|
||||||
To use a plugin, implement the desired callback methods and pass an instance
|
To use a plugin, implement the desired callback methods and pass an instance
|
||||||
of your custom plugin class to the ADK Runner.
|
of your custom plugin class to the ADK Runner.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if TYPE_CHECKING:
|
|||||||
class LoggingPlugin(BasePlugin):
|
class LoggingPlugin(BasePlugin):
|
||||||
"""A plugin that logs important information at each callback point.
|
"""A plugin that logs important information at each callback point.
|
||||||
|
|
||||||
This plugin helps printing all critical events in the console. It is not a
|
This plugin helps print all critical events in the console. It is not a
|
||||||
replacement of existing logging in ADK. It rather helps terminal based
|
replacement of existing logging in ADK. It rather helps terminal based
|
||||||
debugging by showing all logs in the console, and serves as a simple demo for
|
debugging by showing all logs in the console, and serves as a simple demo for
|
||||||
everyone to leverage when developing new plugins.
|
everyone to leverage when developing new plugins.
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ class Runner:
|
|||||||
else:
|
else:
|
||||||
# Step 2: Otherwise continue with normal execution
|
# Step 2: Otherwise continue with normal execution
|
||||||
# Note for live/bidi:
|
# Note for live/bidi:
|
||||||
# the transcription may arrive later then the action(function call
|
# the transcription may arrive later than the action(function call
|
||||||
# event and thus function response event). In this case, the order of
|
# event and thus function response event). In this case, the order of
|
||||||
# transcription and function call event will be wrong if we just
|
# transcription and function call event will be wrong if we just
|
||||||
# append as it arrives. To address this, we should check if there is
|
# append as it arrives. To address this, we should check if there is
|
||||||
@@ -770,7 +770,7 @@ class Runner:
|
|||||||
# identified by checking if the transcription event is partial. When
|
# identified by checking if the transcription event is partial. When
|
||||||
# the next transcription event is not partial, it means the previous
|
# the next transcription event is not partial, it means the previous
|
||||||
# transcription is finished. Then if there is any buffered function
|
# transcription is finished. Then if there is any buffered function
|
||||||
# call event, we should append them after this finished(non-parital)
|
# call event, we should append them after this finished(non-partial)
|
||||||
# transcription event.
|
# transcription event.
|
||||||
buffered_events: list[Event] = []
|
buffered_events: list[Event] = []
|
||||||
is_transcribing: bool = False
|
is_transcribing: bool = False
|
||||||
@@ -789,7 +789,7 @@ class Runner:
|
|||||||
buffered_events.append(event)
|
buffered_events.append(event)
|
||||||
continue
|
continue
|
||||||
# Note for live/bidi: for audio response, it's considered as
|
# Note for live/bidi: for audio response, it's considered as
|
||||||
# non-paritla event(event.partial=None)
|
# non-partial event(event.partial=None)
|
||||||
# event.partial=False and event.partial=None are considered as
|
# event.partial=False and event.partial=None are considered as
|
||||||
# non-partial event; event.partial=True is considered as partial
|
# non-partial event; event.partial=True is considered as partial
|
||||||
# event.
|
# event.
|
||||||
@@ -938,7 +938,7 @@ class Runner:
|
|||||||
* **Live Model Audio Events with Inline Data:** Events containing raw
|
* **Live Model Audio Events with Inline Data:** Events containing raw
|
||||||
audio `Blob` data(`inline_data`).
|
audio `Blob` data(`inline_data`).
|
||||||
* **Live Model Audio Events with File Data:** Both input and ouput audio
|
* **Live Model Audio Events with File Data:** Both input and ouput audio
|
||||||
data are aggregated into a audio file saved into artifacts. The
|
data are aggregated into an audio file saved into artifacts. The
|
||||||
reference to the file is saved in the event as `file_data`.
|
reference to the file is saved in the event as `file_data`.
|
||||||
* **Usage Metadata:** Events containing token usage.
|
* **Usage Metadata:** Events containing token usage.
|
||||||
* **Transcription Events:** Both partial and non-partial transcription
|
* **Transcription Events:** Both partial and non-partial transcription
|
||||||
@@ -948,7 +948,7 @@ class Runner:
|
|||||||
|
|
||||||
**Events Saved to the Session:**
|
**Events Saved to the Session:**
|
||||||
* **Live Model Audio Events with File Data:** Both input and ouput audio
|
* **Live Model Audio Events with File Data:** Both input and ouput audio
|
||||||
data are aggregated into a audio file saved into artifacts. The
|
data are aggregated into an audio file saved into artifacts. The
|
||||||
reference to the file is saved as event in the `file_data` to session
|
reference to the file is saved as event in the `file_data` to session
|
||||||
if RunConfig.save_live_model_audio_to_session is True.
|
if RunConfig.save_live_model_audio_to_session is True.
|
||||||
* **Usage Metadata Events:** Saved to the session.
|
* **Usage Metadata Events:** Saved to the session.
|
||||||
@@ -1099,7 +1099,7 @@ class Runner:
|
|||||||
# If the last event is a function response, should send this response to
|
# If the last event is a function response, should send this response to
|
||||||
# the agent that returned the corresponding function call regardless the
|
# the agent that returned the corresponding function call regardless the
|
||||||
# type of the agent. e.g. a remote a2a agent may surface a credential
|
# type of the agent. e.g. a remote a2a agent may surface a credential
|
||||||
# request as a special long running function tool call.
|
# request as a special long-running function tool call.
|
||||||
event = find_matching_function_call(session.events)
|
event = find_matching_function_call(session.events)
|
||||||
if event and event.author:
|
if event and event.author:
|
||||||
return root_agent.find_agent(event.author)
|
return root_agent.find_agent(event.author)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def upgrade(source_db_url: str, dest_db_url: str):
|
|||||||
LATEST_VERSION.
|
LATEST_VERSION.
|
||||||
|
|
||||||
If multiple migration steps are required, intermediate results are stored in
|
If multiple migration steps are required, intermediate results are stored in
|
||||||
temporary SQLite database files. This means a multi-step migration
|
temporary SQLite database files. This means a multistep migration
|
||||||
between other database types (e.g. PostgreSQL to PostgreSQL) will use
|
between other database types (e.g. PostgreSQL to PostgreSQL) will use
|
||||||
SQLite for intermediate steps.
|
SQLite for intermediate steps.
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the Licens
|
# limitations under the License
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
import json
|
||||||
|
|||||||
@@ -130,14 +130,14 @@ class TestRunnerRewind:
|
|||||||
rewind_before_invocation_id="invocation2",
|
rewind_before_invocation_id="invocation2",
|
||||||
)
|
)
|
||||||
|
|
||||||
# 3. Verify state and artifacts are rewinded
|
# 3. Verify state and artifacts are rewound
|
||||||
session = await runner.session_service.get_session(
|
session = await runner.session_service.get_session(
|
||||||
app_name=runner.app_name, user_id=user_id, session_id=session_id
|
app_name=runner.app_name, user_id=user_id, session_id=session_id
|
||||||
)
|
)
|
||||||
# After rewind before invocation2, only event1 state delta should apply.
|
# After rewind before invocation2, only event1 state delta should apply.
|
||||||
assert session.state["k1"] == "v1"
|
assert session.state["k1"] == "v1"
|
||||||
assert not session.state["k2"]
|
assert not session.state["k2"]
|
||||||
# f1 should be rewinded to v0
|
# f1 should be rewound to v0
|
||||||
assert await runner.artifact_service.load_artifact(
|
assert await runner.artifact_service.load_artifact(
|
||||||
app_name=runner.app_name,
|
app_name=runner.app_name,
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
@@ -226,7 +226,7 @@ class TestRunnerRewind:
|
|||||||
rewind_before_invocation_id="invocation3",
|
rewind_before_invocation_id="invocation3",
|
||||||
)
|
)
|
||||||
|
|
||||||
# 3. Verify state and artifacts are rewinded
|
# 3. Verify state and artifacts are rewound
|
||||||
session = await runner.session_service.get_session(
|
session = await runner.session_service.get_session(
|
||||||
app_name=runner.app_name, user_id=user_id, session_id=session_id
|
app_name=runner.app_name, user_id=user_id, session_id=session_id
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user