You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add tool_calls support to JdbcChatMemoryRepository
- Add tool_calls column to all database schemas (PostgreSQL, MySQL, SQL Server, HSQLDB)
- Implement JSON serialization/deserialization for AssistantMessage.ToolCall objects
- Update all dialect classes to include tool_calls in SELECT and INSERT queries
- Add PostgreSQL JSONB type support with explicit casting (::jsonb)
- Add comprehensive unit tests for tool calls functionality
- Add integration tests for tool calls across all supported databases
- Maintain backward compatibility with existing chat memory data
This enhancement allows the JDBC chat memory repository to persist and retrieve tool call information from AI assistant messages, enabling full conversation context preservation including function calls and their metadata.
Signed-off-by: astor-dev <[email protected]>
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/HsqldbChatMemoryRepositoryDialect.java
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,17 +18,20 @@
18
18
19
19
/**
20
20
* HSQLDB-specific SQL dialect for chat memory repository.
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/JdbcChatMemoryRepository.java
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/JdbcChatMemoryRepositoryDialect.java
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/PostgresChatMemoryRepositoryDialect.java
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/SqlServerChatMemoryRepositoryDialect.java
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/resources/org/springframework/ai/chat/memory/repository/jdbc/schema-hsqldb.sql
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/resources/org/springframework/ai/chat/memory/repository/jdbc/schema-mariadb.sql
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ CREATE TABLE IF NOT EXISTS SPRING_AI_CHAT_MEMORY (
2
2
conversation_id VARCHAR(36) NOT NULL,
3
3
content TEXTNOT NULL,
4
4
type VARCHAR(10) NOT NULL,
5
+
tool_calls LONGTEXT NULL,
5
6
`timestamp`TIMESTAMPNOT NULL,
6
7
CONSTRAINT TYPE_CHECK CHECK (type IN ('USER', 'ASSISTANT', 'SYSTEM', 'TOOL'))
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/resources/org/springframework/ai/chat/memory/repository/jdbc/schema-postgresql.sql
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ CREATE TABLE IF NOT EXISTS SPRING_AI_CHAT_MEMORY (
2
2
conversation_id VARCHAR(36) NOT NULL,
3
3
content TEXTNOT NULL,
4
4
type VARCHAR(10) NOT NULLCHECK (type IN ('USER', 'ASSISTANT', 'SYSTEM', 'TOOL')),
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/resources/org/springframework/ai/chat/memory/repository/jdbc/schema-sqlserver.sql
Copy file name to clipboardExpand all lines: memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/test/java/org/springframework/ai/chat/memory/repository/jdbc/AbstractJdbcChatMemoryRepositoryIT.java
0 commit comments