Skip to content

Add more flexbile support of multiple database vendors for JdbcChatMemory #2807

Open
@xchopin

Description

@xchopin

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions