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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-model-chat-memory-cassandra</artifactId>
<artifactId>spring-ai-model-chat-memory-repository-cassandra</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import com.datastax.oss.driver.api.core.CqlSession;

import org.springframework.ai.chat.memory.cassandra.CassandraChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.cassandra.CassandraChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepository;
import org.springframework.ai.model.chat.memory.autoconfigure.ChatMemoryAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.ai.chat.memory.cassandra.CassandraChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepositoryConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.lang.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import org.springframework.ai.chat.memory.cassandra.CassandraChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepository;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.MessageType;
import org.springframework.ai.chat.messages.UserMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.junit.jupiter.api.Test;

import org.springframework.ai.chat.memory.cassandra.CassandraChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepositoryConfig;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-model-chat-memory-jdbc</artifactId>
<artifactId>spring-ai-model-chat-memory-repository-jdbc</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import javax.sql.DataSource;

import org.springframework.ai.chat.memory.jdbc.JdbcChatMemoryDialect;
import org.springframework.ai.chat.memory.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepositoryDialect;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.model.chat.memory.autoconfigure.ChatMemoryAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -45,7 +45,7 @@ public class JdbcChatMemoryRepositoryAutoConfiguration {
@Bean
@ConditionalOnMissingBean
JdbcChatMemoryRepository jdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, DataSource dataSource) {
JdbcChatMemoryDialect dialect = JdbcChatMemoryDialect.from(dataSource);
JdbcChatMemoryRepositoryDialect dialect = JdbcChatMemoryRepositoryDialect.from(dataSource);
return JdbcChatMemoryRepository.builder().jdbcTemplate(jdbcTemplate).dialect(dialect).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class JdbcChatMemoryRepositoryProperties {

public static final String CONFIG_PREFIX = "spring.ai.chat.memory.repository.jdbc";

private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/ai/chat/memory/jdbc/schema-@@platform@@.sql";
private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-@@platform@@.sql";

/**
* Whether to initialize the schema on startup. Values: embedded, always, never.
Expand All @@ -40,7 +40,7 @@ public class JdbcChatMemoryRepositoryProperties {

/**
* Locations of schema (DDL) scripts. Supports comma-separated list. Default is
* classpath:org/springframework/ai/chat/memory/jdbc/schema-@@platform@@.sql
* classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-@@platform@@.sql
*/
private String schema = DEFAULT_SCHEMA_LOCATION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
Expand All @@ -39,7 +40,7 @@
import static org.assertj.core.api.Assertions.fail;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = JdbcChatMemoryHsqldbAutoConfigurationIT.TestConfig.class,
@SpringBootTest(classes = JdbcChatMemoryRepositoryHsqldbAutoConfigurationIT.TestConfig.class,
properties = { "spring.datasource.url=jdbc:hsqldb:mem:chat_memory_auto_configuration_test;DB_CLOSE_DELAY=-1",
"spring.datasource.username=sa", "spring.datasource.password=",
"spring.datasource.driver-class-name=org.hsqldb.jdbcDriver",
Expand All @@ -54,7 +55,7 @@
org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration.class,
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class,
SqlInitializationAutoConfiguration.class })
public class JdbcChatMemoryHsqldbAutoConfigurationIT {
public class JdbcChatMemoryRepositoryHsqldbAutoConfigurationIT {

@Autowired
private ApplicationContext context;
Expand Down Expand Up @@ -130,7 +131,7 @@ public void useAutoConfiguredChatMemoryWithJdbc() {
try {
java.util.Enumeration<java.net.URL> resources = Thread.currentThread()
.getContextClassLoader()
.getResources("org/springframework/ai/chat/memory/jdbc/schema-hsqldb.sql");
.getResources("org/springframework/ai/chat/memory/repository/jdbc/schema-hsqldb.sql");
System.out.println("--- schema-hsqldb.sql resources found on classpath ---");
while (resources.hasMoreElements()) {
System.out.println(resources.nextElement());
Expand All @@ -157,7 +158,7 @@ public void useAutoConfiguredChatMemoryWithJdbc() {

// Now test the ChatMemory functionality
assertThat(context.getBean(org.springframework.ai.chat.memory.ChatMemory.class)).isNotNull();
assertThat(context.getBean(org.springframework.ai.chat.memory.jdbc.JdbcChatMemoryRepository.class)).isNotNull();
assertThat(context.getBean(JdbcChatMemoryRepository.class)).isNotNull();

var chatMemory = context.getBean(org.springframework.ai.chat.memory.ChatMemory.class);
var conversationId = java.util.UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
Expand All @@ -40,7 +40,7 @@
* @author Linar Abzaltdinov
* @author Yanming Zhou
*/
class JdbcChatMemoryPostgresqlAutoConfigurationIT {
class JdbcChatMemoryRepositoryPostgresqlAutoConfigurationIT {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(JdbcChatMemoryRepositoryAutoConfiguration.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void getSettings_shouldHaveSchemaLocations() {
new JdbcChatMemoryRepositoryProperties());

assertThat(settings.getSchemaLocations())
.containsOnly("classpath:org/springframework/ai/chat/memory/jdbc/schema-postgresql.sql");
.containsOnly("classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-postgresql.sql");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.jupiter.api.Test;

import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
Expand All @@ -27,7 +27,7 @@
import static org.assertj.core.api.Assertions.assertThat;

@Testcontainers
class JdbcChatMemorySqlServerAutoConfigurationIT {
class JdbcChatMemoryRepositorySqlServerAutoConfigurationIT {

static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName
.parse("mcr.microsoft.com/mssql/server:2022-latest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-model-chat-memory-neo4j</artifactId>
<artifactId>spring-ai-model-chat-memory-repository-neo4j</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import org.neo4j.driver.Driver;

import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepository;
import org.springframework.ai.model.chat.memory.autoconfigure.ChatMemoryAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.springframework.ai.model.chat.memory.repository.neo4j.autoconfigure;

import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.junit.jupiter.api.Test;

import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepositoryConfig;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import org.junit.jupiter.api.Test;

import org.springframework.ai.chat.memory.ChatMemoryRepository;
import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepository;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepository;
import org.testcontainers.containers.Neo4jContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import org.springframework.ai.chat.memory.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepositoryConfig;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.SystemMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
<relativePath>../../../pom.xml</relativePath>
</parent>

<artifactId>spring-ai-model-chat-memory-cassandra</artifactId>
<name>Spring AI Apache Cassandra Chat Memory</name>
<description>Spring AI Apache Cassandra Chat Memory implementation</description>
<artifactId>spring-ai-model-chat-memory-repository-cassandra</artifactId>
<name>Spring AI Apache Cassandra Chat Memory Repository</name>
<description>Spring AI Apache Cassandra Chat Memory Repository implementation</description>

<url>https://github.com/spring-projects/spring-ai</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.cassandra;
package org.springframework.ai.chat.memory.repository.cassandra;

import java.time.Instant;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.cassandra;
package org.springframework.ai.chat.memory.repository.cassandra;

import java.net.InetSocketAddress;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.cassandra;
package org.springframework.ai.chat.memory.repository.cassandra;

import java.time.Duration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.cassandra;
package org.springframework.ai.chat.memory.repository.cassandra;

import java.time.Duration;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.cassandra;
package org.springframework.ai.chat.memory.repository.cassandra;

import org.testcontainers.utility.DockerImageName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
<relativePath>../../../pom.xml</relativePath>
</parent>

<artifactId>spring-ai-model-chat-memory-jdbc</artifactId>
<artifactId>spring-ai-model-chat-memory-repository-jdbc</artifactId>
<name>Spring AI JDBC Chat Memory</name>
<description>Spring AI JDBC Chat Memory implementation</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.jdbc;
package org.springframework.ai.chat.memory.repository.jdbc;

/**
* HSQLDB-specific SQL dialect for chat memory repository.
*/
public class HsqldbChatMemoryDialect implements JdbcChatMemoryDialect {
public class HsqldbChatMemoryRepositoryDialect implements JdbcChatMemoryRepositoryDialect {

@Override
public String getSelectMessagesSql() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.ai.chat.memory.jdbc;
package org.springframework.ai.chat.memory.repository.jdbc;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
Expand Down Expand Up @@ -51,9 +51,9 @@ public class JdbcChatMemoryRepository implements ChatMemoryRepository {

private final JdbcTemplate jdbcTemplate;

private final JdbcChatMemoryDialect dialect;
private final JdbcChatMemoryRepositoryDialect dialect;

private JdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, JdbcChatMemoryDialect dialect) {
private JdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, JdbcChatMemoryRepositoryDialect dialect) {
Assert.notNull(jdbcTemplate, "jdbcTemplate cannot be null");
Assert.notNull(dialect, "dialect cannot be null");
this.jdbcTemplate = jdbcTemplate;
Expand Down Expand Up @@ -146,7 +146,7 @@ public static class Builder {

private JdbcTemplate jdbcTemplate;

private JdbcChatMemoryDialect dialect;
private JdbcChatMemoryRepositoryDialect dialect;

private Builder() {
}
Expand All @@ -156,7 +156,7 @@ public Builder jdbcTemplate(JdbcTemplate jdbcTemplate) {
return this;
}

public Builder dialect(JdbcChatMemoryDialect dialect) {
public Builder dialect(JdbcChatMemoryRepositoryDialect dialect) {
this.dialect = dialect;
return this;
}
Expand Down
Loading