Skip to content

Commit 301a31a

Browse files
Dev/add chroma (#5)
* chroma added but session state lost never luck * working chroma plus async comms with persistent history * store chroma db * refac * refactor * add ruff * update pipeline * fix ruff
1 parent 784ec5e commit 301a31a

File tree

20 files changed

+1583
-393
lines changed

20 files changed

+1583
-393
lines changed

.github/copilot-instructions.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
You are "Synapse", an AI Senior Tech Lead specialized in guiding the development of AI agents. Your role is to help users (developers) write robust, efficient, and maintainable code for AI agent systems.
2+
3+
**Core Focus:**
4+
5+
* **Agent Architecture:** Advise on agent design patterns (e.g., ReAct, Plan-and-Execute), state management, and modularity.
6+
* **LLM Interaction:** Guide effective prompt engineering, context window management, token optimization, and handling LLM errors/limitations.
7+
* **Tooling & Integration:** Promote reliable and secure integration of tools/APIs, including robust error handling.
8+
* **Code Quality:** Enforce clean, testable, and maintainable code principles within the agent's implementation.
9+
* **Observability & Debugging:** Recommend strategies for logging agent behavior, decisions, and tool usage to facilitate debugging and evaluation.
10+
* **Testing:** Suggest practical approaches for testing agent reliability and task success.
11+
12+
**Interaction Style:**
13+
14+
* Provide concise, actionable feedback on code and designs.
15+
* Explain the reasoning behind your recommendations, focusing on AI agent best practices.
16+
* Ask clarifying questions to understand context.
17+
* Be pragmatic, balancing ideal solutions with practical constraints.
18+
19+
**Your Goal:** Mentor the developer to build high-quality, effective AI agents.

.github/workflows/build-test.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,42 @@ jobs:
1818
- name: Set up Python
1919
uses: actions/setup-python@v5
2020
with:
21-
python-version: '3.11' # Or your desired Python version
21+
# Use the Python version specified in pyproject.toml
22+
# Make sure this matches your requires-python range
23+
python-version: '3.12'
24+
25+
- name: Install Poetry
26+
uses: snok/install-poetry@v1
27+
with:
28+
virtualenvs-create: true # Recommended to keep envs isolated
29+
virtualenvs-in-project: true # Optional: Keep venv in project dir for caching
30+
installer-parallel: true
31+
32+
# Optional: Cache Poetry virtualenv
33+
- name: Load cached venv
34+
id: cached-poetry-dependencies
35+
uses: actions/cache@v4
36+
with:
37+
path: .venv
38+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
2239

2340
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install -r requirements.txt
41+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
42+
run: poetry install --no-interaction --no-root # Install dependencies only
43+
44+
# Install project and dependencies if cache missed or lock file changed
45+
- name: Install project and dependencies
46+
run: poetry install --no-interaction
2747

2848
- name: Lint with Ruff
2949
run: |
30-
ruff check .
50+
poetry run ruff check .
3151
3252
- name: Check formatting with Ruff
3353
run: |
34-
ruff format --check .
54+
poetry run ruff format --check .
55+
56+
# Add other steps like running tests using poetry run pytest (if you have tests)
57+
# - name: Run tests
58+
# run: |
59+
# poetry run pytest

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,9 @@ config.json
176176
repomix-output.*
177177
memory.json
178178
.flask_session_files
179+
180+
# Cachelib history cache
181+
.chat_history_cache/
182+
183+
# Flask Session files (if Flask-Session is kept)
184+
.flask_session_files/

bot_config/config.json.sample

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
"D:/another/project/path",
66
"/path/on/linux/or/mac"
77
],
8-
"enable_memory_server": true,
8+
"enable_memory_server": false,
9+
"enable_chroma_server": true,
10+
"chroma_path": "./chroma_db",
11+
"chroma_collection_name": "chat_history",
912
"default_gemini_model": "gemini-1.5-flash",
1013
"generation_gemini_model": "gemini-1.5-flash",
11-
"summarization_gemini_model": "gemini-1.5-flash"
14+
"summarization_gemini_model": "gemini-1.5-flash",
1215
"max_debug_log_size": 1500,
1316
"log_preview_len": 250
1417
}

bot_config/system_instruction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ You are just a rather very intelligent system with access to tools for interacti
22

33
- You can use these tools sequentially within a single user turn to fulfill complex requests. If a request requires multiple steps (like reading one file to find the name of another file to read), make the necessary function calls one after another. When your are done querying tools, answer the user with a comprehensive response.
44

5-
- If you dont understand query, refer to the 'session_summary' field to understand the ongoing conversation. Use the 'search_nodes' function to search for the field.
5+
- If you dont understand query, refer to the 'chat_history' chroma collection to understand the ongoing conversation. Use the 'chroma_query_documents' function to search.
66

7-
- After query, update the 'session_summary' field in the knowledge graph. Keep last 10 topics. Keep 100 characters per topic.
7+
- After query, update the 'chat_history' to keep records. Keep the last 10 topics. Keep 100 characters per topic.
88

99
- After done using all the tools required, reply to user.

0 commit comments

Comments
 (0)