From 4153d69c204df5087da4c79989368c66f6fcd57e Mon Sep 17 00:00:00 2001 From: HamaWhiteGG Date: Sun, 10 Sep 2023 21:20:52 +0800 Subject: [PATCH] optimize code and doc --- README.md | 2 +- .../langchain/memory/chat/memory/BaseChatMemory.java | 2 +- .../main/java/com/hw/langchain/schema/BaseMemory.java | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f1104d4a6..c5bd7979d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The following example can view in the [langchain-example](langchain-examples/src ### 3.1 LLMs - [OpenAI](langchain-examples/src/main/java/com/hw/langchain/examples/llms/OpenAIExample.java) - [Azure OpenAI](openai-client/src/test/java/com/hw/openai/AzureOpenAiClientTest.java) -- [ChatGLM2-6B](langchain-examples/src/main/java/com/hw/langchain/examples/llms/ChatGLMExample.java) +- [ChatGLM2](langchain-examples/src/main/java/com/hw/langchain/examples/llms/ChatGLMExample.java) - [Ollama](langchain-examples/src/main/java/com/hw/langchain/examples/llms/OllamaExample.java) ### 3.2 Vector stores diff --git a/langchain-core/src/main/java/com/hw/langchain/memory/chat/memory/BaseChatMemory.java b/langchain-core/src/main/java/com/hw/langchain/memory/chat/memory/BaseChatMemory.java index fab9781bb..110d7aaf7 100644 --- a/langchain-core/src/main/java/com/hw/langchain/memory/chat/memory/BaseChatMemory.java +++ b/langchain-core/src/main/java/com/hw/langchain/memory/chat/memory/BaseChatMemory.java @@ -32,7 +32,7 @@ /** * @author HamaWhite */ -public abstract class BaseChatMemory extends BaseMemory { +public abstract class BaseChatMemory implements BaseMemory { protected BaseChatMessageHistory chatMemory = new ChatMessageHistory(); diff --git a/langchain-core/src/main/java/com/hw/langchain/schema/BaseMemory.java b/langchain-core/src/main/java/com/hw/langchain/schema/BaseMemory.java index 2e63a7de8..368d75753 100644 --- a/langchain-core/src/main/java/com/hw/langchain/schema/BaseMemory.java +++ b/langchain-core/src/main/java/com/hw/langchain/schema/BaseMemory.java @@ -26,26 +26,26 @@ * * @author HamaWhite */ -public abstract class BaseMemory { +public interface BaseMemory { /** * Input keys this memory class will load dynamically */ - public abstract List memoryVariables(); + List memoryVariables(); /** * Return key-value pairs given the text input to the chain. * If None, return all memories */ - public abstract Map loadMemoryVariables(Map inputs); + Map loadMemoryVariables(Map inputs); /** * Save the context of this model run to memory. */ - public abstract void saveContext(Map inputs, Map outputs); + void saveContext(Map inputs, Map outputs); /** * Clear memory contents. */ - public abstract void clear(); + void clear(); }