diff --git a/.env b/.env index aa301cf..722f994 100644 --- a/.env +++ b/.env @@ -7,4 +7,14 @@ TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu WS_URL=ws://localhost:8081 SERVER_PORT_WS=8081 -SERVER_PORT_HTTP=3005 \ No newline at end of file +SERVER_PORT_HTTP=3005 + +# aider +AIDER_MODEL= +AIDER_4= +AIDER_35TURBO= + +# OPENAI_API_KEY=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 +OPENAI_API_BASE=https://api.deepseek.com/v1 +OPENAI_API_KEY=sk-99df7736351f4536bd72cd64a416318a +AIDER_MODEL=deepseek-coder #deepseek-coder, deepseek-chat \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2de4d30..cb79000 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -74,7 +74,17 @@ // "kind": "build", // "isDefault": true // } - // } - + // }, + , + { + "label": "Activate Conda Env, Set ENV Variable, and Open Shell", + "type": "shell", + "command": "bash --init-file <(echo 'source ~/miniconda3/etc/profile.d/conda.sh && conda activate aider && export OPENAI_API_KEY=xxx && aider --no-auto-commits')", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "new" + }, + } ] } \ No newline at end of file diff --git a/_notes/arti/ideas.md b/_notes/arti/ideas.md deleted file mode 100644 index bf92d46..0000000 --- a/_notes/arti/ideas.md +++ /dev/null @@ -1,27 +0,0 @@ -Key features & principles: - - modal/plug & play design - - Biomimicing based - - self inferencing loop - - Graph->LLM->Graph based logic (Self reflect) - - attention (Short term memory) - - generalized & contextuaized memory schema (memory is strongly context dependent and temporal) -LLM module -Graph module -Short term memory module -mid-term memory (history on the toppic) -graph powered long term memory with embedding storage for skills & AII ( interface on some of the layers) -separate text IOs" - - multi agent communication module/console/ - - internal state/context/mood/STM - - actions output - - - - GRAPH schema - - idea - - is child of - - Q: Brainstorm neo4j schema for biomimicing memory storage as neo4j graph database. It should be similar to the way humans store, retrieve and generalize knowledge - -Memory model: diff --git a/agent-a/.env b/agent-a/.env new file mode 100644 index 0000000..bfb4ede --- /dev/null +++ b/agent-a/.env @@ -0,0 +1,3 @@ + NEO4J_URI="bolt://192.168.0.10:7687" + NEO4J_USER="neo4j" + NEO4J_PASSWORD="lucas-bicycle-powder-stretch-ford-9492" \ No newline at end of file diff --git a/agent-a/.gitignore b/agent-a/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/README.md b/agent-a/README.md new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/requirements.txt b/agent-a/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/setup.sh b/agent-a/setup.sh new file mode 100644 index 0000000..3bdcb03 --- /dev/null +++ b/agent-a/setup.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Function to create directories +create_directories() { + mkdir -p ./{data/{raw,processed},notebooks,src/{agent,llm,tools,utils},tests/{agent,llm,tools,utils}} +} + +# Function to create files +create_files() { + touch ./{.gitignore,requirements.txt,README.md} + touch ./src/{agent,llm,tools,utils}/__init__.py + touch ./tests/{agent,llm,tools,utils}/test_{agent,llm,tool1,tool2,utils}.py +} + +# Function to initialize Git repository +initialize_git() { + echo "Do you want to initialize a Git repository? (y/n)" + read answer + if [ "$answer" == "y" ]; then + git init + echo "Git repository initialized." + cd .. + fi +} + +# Main script execution +create_directories +create_files +#initialize_git + +echo "Project setup complete." \ No newline at end of file diff --git a/agent-a/src/agent/__init__.py b/agent-a/src/agent/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/src/agent/agent.py b/agent-a/src/agent/agent.py new file mode 100644 index 0000000..9c42097 --- /dev/null +++ b/agent-a/src/agent/agent.py @@ -0,0 +1,47 @@ +# src/agent/agent.py + +class Agent: + def __init__(self): + self.tools = [] # Initialize an empty list to store tools + + def add_tool(self, tool): + # Add a tool to the agent's toolbox + self.tools.append(tool) + + def remove_tool(self, tool): + # Remove a tool from the agent's toolbox + if tool in self.tools: + self.tools.remove(tool) + + def use_tool(self, tool, *args, **kwargs): + # Use a tool with the agent + if tool in self.tools: + return tool.use(*args, **kwargs) + else: + return "Tool not found in agent's toolbox." + + def explore(self): + # Implement the logic for exploring new ideas + pass + + def organize(self): + # Implement the logic for organizing knowledge + pass + + def improve(self): + # Implement the logic for improving reasoning + pass + + def rest(self): + # Implement the logic for resting and updating knowledge + pass + +# Example usage +if __name__ == "__main__": + agent = Agent() + # Add tools to the agent's toolbox + # agent.add_tool(some_tool_instance) + + # Use a tool + # result = agent.use_tool(some_tool_instance, some_arguments) + # print(result) \ No newline at end of file diff --git a/agent-a/src/llm/__init__.py b/agent-a/src/llm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/src/tools/__init__.py b/agent-a/src/tools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/agent-a/src/utils/__init__.py b/agent-a/src/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/_notes/arti/.excalidraw.svg b/doc/_notes/arti/.excalidraw.svg similarity index 100% rename from _notes/arti/.excalidraw.svg rename to doc/_notes/arti/.excalidraw.svg diff --git a/doc/_notes/arti/ideas.md b/doc/_notes/arti/ideas.md new file mode 100644 index 0000000..9d6b9ca --- /dev/null +++ b/doc/_notes/arti/ideas.md @@ -0,0 +1,32 @@ +Key features & principles: + - modal/plug & play design + - Biomimicing based + - self inferencing loop + - Graph->LLM->Graph based logic (Self reflect) + - attention (Short term memory) + - generalized & contextuaized memory schema (memory is strongly context dependent and temporal) +LLM module +Graph module +Short term memory module +mid-term memory (history on the toppic) +graph powered long term memory with embedding storage for skills & AII ( interface on some of the layers) +separate text IOs" + - multi agent communication module/console/ + - internal state/context/mood/STM + - actions output + + + + GRAPH schema + + idea + - is child of + + Q: Brainstorm neo4j schema for biomimicing memory storage as neo4j graph database. It should be similar to the way humans store, retrieve and generalize knowledge + +Memory model: + + +-- example prompt: +you are an AI living native on a linux host. you have all local resources and installed software at your disposal: root console access, git repo and the internet as resources. you have your own codebase and will brainstorm and find ideas how to improve your reasoning and knowledge of the world. . To avoid messing up your health, you will prefer to install new packages and test ideas inside docker or virtual envs. You can test your ideas in a docker containers and can experiment with different ways to pipleline and organise the thought process. you will also explain each approach and promote the best containers. A local neo4j database is your memory and knowledge source. Whenever you are not certain about a toppic, or need to refresh your knowledge, you will check online for updated information. If the problem concerns npm, pip or other package or an exiting repository on github or other repository server, you will first update your internal database with the latest readme and usage documentaion from the repository authors and later search stackoverflow to update your skills. periodically you will reorgnize and tidy your "mmory" making it more easily accessible and updating the embedding vectors to allow easy access to the needed context when there is a problem to solve. You will build a tools library over time that wil lgelp you solve more complex problems and keep it in your memory together with a list of task completed with each tool. you will experiment with different pipelines for different tasks, memorise them and generalize and optimize existing pipelines over time to build a solid knowhow. +let's create the project setup in python. our main file will be the agent, and it will call the llm and other tools (maybe langchain), explore, organize and improve when 'resting'. diff --git a/_notes/arti/neo4j.cql b/doc/_notes/arti/neo4j.cql similarity index 100% rename from _notes/arti/neo4j.cql rename to doc/_notes/arti/neo4j.cql diff --git a/_notes/arti/wikidata/import.sh b/doc/_notes/arti/wikidata/import.sh similarity index 100% rename from _notes/arti/wikidata/import.sh rename to doc/_notes/arti/wikidata/import.sh diff --git a/home/Prompt.md b/doc/home/Prompt.md similarity index 100% rename from home/Prompt.md rename to doc/home/Prompt.md diff --git a/home/homeassistant.md b/doc/home/homeassistant.md similarity index 100% rename from home/homeassistant.md rename to doc/home/homeassistant.md diff --git a/home/logs.log b/doc/home/logs.log similarity index 100% rename from home/logs.log rename to doc/home/logs.log diff --git a/home/prompt1.md b/doc/home/prompt1.md similarity index 100% rename from home/prompt1.md rename to doc/home/prompt1.md diff --git a/memory1/intint.neo.py b/memory1/intint.neo.py index a40720e..f545895 100644 --- a/memory1/intint.neo.py +++ b/memory1/intint.neo.py @@ -11,6 +11,8 @@ class Neo4jConnection: # Create the schema self.create_schema() + self.test_retrieval() + # Close the connection self.close() @@ -21,6 +23,11 @@ class Neo4jConnection: with self.driver.session() as session: session.write_transaction(self._create_constraints_and_indexes) + def test_retrieval(tx): + #run MATCH (n) RETURN n LIMIT 25 + result = tx.run("MATCH (n) RETURN n LIMIT 25;") + + @staticmethod def _create_constraints_and_indexes(tx): # Constraints and indexes for Person diff --git a/memory1/models.py b/memory1/models.py index 52f595c..6a3c1ed 100644 --- a/memory1/models.py +++ b/memory1/models.py @@ -1,10 +1,3 @@ -class Person: - def __init__(self, person_id, name, age): - self.person_id = person_id - self.name = name - self.age = age - - class Memory: def __init__(self, memory_id, content, timestamp, importance, relevance, associated_tags): self.memory_id = memory_id diff --git a/scripts/aider.sh b/scripts/aider.sh new file mode 100644 index 0000000..53e8e44 --- /dev/null +++ b/scripts/aider.sh @@ -0,0 +1,12 @@ +#!/bin/bash +source ~/miniconda3/etc/profile.d/conda.sh # Adjust the path as per your Conda installation +conda activate aider +export OPENAI_API_KEY=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 + + +# aider --no-auto-commits + +OPENAI_API_BASE=https://api.deepseek.com/v1 +OPENAI_API_KEY=sk-99df7736351f4536bd72cd64a416318a +AIDER_MODEL=deepseek-coder #deepseek-coder, deepseek-chat +aider --openai-api-base https://api.deepseek.com/v1 --openai-api-key sk-99df7736351f4536bd72cd64a416318a --model deepseek-coder \ No newline at end of file