Add ADK Agent implementation #1

Merged
A8065384 merged 6 commits from adk into main 2026-02-23 05:27:45 +00:00
5 changed files with 1298 additions and 27 deletions
Showing only changes of commit 733c65ce85 - Show all commits

View File

@@ -1,11 +1,7 @@
project_id: bnt-orquestador-cognitivo-dev
location: us-central1
service_account: sa-cicd-gitlab@bnt-orquestador-cognitivo-dev.iam.gserviceaccount.com
bucket: bnt_orquestador_cognitivo_gcs_configs_dev
base_image: us-central1-docker.pkg.dev/bnt-orquestador-cognitivo-dev/dfcx-pipelines/ap01194-orq-cog-dfcx-agent-eval-in:v1.0.6-ft-anibal
dialogflow_agent_id: 5590ff1d-1f66-4777-93f5-1a608f1900ac
processing_image: us-central1-docker.pkg.dev/bnt-orquestador-cognitivo-dev/dfcx-pipelines/ap01194-orq-cog-rag-ops:v1.3.7
agent_name: sigma
agent_instructions: |
@@ -157,17 +153,10 @@ agent_embedding_model: gemini-embedding-001
agent_thinking: 0
index_name: si1
index_deployed_id: si1_deployed
index_endpoint: projects/1007577023101/locations/us-central1/indexEndpoints/76334694269976576
index_dimensions: 3072
index_machine_type: e2-standard-16
index_origin: gs://bnt_orquestador_cognitivo_gcs_kb_dev/
index_destination: gs://bnt_orquestador_cognitivo_gcs_configs_dev/
index_chunk_limit: 3000
bigquery_project_id: "bnt-lakehouse-innovacion-des"
bigquery_dataset_id: "ds_orquestador_des"
bigquery_table_ids:
synth_gen: "eval_questions"
search_eval: "search_results"
keypoint_eval: "keypoints_results"
red_team: "redteam_results"

View File

@@ -29,6 +29,7 @@ build-backend = "uv_build"
[dependency-groups]
dev = [
"clai>=1.62.0",
"pytest>=8.4.1",
"ruff>=0.12.10",
"ty>=0.0.1a19",

View File

@@ -52,7 +52,7 @@ async def conocimiento(ctx: RunContext[Deps], query: str) -> str:
t_embed = time.perf_counter()
search_results = await ctx.deps.vector_search.async_run_query(
deployed_index_id=settings.index_name,
deployed_index_id=settings.index_deployed_id,
query=list(query_embedding.embeddings[0]),
limit=5,
)
@@ -82,3 +82,11 @@ async def conocimiento(ctx: RunContext[Deps], query: str) -> str:
for i, result in enumerate(search_results, start=1)
]
return "\n".join(formatted_results)
if __name__ == "__main__":
deps = Deps(
vector_search=settings.vector_search,
embedder=settings.embedder,
)
agent.to_cli_sync(deps=deps)

View File

@@ -22,7 +22,7 @@ class Settings(BaseSettings):
project_id: str
location: str
service_account: str
bucket: str
agent_name: str
agent_instructions: str
@@ -31,6 +31,7 @@ class Settings(BaseSettings):
agent_thinking: int
index_name: str
index_deployed_id: str
index_endpoint: str
index_dimensions: int
index_machine_type: str = "e2-standard-16"
@@ -38,14 +39,6 @@ class Settings(BaseSettings):
index_destination: str
index_chunk_limit: int
bigquery_dataset_id: str
bigquery_project_id: str | None = None
bigquery_table_ids: dict[str, str]
bucket: str
base_image: str
dialogflow_agent_id: str
processing_image: str
model_config = SettingsConfigDict(yaml_file=CONFIG_FILE_PATH)
@@ -75,12 +68,14 @@ class Settings(BaseSettings):
@cached_property
def vector_search(self) -> GoogleCloudVectorSearch:
"""Return a configured vector search client."""
return GoogleCloudVectorSearch(
vs = GoogleCloudVectorSearch(
project_id=self.project_id,
location=self.location,
bucket=self.bucket,
index_name=self.index_name,
)
vs.load_index_endpoint(self.index_endpoint)
return vs
@cached_property
def embedder(self) -> Embedder:

1286
uv.lock generated

File diff suppressed because it is too large Load Diff