Skip to content
Closed
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
52 changes: 0 additions & 52 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1077,45 +1077,6 @@ dependencies {
)
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"org.springframework.ai:spring-ai-starter-model-google-genai:${springAiVersion}",
"spring-ai-starter-google-genai",
"spring-ai",
"https://github.com/spring-projects/spring-ai",
ExternalDependency.APACHE_2_LICENSE_NAME,
ExternalDependency.APACHE_2_LICENSE_URL,
"LLM Chat Client integration for Gemini"
)
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"org.springframework.ai:spring-ai-anthropic:${springAiVersion}",
"spring-ai-anthropic",
"spring-ai",
"https://github.com/spring-projects/spring-ai",
ExternalDependency.APACHE_2_LICENSE_NAME,
ExternalDependency.APACHE_2_LICENSE_URL,
"LLM Chat Client integration for Claude"
)
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"org.springframework.ai:spring-ai-openai:${springAiVersion}",
"spring-ai-openai",
"spring-ai",
"https://github.com/spring-projects/spring-ai",
ExternalDependency.APACHE_2_LICENSE_NAME,
ExternalDependency.APACHE_2_LICENSE_URL,
"LLM Chat Client integration for ChatGPT"
)
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
Expand All @@ -1142,19 +1103,6 @@ dependencies {
)
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"org.springframework.ai:spring-ai-starter-model-google-genai-embedding:${springAiVersion}",
"spring-ai-starter-model-google-genai-embedding",
"spring-ai",
"https://github.com/spring-projects/spring-ai",
ExternalDependency.APACHE_2_LICENSE_NAME,
ExternalDependency.APACHE_2_LICENSE_URL,
"Vector store integration"
)
)

jspImplementation files(project.tasks.jar)
jspImplementation apache, jackson, spring
}
Expand Down
8 changes: 1 addition & 7 deletions api/src/org/labkey/api/mcp/AbstractAgentAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.labkey.api.mcp;

import com.google.genai.errors.ClientException;
import com.google.genai.errors.ServerException;
import jakarta.servlet.http.HttpSession;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -167,17 +165,13 @@ else if (isNotBlank(response.text()))
}
return ret;
}
catch (ServerException x)
catch (ChatException x)
{
return new JSONObject(Map.of(
"error", x.getMessage(),
"text", "ERROR: " + x.getMessage(),
"success", Boolean.FALSE));
}
catch (ClientException ex)
{
return errorResponse(ex);
}
}

protected @NotNull JSONObject errorResponse(Exception ex)
Expand Down
26 changes: 26 additions & 0 deletions api/src/org/labkey/api/mcp/ChatException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2026 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
package org.labkey.api.mcp;

// Provider-agnostic wrapper for exceptions thrown by the active _ModelProvider's ChatModel, so callers can handle
// chat failures without depending on any specific vendor SDK (Anthropic/OpenAI/Gemini/Bedrock/Ollama, etc.).
public class ChatException extends RuntimeException
{
public ChatException(String message, Throwable cause)
{
super(message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.labkey.query.controllers;

import com.google.genai.errors.ClientException;
import com.google.genai.errors.ServerException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -26,6 +24,7 @@
import org.junit.Test;
import org.labkey.api.markdown.MarkdownService;
import org.labkey.api.mcp.AbstractAgentAction;
import org.labkey.api.mcp.ChatException;
import org.labkey.api.mcp.McpContext;
import org.labkey.api.mcp.McpService;
import org.labkey.api.query.RuntimeValidationException;
Expand Down Expand Up @@ -96,7 +95,7 @@ public Object execute(ParseForm form, BindException errors) throws Exception
LOG.info("Expression assistant prompt: {}", prompt);
responses = McpService.get().sendMessageEx(chatSession, composedPrompt);
}
catch (ServerException x)
catch (ChatException x)
{
return new JSONObject(Map.of(
"error", x.getMessage(),
Expand All @@ -110,7 +109,7 @@ public Object execute(ParseForm form, BindException errors) throws Exception
"conversationId", getConversationId(),
"segments", segments));
}
catch (ClientException x)
catch (ChatException x)
{
return errorResponse(x);
}
Expand Down
7 changes: 3 additions & 4 deletions query/src/org/labkey/query/controllers/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.genai.errors.ClientException;
import com.google.genai.errors.ServerException;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -153,6 +151,7 @@
import org.labkey.api.files.FileContentService;
import org.labkey.api.gwt.client.AuditBehaviorType;
import org.labkey.api.mcp.AbstractAgentAction;
import org.labkey.api.mcp.ChatException;
import org.labkey.api.mcp.McpContext;
import org.labkey.api.mcp.McpService;
import org.labkey.api.mcp.PromptForm;
Expand Down Expand Up @@ -8684,7 +8683,7 @@ public Object execute(SqlPromptForm form, BindException errors) throws Exception
responses = McpService.get().sendMessageEx(chatSession, prompt);
sqlResponse = extractSql(responses);
}
catch (ServerException x)
catch (ChatException x)
{
return new JSONObject(Map.of(
"error", x.getMessage(),
Expand Down Expand Up @@ -8733,7 +8732,7 @@ public Object execute(SqlPromptForm form, BindException errors) throws Exception
ret.put("html", sqlResponse.html());
return ret;
}
catch (ClientException ex)
catch (ChatException ex)
{
return errorResponse(ex);
}
Expand Down