spring-projects / spring-projects/spring-ai
Add more flexbile support of multiple database vendors for JdbcChatMemory
Open
Nobody has claimed this yet.
status: waiting-for-triage
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Bug description
Cannot use JdbcChatMemory with a MSSQL Server
Incorrect syntax near 'LIMIT'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:270) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1735) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:675) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:594) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7745) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4391) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:276) ~[mssql-jdbc-12.8.1.jre11.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:246) ~[mssql-jdbc-12.8.1.jre11.jar:na]
Environment
1.0.0-M7
Steps to reproduce
Add a JdbcChatMemory as an advisor to a ChatClient with a MSSQL Server
Expected behavior
Return the elements
Minimal Complete Reproducible example
// Create a chatclient for example:
@Bean
public ChatClient chatClient(ChatClient.Builder builder) {
return builder.defaultSystem(SYSTEM)
.defaultAdvisors(new MessageChatMemoryAdvisor(new JdbcChatMemory(JdbcChatMemoryConfig.builder().jdbcTemplate(jdbcTemplate).build())))
.build();
}
// then use the chatclient
chatClient.prompt(prompt).call().content();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with JdbcChatMemory and JdbcChatMemoryConfig, then trace the SQL issued when a ChatClient uses MessageChatMemoryAdvisor. Reproduce the failing query against MSSQL and verify that JdbcChatMemory returns the expected elements without MSSQL rejecting LIMIT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100