Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,35 @@ ifneq (,$(wildcard ./.env))
export
endif

UV_EXISTS := $(shell command -v uv 2> /dev/null)
ifdef UV_EXISTS
PYTHON_TOOL_RUN := uv run
PYTHON_TOOL_SYNC := uv sync
PYTHON_TOOL_LOCK_CHECK := uv lock --check
else
PYTHON_TOOL_RUN := poetry run python
PYTHON_TOOL_SYNC := poetry install
PYTHON_TOOL_LOCK_CHECK := poetry check --lock
endif

ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

TESTPATH := $(ROOT_DIR)/tests/

.PHONY: install
install: # Install virtual environment with poetry
@echo "🚀 Installing dependencies using Poetry"
@poetry install
$(PYTHON_TOOL_SYNC)

.PHONY: check
check: # Check lock file consistency
@echo "🚀 Checking lock file consistency with 'pyproject.toml'"
@poetry check --lock
$(PYTHON_TOOL_LOCK_CHECK)

.PHONY: generate-data
generate-data: # Generate synthetic PDF medical records for testing
@echo "🚀 Generating synthetic data..."
@poetry run python scripts/generate_data.py
$(PYTHON_TOOL_RUN) scripts/generate_data.py

.PHONY: enable-apis
enable-apis: # Enable required Google Cloud APIs
Expand All @@ -51,7 +62,7 @@ create-datastore: enable-apis # Create the Vertex AI Search Data Store using the
.PHONY: create-engine
create-engine: # Create the Enterprise Search App (Engine) using the provided script
@echo "🚀 Creating Enterprise Search App (Engine)..."
@poetry run python scripts/create_enterprise_engine.py
$(PYTHON_TOOL_RUN) scripts/create_enterprise_engine.py

.PHONY: create-gcs-bucket
create-gcs-bucket: # Create the GCS bucket for document ingestion
Expand Down
15 changes: 12 additions & 3 deletions scripts/create_enterprise_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys

# /// script
# requires-python = ">=3.10"
# dependencies = [
# "google-cloud-discoveryengine",
# "python-dotenv",
# ]
# ///

import os
import sys

from dotenv import load_dotenv
from google.api_core.client_options import ClientOptions
from google.api_core.exceptions import NotFound
from google.cloud import discoveryengine_v1 as discoveryengine

from dotenv import load_dotenv

# --- Configuration ---
load_dotenv()
PROJECT_ID = os.getenv("PROJECT_ID")
Expand Down
12 changes: 11 additions & 1 deletion scripts/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Limitations under the License.

# /// script
# requires-python = ">=3.10"
# dependencies = [
# "faker",
# "reportlab",
# ]
# ///

import os
import random

from faker import Faker
from reportlab.lib.pagesizes import LETTER
from reportlab.pdfgen import canvas
Expand Down
12 changes: 10 additions & 2 deletions scripts/generate_golden_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# requires-python = ">=3.10"
# dependencies = [
# "google-cloud-aiplatform",
# "python-dotenv",
# "pypdf",
# ]
# ///

import os
import glob
import json
import pandas as pd
from google.cloud import aiplatform
from vertexai.generative_models import GenerativeModel
import vertexai
from dotenv import load_dotenv
Expand Down
35 changes: 25 additions & 10 deletions scripts/run_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,44 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pandas",
# "google-cloud-aiplatform",
# "google-cloud-aiplatform[evaluation]",
# "python-dotenv",
# "google-adk",
# "google-genai",
# ]
# ///

import json
import pandas as pd
import vertexai
from vertexai.generative_models import GenerativeModel
from vertexai.evaluation import EvalTask
import os
import sys
from dotenv import load_dotenv
import uuid

import pandas as pd
import vertexai
from dotenv import load_dotenv
from google.genai import types
from vertexai.evaluation import EvalTask
from vertexai.generative_models import GenerativeModel

# Load environment variables
load_dotenv()

# Add 'src' to path so we can import the tool
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from src.agents.adk_agent import system_prompt
from src.agents.tools import search_knowledge_base
import asyncio

from google.adk.artifacts import InMemoryArtifactService
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.artifacts import InMemoryArtifactService
from src.agents.adk_agent import agent_config, app_name
import asyncio

from src.agents.adk_agent import agent_config, app_name, system_prompt
from src.agents.tools import search_knowledge_base

# Configuration
PROJECT_ID = os.getenv("PROJECT_ID")
Expand Down