This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a utility module for ADK data structures | |
| from google.genai import types | |
| # This function needs to be **asynchronous** (`async def`), | |
| # as we need to **await** the responses to be produced. | |
| async def validate_input(user_input: str): | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from google.adk.runners import Runner | |
| validation_agent_runner = Runner( | |
| agent=validation_agent, # We will reference the previous agent we created here | |
| session_service=session_service, # reference the session service we are going to use | |
| app_name=app_name | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ADK uses pydantic for json schema validation | |
| # Import a couple of utility classes here | |
| from pydantic import BaseModel, Field | |
| # Import the LlmAgent class from ADK | |
| from google.adk.agents import LlmAgent | |
| # Specify the output schema | |
| class ValidationOutput(BaseModel): | |
| is_valid: bool = Field(..., description="Indicates if the input is a valid object for the game.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # We will use the InMemorySessionService for this session | |
| # It means the session data only lives in the computer's memory | |
| # while the program is running. | |
| from google.adk.sessions import InMemorySessionService | |
| session_service = InMemorySessionService() | |
| app_name = "ValidationAgent" | |
| user_id="test_user" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| //it is necessary to start a web server, | |
| //so App Engine is happy | |
| */ | |
| const http = require('http'); | |
| const hostname = '0.0.0.0'; | |
| const port = process.env.PORT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using Google.Apis.Services; | |
| using Google.Apis.Auth.OAuth2; | |
| using Google.Apis.Sheets.v4; | |
| using Google.Apis.Sheets.v4.Data; | |
| using UnityEngine; |