Skip to content

Commit 6057845

Browse files
authored
feat: Consolidate on a single LangGraph orchestration (#540)
This PR removes LangChain tools and Vertex AI Function Calling orchestration and consolidates on LangGraph. It also flattens the directory structure and refactors to simplify some parts of code for easier understanding. > [!NOTE] > The failure in the integration test is expected. This PR is part of a series of changes, and the corresponding fix for this test is in a subsequent PR. > ### Reasoning > We've intentionally split the work into smaller, focused PRs to make the review process more manageable and efficient. > ### Merge Plan > All related PRs will be merged into the `toolbox-main` branch first. We will ensure all tests are passing on `toolbox-main` before merging the entire feature set into `main`.
1 parent 91c0bec commit 6057845

28 files changed

+26
-48
lines changed

.github/sync-repo-settings.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ branchProtectionRules:
3535
- "retrieval-service-postgres-pr (retrieval-app-testing)"
3636
- "retrieval-service-alloydb-pr (retrieval-app-testing)"
3737
- "retrieval-service-cloudsql-pg-pr (retrieval-app-testing)"
38-
- "llm-demo-langchain-tools-pr (retrieval-app-testing)"
3938
- "llm-demo-langgraph-pr (retrieval-app-testing)"
40-
- "llm-demo-vertexai-fc-pr (retrieval-app-testing)"
4139
# Set team access
4240
permissionRules:
4341
- team: senseai-eco

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
matrix:
37-
dir: [retrieval_service, llm_demo]
37+
dir: [retrieval_service]
3838
fail-fast: false
3939
permissions:
4040
contents: read

.github/workflows/lint_fallback.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
strategy:
2727
matrix:
28-
dir: [retrieval_service, llm_demo]
28+
dir: [retrieval_service]
2929
permissions:
3030
contents: none
3131

File renamed without changes.

llm_demo/app.py renamed to app.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from markdown import markdown
2828
from starlette.middleware.sessions import SessionMiddleware
2929

30-
from orchestrator import createOrchestrator
30+
from orchestrator import Orchestrator
3131

3232
routes = APIRouter()
3333
templates = Jinja2Templates(directory="templates")
@@ -237,16 +237,13 @@ def clear_user_info(session: dict[str, Any]):
237237

238238

239239
def init_app(
240-
orchestration_type: Optional[str],
241240
client_id: Optional[str],
242241
middleware_secret: Optional[str],
243242
) -> FastAPI:
244243
# FastAPI setup
245-
if orchestration_type is None:
246-
raise HTTPException(status_code=500, detail="Orchestrator not found")
247244
app = FastAPI(lifespan=lifespan)
248245
app.state.client_id = client_id
249-
app.state.orchestrator = createOrchestrator(orchestration_type)
246+
app.state.orchestrator = Orchestrator()
250247
app.include_router(routes)
251248
app.mount("/static", StaticFiles(directory="static"), name="static")
252249
app.add_middleware(SessionMiddleware, secret_key=middleware_secret)
@@ -256,12 +253,9 @@ def init_app(
256253
if __name__ == "__main__":
257254
PORT = int(os.getenv("PORT", default=8081))
258255
HOST = os.getenv("HOST", default="0.0.0.0")
259-
ORCHESTRATION_TYPE = os.getenv("ORCHESTRATION_TYPE", default="langchain-tools")
260256
CLIENT_ID = os.getenv("CLIENT_ID")
261257
MIDDLEWARE_SECRET = os.getenv("MIDDLEWARE_SECRET", default="this is a secret")
262-
app = init_app(
263-
ORCHESTRATION_TYPE, client_id=CLIENT_ID, middleware_secret=MIDDLEWARE_SECRET
264-
)
258+
app = init_app(client_id=CLIENT_ID, middleware_secret=MIDDLEWARE_SECRET)
265259
if app is None:
266260
raise TypeError("app not instantiated")
267261
uvicorn.run(app, host=HOST, port=PORT)
File renamed without changes.

llm_demo/evaluation.cloudbuild.yaml renamed to evaluation.cloudbuild.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
steps:
1515
- id: Install dependencies
1616
name: python:3.11
17-
dir: llm_demo
1817
script: pip install -r requirements.txt -r requirements-test.txt --user
1918

2019
- id: "Run evaluation service"
2120
name: python:3.11
22-
dir: llm_demo
2321
env: # Set env var expected by tests
24-
- "ORCHESTRATION_TYPE=${_ORCHESTRATION_TYPE}"
2522
- "RETRIEVAL_EXPERIMENT_NAME=${_RETRIEVAL_EXPERIMENT_NAME}"
2623
- "RESPONSE_EXPERIMENT_NAME=${_RESPONSE_EXPERIMENT_NAME}"
2724
secretEnv:
@@ -37,7 +34,6 @@ options:
3734
dynamic_substitutions: true
3835

3936
substitutions:
40-
_ORCHESTRATION_TYPE: "langchain-tools"
4137
_RETRIEVAL_EXPERIMENT_NAME: "retrieval-phase-eval-${_PR_NUMBER}"
4238
_RESPONSE_EXPERIMENT_NAME: "response-phase-eval-${_PR_NUMBER}"
4339

File renamed without changes.
File renamed without changes.

llm_demo/evaluation/evaluation.py renamed to evaluation/evaluation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@
1717
from typing import Dict, List
1818

1919
import pandas as pd
20-
from pydantic import BaseModel, Field
2120
from vertexai.evaluation import EvalTask
2221
from vertexai.evaluation import _base as evaluation_base
2322

24-
from orchestrator import BaseOrchestrator
23+
from orchestrator import Orchestrator
2524

2625
from .eval_golden import EvalData, ToolCall
2726
from .metrics import response_phase_metrics, retrieval_phase_metrics
2827

2928

3029
async def run_llm_for_eval(
31-
eval_list: List[EvalData], orc: BaseOrchestrator, session: Dict, session_id: str
30+
eval_list: List[EvalData], orc: Orchestrator, session: Dict, session_id: str
3231
) -> List[EvalData]:
3332
"""
3433
Generate llm_tool_calls and llm_output for golden dataset query.
35-
This function is only compatible with the langchain-tools orchestration.
3634
"""
3735
agent = orc.get_user_session(session_id)
3836
for eval_data in eval_list:

0 commit comments

Comments
 (0)