Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(search): run Alexandria query inference without a flag (#5340)

Rakshith Ramprakash59f669eb1302
diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts
index f82716e8c..47647c391 100644
--- a/apps/api/src/config.ts
+++ b/apps/api/src/config.ts
@@ -401,9 +401,9 @@ const configSchema = z.object({
TYPESAFE_API_KEY: emptyStringAsUndefined(z.string().trim().min(1)),
// Alexandria tool discovery: rewrite search queries with Anthropic before
- // tool lookup, and add tools to default searches. Each is also a team flag.
+ // tool lookup, and add tools to default searches (also the alexandriaAutoTools
+ // team flag).
ANTHROPIC_API_KEY: emptyStringAsUndefined(z.string().trim().min(1)),
- ALEXANDRIA_QUERY_INFERENCE: z.stringbool().default(false),
ALEXANDRIA_AUTO_TOOLS: z.stringbool().default(false),
// Exchange (routed data sources service)
diff --git a/apps/api/src/controllers/v2/search.ts b/apps/api/src/controllers/v2/search.ts
index 31bfa0aed..0ec134673 100644
--- a/apps/api/src/controllers/v2/search.ts
+++ b/apps/api/src/controllers/v2/search.ts
@@ -457,7 +457,7 @@ async function searchControllerInner(
highlights: req.body.highlights,
domainTools: req.body.domainTools,
toolDetail: req.body.toolDetail,
- inferToolQuery: queryInferenceEnabled(req.acuc?.flags),
+ inferToolQuery: queryInferenceEnabled(),
autoTools:
(sourcesOmitted || req.body.domainTools === true) &&
!req.auth.team_id.startsWith("preview_keyless_") &&
diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.ts
index 4c197e80d..c59fbf89d 100644
--- a/apps/api/src/controllers/v2/types.ts
+++ b/apps/api/src/controllers/v2/types.ts
@@ -2125,7 +2125,6 @@ export const LOCKDOWN_DEFAULT_MAX_AGE_MS = 2 * 365 * 24 * 60 * 60 * 1000;
export type TeamFlags = {
exchangeRetrieve?: boolean;
- alexandriaQueryInference?: boolean;
alexandriaAutoTools?: boolean;
ignoreRobots?: "disabled" | "allowed" | "forced";
customRobotsAgent?: "disabled" | "allowed";
diff --git a/apps/api/src/search/tool-intent.test.ts b/apps/api/src/search/tool-intent.test.ts
index 45824f58c..1a35fbdaf 100644
--- a/apps/api/src/search/tool-intent.test.ts
+++ b/apps/api/src/search/tool-intent.test.ts
@@ -9,7 +9,6 @@ const mocks = vi.hoisted(() => ({
const config = vi.hoisted(() => ({
ANTHROPIC_API_KEY: undefined as string | undefined,
TYPESAFE_API_KEY: "key" as string | undefined,
- ALEXANDRIA_QUERY_INFERENCE: false,
ALEXANDRIA_AUTO_TOOLS: false,
}));
@@ -114,15 +113,15 @@ describe("inferToolIntent", () => {
describe("feature gates", () => {
it("stay off without an Anthropic key, even for flagged teams", () => {
config.ANTHROPIC_API_KEY = undefined;
- const flags = { alexandriaQueryInference: true, alexandriaAutoTools: true };
- expect(queryInferenceEnabled(flags)).toBe(false);
+ const flags = { alexandriaAutoTools: true };
+ expect(queryInferenceEnabled()).toBe(false);
expect(autoToolsEnabled(flags)).toBe(false);
config.ANTHROPIC_API_KEY = "key";
- expect(queryInferenceEnabled(flags)).toBe(true);
+ expect(queryInferenceEnabled()).toBe(true);
expect(autoToolsEnabled(flags)).toBe(true);
- expect(queryInferenceEnabled({})).toBe(false);
+ expect(autoToolsEnabled({})).toBe(false);
config.TYPESAFE_API_KEY = undefined;
- expect(queryInferenceEnabled(flags)).toBe(false);
+ expect(queryInferenceEnabled()).toBe(false);
config.TYPESAFE_API_KEY = "key";
});
});
diff --git a/apps/api/src/search/tool-intent.ts b/apps/api/src/search/tool-intent.ts
index f617ab119..8de382427 100644
--- a/apps/api/src/search/tool-intent.ts
+++ b/apps/api/src/search/tool-intent.ts
@@ -31,10 +31,7 @@ const modelsConfigured = () =>
config.ANTHROPIC_API_KEY !== undefined &&
config.TYPESAFE_API_KEY !== undefined;
-export const queryInferenceEnabled = (flags: TeamFlags | null | undefined) =>
- modelsConfigured() &&
- (config.ALEXANDRIA_QUERY_INFERENCE ||
- flags?.alexandriaQueryInference === true);
+export const queryInferenceEnabled = modelsConfigured;
export const autoToolsEnabled = (flags: TeamFlags | null | undefined) =>
modelsConfigured() &&