Skip to content

Commit 3129ca1

Browse files
authored
fix: Remove is enabled check for raw data requests (#62)
- Leave enabled check only for llm agent usage - Raw data tool will be enabled if a corresponding api key has been provided in env
1 parent cc3b091 commit 3129ca1

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

src/__tests__/SentientAI.test.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ describe("SentientAI", () => {
6060
it("should throw if FAST_LLM_MODEL is not set", () => {
6161
delete process.env.FAST_LLM_MODEL;
6262
expect(() => new SentientAI()).toThrow(
63-
"FAST_LLM_MODEL and LLM_MODEL must be set",
63+
"FAST_LLM_MODEL and LLM_MODEL must be set"
6464
);
6565
});
6666

6767
it("should throw if LLM_MODEL is not set", () => {
6868
delete process.env.LLM_MODEL;
6969
expect(() => new SentientAI()).toThrow(
70-
"FAST_LLM_MODEL and LLM_MODEL must be set",
70+
"FAST_LLM_MODEL and LLM_MODEL must be set"
7171
);
7272
});
7373

7474
it("should throw if both models are not set", () => {
7575
delete process.env.FAST_LLM_MODEL;
7676
delete process.env.LLM_MODEL;
7777
expect(() => new SentientAI()).toThrow(
78-
"FAST_LLM_MODEL and LLM_MODEL must be set",
78+
"FAST_LLM_MODEL and LLM_MODEL must be set"
7979
);
8080
});
8181

@@ -88,7 +88,6 @@ describe("SentientAI", () => {
8888

8989
describe("getRawData", () => {
9090
it("should return raw data for an enabled tool", async () => {
91-
process.env.ENABLED_TOOLS = "weather-current";
9291
const sentai = new SentientAI();
9392
const params = { latitude: 37.7749, longitude: -122.4194 };
9493
const result = await sentai.getRawData("weather-current", params);
@@ -99,15 +98,7 @@ describe("SentientAI", () => {
9998
process.env.ENABLED_TOOLS = "weather-current";
10099
const sentai = new SentientAI();
101100
await expect(sentai.getRawData("non-existent-tool", {})).rejects.toThrow(
102-
"Tool 'non-existent-tool' not found",
103-
);
104-
});
105-
106-
it("should throw when tool is not enabled", async () => {
107-
process.env.ENABLED_TOOLS = "weather-current";
108-
const sentai = new SentientAI();
109-
await expect(sentai.getRawData("weather-forecast", {})).rejects.toThrow(
110-
"Tool 'weather-forecast' is not enabled",
101+
"Tool 'non-existent-tool' not found"
111102
);
112103
});
113104
});

src/sentientAI.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class SentientAI {
3636
toolName: string,
3737
params: Record<string, any>
3838
): Promise<any> {
39-
const tool = this.getTool(toolName);
39+
const tool = this.getRawTool(toolName);
4040
return this.rawDataProvider.process(tool, params);
4141
}
4242

@@ -48,14 +48,11 @@ export class SentientAI {
4848
return this.orchestrator.processStream(input);
4949
}
5050

51-
private getTool(toolName: string): QSTool {
51+
private getRawTool(toolName: string): QSTool {
5252
const tool = ToolRegistry.getTool(toolName as ToolName);
5353
if (!tool) {
5454
throw new Error(`Tool '${toolName}' not found`);
5555
}
56-
if (!ToolRegistry.isEnabled(toolName as ToolName)) {
57-
throw new Error(`Tool '${toolName}' is not enabled`);
58-
}
5956
return tool;
6057
}
6158
}

0 commit comments

Comments
 (0)