From a50fa704fbec63b268bd3966883bf56133c26648 Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:31:38 +0100 Subject: [PATCH 01/12] Update README.md --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6b61648..01da4f7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# 🚀 agenticSeek: Local AI Assistant Powered by DeepSeek Agents +# AgenticSeek: Fully local AI Assistant Powered by Reasoning Agents. -**A fully local AI assistant** using Deepseek R1 agents. +**A fully local AI assistant** using AI agents. The goal of the project is to create a truly Jarvis like assistant using deepseek R1. > 🛠️ **Work in Progress** – Looking for contributors! 🚀 --- @@ -57,21 +57,25 @@ Run the assistant: python3 main.py ``` -### 4️⃣ **Alternative: Run the Assistant (Own Server)** +### 4️⃣ **Alternative: Run the LLM on your own server** -Get the ip address of the machine that will run the model +On your "server" that will run the AI model, get the ip address ```sh ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 ``` -On the other machine that will run the model execute the script in stream_llm.py +Clone the repository and then, run the script `stream_llm.py` in `server/` ```sh python3 stream_llm.py ``` +Now on your personal computer: + +Clone the repository. + Change the `config.ini` file to set the `provider_name` to `server` and `provider_model` to `deepseek-r1:7b`. Set the `provider_server_address` to the ip address of the machine that will run the model. @@ -93,17 +97,17 @@ python3 main.py - All running locally - Reasoning with deepseek R1 -- Code execution capabilities (Python, Golang, C) +- Code execution capabilities (Python, Golang, C, etc..) - Shell control capabilities in bash - Will try to fix errors by itself - Routing system, select the best agent for the task - Fast text-to-speech using kokoro. +- Speech to text. - Memory compression (reduce history as interaction progresses using summary model) -- Recovery: recover last session from memory +- Recovery: recover and save session from filesystem. ## UNDER DEVELOPMENT - Web browsing - Knowledge base RAG - Graphical interface -- Speech-to-text using distil-whisper/distil-medium.en From 6bc21b814df9a508a373b9d4458077a6657b5d04 Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:32:35 +0100 Subject: [PATCH 02/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 01da4f7..8503949 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# AgenticSeek: Fully local AI Assistant Powered by Reasoning Agents. +# AgenticSeek: Fully local AI Assistant Powered by Deepseek R1 Agents. -**A fully local AI assistant** using AI agents. The goal of the project is to create a truly Jarvis like assistant using deepseek R1. +**A fully local AI assistant** using AI agents. The goal of the project is to create a truly Jarvis like assistant using reasoning model such as deepseek R1. > 🛠️ **Work in Progress** – Looking for contributors! 🚀 --- From 246f846ec859e48fba9b3aed510760a606f1deea Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:35:07 +0100 Subject: [PATCH 03/12] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8503949..614f94b 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,11 @@ - **Privacy-first**: Runs 100% locally – **no data leaves your machine** - ️ **Voice-enabled**: Speak and interact naturally - **Coding abilities**: Code in Python, Bash, C, Golang, and soon more -- **Self-correcting**: Automatically fixes errors by itself +- **Trial-and-error**: Automatically fixes code or command upon execution failure - **Agent routing**: Select the best agent for the task - **Multi-agent**: For complex tasks, divide and conquer with multiple agents -- **Web browsing (not implemented yet)**: Browse the web and search the internet +- ***Tools:**: All agents have their respective tools ability. Basic search, flight API, files explorer, etc... +- **Web browsing (not implemented yet)**: Browse the web autonomously to conduct task. --- From b11d3d2b43611b2e52d9c0565fa67ee0840a141d Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:48:55 +0100 Subject: [PATCH 04/12] Update README.md --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 614f94b..17dd5c7 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,28 @@ Run the assistant: python3 main.py ``` +## Provider + +Currently the only provider are : +- ollama -> Use ollama running on your computer. Ollama program for running locally large language models. +- server -> A custom script that allow you to have the LLM model run on another machine. Currently it use ollama but we'll switch to other options soon. +- openai -> Use ChatGPT API (not private). +- deepseek -> Deepseek API (not private). + +To select a provider change the config.ini: + +``` +is_local = False +provider_name = openai +provider_model = gpt-4o +provider_server_address = 127.0.0.1:5000 +``` +is_local: should be True for any locally running LLM, otherwise False. +provider_name: Select the provider to use by its name, see the provider list above. +provider_model: Set the model to use by the agent. +provider_server_address: can be set to anything if you are not using the server provider. + + ## Current capabilities - All running locally @@ -106,9 +128,3 @@ python3 main.py - Speech to text. - Memory compression (reduce history as interaction progresses using summary model) - Recovery: recover and save session from filesystem. - -## UNDER DEVELOPMENT - -- Web browsing -- Knowledge base RAG -- Graphical interface From c77917fb8926e7a5a61898cd7fdae2d774b6730e Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:49:16 +0100 Subject: [PATCH 05/12] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 17dd5c7..7aeb736 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,11 @@ provider_model = gpt-4o provider_server_address = 127.0.0.1:5000 ``` is_local: should be True for any locally running LLM, otherwise False. + provider_name: Select the provider to use by its name, see the provider list above. + provider_model: Set the model to use by the agent. + provider_server_address: can be set to anything if you are not using the server provider. From 0f99988eed9aa39631c02ffc28bc2e43b625c84f Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:50:26 +0100 Subject: [PATCH 06/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7aeb736..2f1ab80 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - **Trial-and-error**: Automatically fixes code or command upon execution failure - **Agent routing**: Select the best agent for the task - **Multi-agent**: For complex tasks, divide and conquer with multiple agents -- ***Tools:**: All agents have their respective tools ability. Basic search, flight API, files explorer, etc... +- **Tools:**: All agents have their respective tools ability. Basic search, flight API, files explorer, etc... - **Web browsing (not implemented yet)**: Browse the web autonomously to conduct task. --- From 08ed877cff84609497062278267f89bc2d7c31e5 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Thu, 6 Mar 2025 20:48:23 +0100 Subject: [PATCH 07/12] media image --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e619ef4..fc6f380 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ --- +![demo](./media/demo_img.png) + +--- + + ## Installation ### 1️⃣ **Install Dependencies** From b589c98dd0f18e1114ea50ff83836b73f525fb4f Mon Sep 17 00:00:00 2001 From: Martin <49105846+Fosowl@users.noreply.github.com> Date: Thu, 6 Mar 2025 20:50:43 +0100 Subject: [PATCH 08/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eac5386..e038ea4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ --- -![demo](./media/demo_img.png) + --- From a1de38fe46563cc491cd160d928c31dfe7e556db Mon Sep 17 00:00:00 2001 From: martin legrand Date: Thu, 6 Mar 2025 20:51:19 +0100 Subject: [PATCH 09/12] rm: wrong file --- read | 1 - 1 file changed, 1 deletion(-) delete mode 100644 read diff --git a/read b/read deleted file mode 100644 index 45cc484..0000000 --- a/read +++ /dev/null @@ -1 +0,0 @@ -router.py From d011696ab019dce132abf366864ddbcf1b95c5e5 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Fri, 7 Mar 2025 10:38:10 +0100 Subject: [PATCH 10/12] Rm : macos related file --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a4aac94430e5a97a02b1689190d963066485bb7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z<+|Nhm@N3OxqA7ObrlikA@U3mDOZN=-=6V45vWY7eE5v%Zi|;`2DO zyMY#iM-e*%yWi~m>}Ed5{xHV4w}?&|vl(M1G(?U{ji9;KwWos-xtt>im-#GAMOZV< z-!$R3x7d`$EMf`U{Qi${mL_@8>wWUQMzghV7?#mC9{gvq^oyWavLZ;bcrFu?D29;x+a!y`(i4j;%4M#v9F}ET6T7oo^@qK#Gw6@jU1v4w zgMKy`uGf}%bbNAtHF-&=nRrt~a$sD_fyN5nLD{J2)t_gn$ezGjWmJ)b!~iis3=jjm z$$&l&%=T`UPgN5G#J~>>;Qru1Lv%Hk3gy-T9bTW&-$X;Un!~iky&lup%u|M{pD1EkmD-X|F2ihYv6pSlT0ResM5-M>^7}{0{06=V~k! U;w)&F>40<*kc3c24EzEEUtfz#rvLx| From c0172ba9863ec1d21dc8291b9dd2909af42e569e Mon Sep 17 00:00:00 2001 From: martin legrand Date: Fri, 7 Mar 2025 11:01:14 +0100 Subject: [PATCH 11/12] Feat : llm server config --- server/stream_llm.py | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/server/stream_llm.py b/server/stream_llm.py index 2160cdf..cccbf58 100644 --- a/server/stream_llm.py +++ b/server/stream_llm.py @@ -2,25 +2,43 @@ from flask import Flask, jsonify, request import threading import ollama import logging +import json log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) app = Flask(__name__) -model = 'deepseek-r1:14b' - # Shared state with thread-safe locks + +class Config: + def __init__(self): + self.model = None + self.known_models = [] + self.allowed_models = [] + self.model_name = None + + def load(self): + with open('config.json', 'r') as f: + data = json.load(f) + self.known_models = data['known_models'] + self.model_name = data['model_name'] + + def validate_model(self, model): + if model not in self.known_models: + raise ValueError(f"Model {model} is not known") + class GenerationState: def __init__(self): self.lock = threading.Lock() self.last_complete_sentence = "" self.current_buffer = "" self.is_generating = False + self.model = None state = GenerationState() -def generate_response(history, model): +def generate_response(history): global state try: with state.lock: @@ -29,21 +47,18 @@ def generate_response(history, model): state.current_buffer = "" stream = ollama.chat( - model=model, + model=state.model, messages=history, stream=True, ) - for chunk in stream: content = chunk['message']['content'] print(content, end='', flush=True) - with state.lock: state.current_buffer += content - except ollama.ResponseError as e: if e.status_code == 404: - ollama.pull(model) + ollama.pull(state.model) with state.lock: state.is_generating = False print(f"Error: {e}") @@ -62,7 +77,7 @@ def start_generation(): history = data.get('messages', []) # Start generation in background thread - threading.Thread(target=generate_response, args=(history, model)).start() + threading.Thread(target=generate_response, args=(history, state.model)).start() return jsonify({"message": "Generation started"}), 202 @app.route('/get_updated_sentence') @@ -75,4 +90,8 @@ def get_updated_sentence(): }) if __name__ == '__main__': + config = Config() + config.load() + config.validate_model(config.model_name) + state.model = config.model_name app.run(host='0.0.0.0', port=5000, debug=False, threaded=True) \ No newline at end of file From 77c9d1bc7b77c81cbbf98ae06f98cb200ae27263 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Fri, 7 Mar 2025 11:01:20 +0100 Subject: [PATCH 12/12] Feat : llm server config --- server/config.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 server/config.json diff --git a/server/config.json b/server/config.json new file mode 100644 index 0000000..b976680 --- /dev/null +++ b/server/config.json @@ -0,0 +1,30 @@ +{ + "model_name": "deepseek-r1:14b", + "known_models": [ + "qwq:32b", + "deepseek-r1:1.5b", + "deepseek-r1:7b", + "deepseek-r1:14b", + "deepseek-r1:32b", + "deepseek-r1:70b", + "deepseek-r1:671b", + "deepseek-coder:1.3b", + "deepseek-coder:6.7b", + "deepseek-coder:33b", + "llama2-uncensored:7b", + "llama2-uncensored:70b", + "llama3.1:8b", + "llama3.1:70b", + "llama3.3:70b", + "llama3:8b", + "llama3:70b", + "i4:14b", + "mistral:7b", + "mistral:70b", + "mistral:33b", + "qwen1:7b", + "qwen1:14b", + "qwen1:32b", + "qwen1:70b" + ] +} \ No newline at end of file