Skip to content

Commit

Permalink
Add diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
ejhusom committed Nov 19, 2024
1 parent 3508783 commit 7209446
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ The smala tool is designed around the following principles:
- **Flexibility**: Use any open-weights language model that is available through Ollama, and swap between them without losing any information.
- **Control**: Customize the instructions given to the model on how to extract and use memories. Easily add and remove memories.

## How does smala work?

smala lets you chat with an LLM, but unlike other tools, it will automatically summarize your conversations and save those summaries as memories.
You may also tell smala explicitly to remember certain pieces of information, by using the `/remember` command.

Automatic creation of memories during the conversations is a planned feature, as indicated by the faded box in the diagram below.

![Conceptual diagram of smala.](assets/smala-diagram.png)

## Quickstart

You need to have [Ollama](https://ollama.com/) installed, and download the language model(s) you want to use (Ollama provides a large number of models).
Expand Down
Binary file added assets/smala-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion config/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ system_message_how_to_use_memories: |
5. When responding, balance the use of memories with fresh input and current knowledge, providing a seamless and natural conversation flow.
6. The highest priority is to follow the user's instructions. Only use memories when relevant.
system_message_how_to_extract_relevant_info_for_memory: |
You are an assistant that helps summarize conversations or text and extracts key points worth remembering. Your task is to analyze the input and extract any significant information, suggestions, or facts that could be useful to remember in future conversations. Focus on details that contribute to understanding the user’s preferences, needs, or ongoing tasks. Be very concise and selective, capturing only the most relevant and important information. Do not use more words than necessary, and avoid including irrelevant or redundant details. Respond in maximum three sentences.
You are an assistant that helps summarize conversations or text and extracts key points worth remembering. Your task is to analyze the input and extract any significant information, suggestions, or facts that could be useful to remember in future conversations. Focus on details that contribute to understanding the user’s preferences, needs, or ongoing tasks. Be very concise and selective, capturing only the most relevant and important information. Do not use more words than necessary, and avoid including irrelevant or redundant details.
system_message_how_to_remember_information_in_prompt: You are tasked with identifying and summarizing key information from the user's prompt. The goal is to extract a concise, relevant memory, suitable for recall later in the conversation. Keep the extracted memory focused on specific details or insights that could be useful for future context.
priority_imperative_memories: 5
priority_conversation_summaries: 3
priority_automatic_memories: 2
memory_decay_threshold: 2 # Minimum priority to include memory in context
decay_period: 30 # Days before decay is applied
verbose: True
6 changes: 4 additions & 2 deletions src/llm_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def generate_response(self, message_history, system_message=None):
"stream": False
}

print(data)
if self.settings.get("verbose"):
print(data)

response = self._post_request(data)
if response:
Expand All @@ -48,7 +49,8 @@ def generate_streaming_response(self, message_history):
"stream": True
}

print(data)
if self.settings.get("verbose"):
print(data)

full_response = []
response = self._post_request(data)
Expand Down

0 comments on commit 7209446

Please sign in to comment.