Skip to content

Conversation

@alexechoi
Copy link
Owner

@alexechoi alexechoi commented Nov 15, 2025

Add research router

High-level PR Summary

This PR adds infrastructure for a research router by integrating the Google Gemini AI SDK (@google/genai). It includes a health check endpoint at /api/health, initializes a Gemini AI client in lib/gemini.ts, and updates dependencies to include the necessary Google AI library along with its transitive dependencies.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 junction-app/app/api/health/index.ts
2 junction-app/lib/gemini.ts
3 junction-app/package.json
4 junction-app/bun.lock
⚠️ Inconsistent Changes Detected
File Path Warning
junction-app/app/api/health/index.ts Adding a generic health check endpoint seems unrelated to the main purpose of adding a research router with AI capabilities. This appears to be general infrastructure rather than research-specific functionality.

Need help? Join our Discord

@vercel
Copy link

vercel bot commented Nov 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
aegis Ready Ready Preview Comment Nov 15, 2025 7:23pm

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 327c8d4..5cfe36c

  Severity     Location     Issue     Delete  
High junction-app/lib/gemini.ts:4 Missing required API key parameter
✅ Files analyzed, no issues (3)

junction-app/app/api/health/index.ts
junction-app/bun.lock
junction-app/package.json

import { GoogleGenAI } from "@google/genai";

// The client gets the API key from the environment variable `GEMINI_API_KEY`.
export const ai = new GoogleGenAI({});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GoogleGenAI client is initialized with an empty configuration object, missing the required 'apiKey' parameter. According to the official Google GenAI SDK documentation (https://docs.cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview), the correct initialization requires explicitly passing the API key:

const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
const ai = new GoogleGenAI({vertexai: false, apiKey: GEMINI_API_KEY});

The current implementation passes an empty object {} without the required apiKey parameter. While the comment suggests "The client gets the API key from the environment variable GEMINI_API_KEY", the @google/genai library does NOT automatically read environment variables without explicit configuration.

When this client is used to make any API calls (e.g., ai.models.generateContent()), it will fail with an authentication error because no API key is configured. This will cause immediate runtime failures in any code that imports and uses this client.

To fix this bug, the code should be updated to:

import { GoogleGenAI } from "@google/genai";

const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
export const ai = new GoogleGenAI({apiKey: GEMINI_API_KEY});

React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

…; update query handling to open modal on entity not found
@alexechoi alexechoi marked this pull request as ready for review November 15, 2025 19:23
@alexechoi alexechoi merged commit beab33c into main Nov 15, 2025
4 checks passed
@alexechoi alexechoi deleted the alex/add-call-router branch November 15, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants