acquill 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. acquill-0.1.0/LICENSE +21 -0
  2. acquill-0.1.0/PKG-INFO +97 -0
  3. acquill-0.1.0/Readme.md +76 -0
  4. acquill-0.1.0/acquill/__init__.py +8 -0
  5. acquill-0.1.0/acquill/config/__init__.py +7 -0
  6. acquill-0.1.0/acquill/config/auth.py +91 -0
  7. acquill-0.1.0/acquill/core/__init__.py +23 -0
  8. acquill-0.1.0/acquill/core/dsa_map.py +146 -0
  9. acquill-0.1.0/acquill/core/models.py +90 -0
  10. acquill-0.1.0/acquill/graphs/__init__.py +23 -0
  11. acquill-0.1.0/acquill/graphs/checkpoint.py +275 -0
  12. acquill-0.1.0/acquill/graphs/workflows.py +100 -0
  13. acquill-0.1.0/acquill/interface/__init__.py +3 -0
  14. acquill-0.1.0/acquill/interface/cli.py +390 -0
  15. acquill-0.1.0/acquill/models/__init__.py +16 -0
  16. acquill-0.1.0/acquill/models/schemas.py +27 -0
  17. acquill-0.1.0/acquill/models/states.py +51 -0
  18. acquill-0.1.0/acquill/nodes/__init__.py +57 -0
  19. acquill-0.1.0/acquill/nodes/chat_nodes.py +348 -0
  20. acquill-0.1.0/acquill/nodes/digest_nodes.py +93 -0
  21. acquill-0.1.0/acquill/nodes/pattern_nodes.py +74 -0
  22. acquill-0.1.0/acquill/nodes/reminder_nodes.py +126 -0
  23. acquill-0.1.0/acquill/prompts/__init__.py +23 -0
  24. acquill-0.1.0/acquill/prompts/system_prompts.py +77 -0
  25. acquill-0.1.0/acquill/utils/__init__.py +19 -0
  26. acquill-0.1.0/acquill/utils/api.py +131 -0
  27. acquill-0.1.0/acquill.egg-info/PKG-INFO +97 -0
  28. acquill-0.1.0/acquill.egg-info/SOURCES.txt +32 -0
  29. acquill-0.1.0/acquill.egg-info/dependency_links.txt +1 -0
  30. acquill-0.1.0/acquill.egg-info/entry_points.txt +2 -0
  31. acquill-0.1.0/acquill.egg-info/requires.txt +11 -0
  32. acquill-0.1.0/acquill.egg-info/top_level.txt +1 -0
  33. acquill-0.1.0/pyproject.toml +30 -0
  34. acquill-0.1.0/setup.cfg +4 -0
acquill-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sivam-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
acquill-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: acquill
3
+ Version: 0.1.0
4
+ Summary: AI Learning Companion - Chat and automatic code learning tracker
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: python-dotenv>=1.0.0
10
+ Requires-Dist: pydantic>=2.0.0
11
+ Requires-Dist: supabase>=2.0.0
12
+ Requires-Dist: typer>=0.12.0
13
+ Requires-Dist: rich>=13.7.0
14
+ Requires-Dist: langgraph>=0.2.0
15
+ Requires-Dist: langgraph-checkpoint-postgres>=2.0.0
16
+ Requires-Dist: psycopg[binary]>=3.2.0
17
+ Requires-Dist: langchain-groq>=0.2.0
18
+ Requires-Dist: langchain-community>=0.3.0
19
+ Requires-Dist: langchain-core>=0.3.0
20
+ Dynamic: license-file
21
+
22
+ ═╦══════════════════════════════════════════════════════════════════════════════════════════════════════════
23
+ ║ 🧠 LEARNING COMPANION SYSTEM ║
24
+ ═╩══════════════════════════════════════════════════════════════════════════════════════════════════════════
25
+
26
+ A Memory-Driven, Data-Grounded AI Learning Agent Concept.
27
+
28
+ > **"The data decides; the LLM narrates."**
29
+
30
+ Traditional LLM chat interfaces frequently hallucinate learner progress, struggle counts, and retention decay. This system is designed to compute all pattern detection, topic confidence scoring, and memory decay deterministically in a structured relational database with vector capabilities (`pgvector`). The LLM's role is strictly constrained to extracting structured facts from free-form text and generating empathetic, data-grounded responses.
31
+
32
+
33
+ ┌── PLANNED CORE FEATURES
34
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
35
+
36
+ • **Deterministic Topic & Mastery Tracking**: Automatically track confidence levels for topics explicitly mentioned by the learner, adjusting scores based on problem outcomes (solved vs. struggled).
37
+
38
+ • **RAG Context Recall (Historical Memory)**: Perform vector similarity search over historical learner interactions to ground responses in past experiences using `pgvector`.
39
+
40
+ • **Automatic Struggle Pattern Detection**: Normalize and log fine-grained struggle tags (e.g., `hashmap_lookup`, `recursion_base_case`) and trigger automated alerts when thresholds are reached.
41
+
42
+ • **Proactive Memory Decay (Review Queue)**: Background monitoring worker flags inactive topics as "fading" and pushes them to a review queue before retention degrades.
43
+
44
+ • **LLM-Free Analytics & Insights**: Direct SQL aggregate queries powering real-time dashboards with zero LLM API latency or cost overhead.
45
+
46
+
47
+ ┌── SYSTEM WORKFLOW (THE 7-STAGE PIPELINE)
48
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
49
+
50
+ ```text
51
+ [ Learner Input ]
52
+ │
53
+ ▼
54
+ ┌─────────────────────────┐
55
+ │ 1. EXTRACT (LLM) │ Parse text into structured JSON (mentioned topics & struggle tags)
56
+ └────────────┬────────────┘
57
+ │
58
+ ▼
59
+ ┌─────────────────────────┐
60
+ │ 2. RESOLVE TOPICS │ Match against existing learner topics or register new ones
61
+ └────────────┬────────────┘
62
+ │
63
+ ▼
64
+ ┌─────────────────────────┐
65
+ │ 3. RETRIEVE (RAG) │ Vector similarity search over past messages (pgvector)
66
+ └────────────┬────────────┘
67
+ │
68
+ ▼
69
+ ┌─────────────────────────┐
70
+ │ 4. UPDATE MEMORY (LTM) │ Update topic confidence (+/-), log struggle tag, refresh timestamp
71
+ └────────────┬────────────┘
72
+ │
73
+ ▼
74
+ ┌─────────────────────────┐
75
+ │ 5. DETECT PATTERNS │ Count struggle tag frequency per topic; trigger flag if threshold met
76
+ └────────────┬────────────┘
77
+ │
78
+ ▼
79
+ ┌─────────────────────────┐
80
+ │ 6. RESPOND (LLM) │ Compose reply driven by Stage 5 state (Acknowledge / Pattern / Recommend)
81
+ └────────────┬────────────┘
82
+ │
83
+ ▼
84
+ ┌─────────────────────────┐
85
+ │ 7. PERSIST │ Transactionally save message, vector embedding, reply, and links
86
+ └────────────┬────────────┘
87
+ │
88
+ ▼
89
+ [ Real-Time Reply ]
90
+ ```
91
+
92
+
93
+ ┌── PROJECT STATUS & FUTURE DEVELOPMENT
94
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
95
+
96
+ • **Currently in Active Building Stage**: This project is under active development. Specifications, features, and pipeline components are continuously being updated and expanded during the process.
97
+
@@ -0,0 +1,76 @@
1
+ ═╦══════════════════════════════════════════════════════════════════════════════════════════════════════════
2
+ ║ 🧠 LEARNING COMPANION SYSTEM ║
3
+ ═╩══════════════════════════════════════════════════════════════════════════════════════════════════════════
4
+
5
+ A Memory-Driven, Data-Grounded AI Learning Agent Concept.
6
+
7
+ > **"The data decides; the LLM narrates."**
8
+
9
+ Traditional LLM chat interfaces frequently hallucinate learner progress, struggle counts, and retention decay. This system is designed to compute all pattern detection, topic confidence scoring, and memory decay deterministically in a structured relational database with vector capabilities (`pgvector`). The LLM's role is strictly constrained to extracting structured facts from free-form text and generating empathetic, data-grounded responses.
10
+
11
+
12
+ ┌── PLANNED CORE FEATURES
13
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
14
+
15
+ • **Deterministic Topic & Mastery Tracking**: Automatically track confidence levels for topics explicitly mentioned by the learner, adjusting scores based on problem outcomes (solved vs. struggled).
16
+
17
+ • **RAG Context Recall (Historical Memory)**: Perform vector similarity search over historical learner interactions to ground responses in past experiences using `pgvector`.
18
+
19
+ • **Automatic Struggle Pattern Detection**: Normalize and log fine-grained struggle tags (e.g., `hashmap_lookup`, `recursion_base_case`) and trigger automated alerts when thresholds are reached.
20
+
21
+ • **Proactive Memory Decay (Review Queue)**: Background monitoring worker flags inactive topics as "fading" and pushes them to a review queue before retention degrades.
22
+
23
+ • **LLM-Free Analytics & Insights**: Direct SQL aggregate queries powering real-time dashboards with zero LLM API latency or cost overhead.
24
+
25
+
26
+ ┌── SYSTEM WORKFLOW (THE 7-STAGE PIPELINE)
27
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
28
+
29
+ ```text
30
+ [ Learner Input ]
31
+ │
32
+ ▼
33
+ ┌─────────────────────────┐
34
+ │ 1. EXTRACT (LLM) │ Parse text into structured JSON (mentioned topics & struggle tags)
35
+ └────────────┬────────────┘
36
+ │
37
+ ▼
38
+ ┌─────────────────────────┐
39
+ │ 2. RESOLVE TOPICS │ Match against existing learner topics or register new ones
40
+ └────────────┬────────────┘
41
+ │
42
+ ▼
43
+ ┌─────────────────────────┐
44
+ │ 3. RETRIEVE (RAG) │ Vector similarity search over past messages (pgvector)
45
+ └────────────┬────────────┘
46
+ │
47
+ ▼
48
+ ┌─────────────────────────┐
49
+ │ 4. UPDATE MEMORY (LTM) │ Update topic confidence (+/-), log struggle tag, refresh timestamp
50
+ └────────────┬────────────┘
51
+ │
52
+ ▼
53
+ ┌─────────────────────────┐
54
+ │ 5. DETECT PATTERNS │ Count struggle tag frequency per topic; trigger flag if threshold met
55
+ └────────────┬────────────┘
56
+ │
57
+ ▼
58
+ ┌─────────────────────────┐
59
+ │ 6. RESPOND (LLM) │ Compose reply driven by Stage 5 state (Acknowledge / Pattern / Recommend)
60
+ └────────────┬────────────┘
61
+ │
62
+ ▼
63
+ ┌─────────────────────────┐
64
+ │ 7. PERSIST │ Transactionally save message, vector embedding, reply, and links
65
+ └────────────┬────────────┘
66
+ │
67
+ ▼
68
+ [ Real-Time Reply ]
69
+ ```
70
+
71
+
72
+ ┌── PROJECT STATUS & FUTURE DEVELOPMENT
73
+ └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
74
+
75
+ • **Currently in Active Building Stage**: This project is under active development. Specifications, features, and pipeline components are continuously being updated and expanded during the process.
76
+
@@ -0,0 +1,8 @@
1
+ """
2
+ LearningTrack source modules
3
+ """
4
+
5
+ # Main modules available for import
6
+ from acquill import models, prompts, nodes, core
7
+
8
+ __all__ = ['models', 'prompts', 'nodes', 'core']
@@ -0,0 +1,7 @@
1
+ """
2
+ Configuration package - auth and database setup
3
+ """
4
+
5
+ from .auth import supabase, signup, signin, signout, get_current_user, restore_session
6
+
7
+ __all__ = ['supabase', 'signup', 'signin', 'signout', 'get_current_user', 'restore_session']
@@ -0,0 +1,91 @@
1
+ import os
2
+ import json
3
+ from pathlib import Path
4
+ import typer
5
+ from dotenv import load_dotenv
6
+ from supabase import create_client, Client
7
+
8
+ load_dotenv()
9
+
10
+ SUPABASE_URL = os.getenv("SUPABASE_URL")
11
+ SUPABASE_KEY = os.getenv("SUPABASE_KEY")
12
+
13
+ if not SUPABASE_URL or not SUPABASE_KEY:
14
+ raise ValueError(
15
+ "SUPABASE_URL and SUPABASE_KEY required in .env file.\n"
16
+ "Get them from: https://supabase.com/dashboard/project/_/settings"
17
+ )
18
+
19
+ SESSION_FILE = Path(typer.get_app_dir("acquill")) / "session.json"
20
+
21
+ supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
22
+
23
+
24
+ def save_session(session):
25
+ """Save access + refresh tokens to the OS config folder for persistence"""
26
+ try:
27
+ SESSION_FILE.parent.mkdir(parents=True, exist_ok=True)
28
+ with open(SESSION_FILE, 'w') as f:
29
+ json.dump({
30
+ 'access_token': session.access_token,
31
+ 'refresh_token': session.refresh_token,
32
+ }, f)
33
+ except Exception as e:
34
+ print(f"Warning: Could not save session: {e}")
35
+
36
+
37
+ def restore_session() -> bool:
38
+ """Restore the saved session into the in-memory supabase client.
39
+
40
+ Returns False if no session file exists or restoring fails
41
+ (corrupted file, expired/invalid refresh token) — never raises.
42
+ """
43
+ try:
44
+ if not SESSION_FILE.exists():
45
+ return False
46
+ with open(SESSION_FILE, 'r') as f:
47
+ data = json.load(f)
48
+ result = supabase.auth.set_session(
49
+ data['access_token'], data['refresh_token']
50
+ )
51
+ if result.session:
52
+ # Re-save: set_session may have refreshed the access token
53
+ save_session(result.session)
54
+ return True
55
+ return False
56
+ except Exception:
57
+ return False
58
+
59
+
60
+ def clear_session():
61
+ """Delete saved session file"""
62
+ try:
63
+ if SESSION_FILE.exists():
64
+ SESSION_FILE.unlink()
65
+ except Exception:
66
+ pass
67
+
68
+
69
+ def signup(email: str, password: str):
70
+ result = supabase.auth.sign_up({"email": email, "password": password})
71
+ if result.session:
72
+ save_session(result.session)
73
+ return result
74
+
75
+
76
+ def signin(email: str, password: str):
77
+ result = supabase.auth.sign_in_with_password({"email": email, "password": password})
78
+ if result.session:
79
+ save_session(result.session)
80
+ return result
81
+
82
+
83
+ def signout():
84
+ result = supabase.auth.sign_out()
85
+ clear_session()
86
+ return result
87
+
88
+
89
+ def get_current_user():
90
+ user = supabase.auth.get_user()
91
+ return user
@@ -0,0 +1,23 @@
1
+ """
2
+ Core package - LLM setup and configuration
3
+ """
4
+
5
+ from .models import (
6
+ embeddings,
7
+ extract_llm,
8
+ diff_analysis_llm,
9
+ reply_llm,
10
+ quiz_llm,
11
+ digest_llm,
12
+ pattern_llm
13
+ )
14
+
15
+ __all__ = [
16
+ 'embeddings',
17
+ 'extract_llm',
18
+ 'diff_analysis_llm',
19
+ 'reply_llm',
20
+ 'quiz_llm',
21
+ 'digest_llm',
22
+ 'pattern_llm'
23
+ ]
@@ -0,0 +1,146 @@
1
+ """Placement-focused DSA topic graph: topic -> its direct prerequisites.
2
+
3
+ Order follows college-placement preparation:
4
+ Tier 1 (must know) -> Tier 2 (important) -> Tier 3 (top product companies).
5
+ """
6
+
7
+ import difflib
8
+ import re
9
+
10
+ DSA_PREREQUISITES = {
11
+ # Tier 1 - foundations
12
+ "programming basics": (),
13
+ "time and space complexity": ("programming basics",),
14
+ "recursion": ("programming basics",),
15
+ # Tier 1 - arrays and strings
16
+ "arrays": ("programming basics",),
17
+ "strings": ("arrays",),
18
+ "two pointers": ("arrays",),
19
+ "sliding window": ("two pointers",),
20
+ "prefix sum": ("arrays",),
21
+ "sorting": ("arrays", "time and space complexity", "recursion"),
22
+ "binary search": ("arrays", "sorting"),
23
+ # Tier 1 - hashing
24
+ "hash maps and sets": ("arrays", "time and space complexity"),
25
+ # Tier 1 - linked list, stack, queue
26
+ "linked list": ("arrays", "programming basics"),
27
+ "fast and slow pointers": ("linked list", "two pointers"),
28
+ "stack": ("arrays",),
29
+ "queue": ("arrays",),
30
+ # Tier 1 - trees
31
+ "binary tree": ("recursion", "stack", "linked list"),
32
+ "level-order traversal": ("binary tree", "queue"),
33
+ "binary search tree": ("binary tree", "binary search"),
34
+ # Tier 2
35
+ "backtracking": ("recursion", "arrays"),
36
+ "heap": ("binary tree", "arrays"),
37
+ "top-k problems": ("heap",),
38
+ "greedy basics": ("sorting", "arrays"),
39
+ "graph basics": ("arrays", "linked list", "binary tree"),
40
+ "graph bfs and dfs": ("graph basics", "queue", "recursion"),
41
+ "cycle detection and connected components": ("graph bfs and dfs",),
42
+ "topological sort": ("graph bfs and dfs",),
43
+ "dynamic programming basics": ("recursion", "hash maps and sets"),
44
+ "1d dp": ("dynamic programming basics",),
45
+ "2d dp": ("1d dp",),
46
+ # Tier 3
47
+ "trie": ("binary tree", "strings", "hash maps and sets"),
48
+ "monotonic stack": ("stack", "arrays"),
49
+ "union-find": ("arrays", "binary tree"),
50
+ "dijkstra": ("graph basics", "heap"),
51
+ "longest increasing subsequence": ("1d dp", "binary search"),
52
+ "bit manipulation": ("programming basics",),
53
+ }
54
+
55
+ TOPIC_ALIASES = {
56
+ "big o": "time and space complexity",
57
+ "big-o": "time and space complexity",
58
+ "big o notation": "time and space complexity",
59
+ "complexity": "time and space complexity",
60
+ "time complexity": "time and space complexity",
61
+ "space complexity": "time and space complexity",
62
+ "sorting algorithms": "sorting",
63
+ "hash map": "hash maps and sets",
64
+ "hash maps": "hash maps and sets",
65
+ "hash set": "hash maps and sets",
66
+ "hashmap": "hash maps and sets",
67
+ "hashing": "hash maps and sets",
68
+ "linked lists": "linked list",
69
+ "two-pointer": "two pointers",
70
+ "two pointers technique": "two pointers",
71
+ "sliding window technique": "sliding window",
72
+ "prefix sums": "prefix sum",
73
+ "tree": "binary tree",
74
+ "trees": "binary tree",
75
+ "binary trees": "binary tree",
76
+ "binary tree and traversals": "binary tree",
77
+ "dfs": "binary tree",
78
+ "bfs": "level-order traversal",
79
+ "level order traversal": "level-order traversal",
80
+ "bst": "binary search tree",
81
+ "priority queue": "heap",
82
+ "heap / priority queue": "heap",
83
+ "top k problems": "top-k problems",
84
+ "top-k": "top-k problems",
85
+ "greedy": "greedy basics",
86
+ "greedy algorithms": "greedy basics",
87
+ "graph": "graph basics",
88
+ "graphs": "graph basics",
89
+ "graph representation": "graph basics",
90
+ "bfs and dfs": "graph bfs and dfs",
91
+ "graph traversal": "graph bfs and dfs",
92
+ "cycle detection": "cycle detection and connected components",
93
+ "connected components": "cycle detection and connected components",
94
+ "topo sort": "topological sort",
95
+ "dp": "dynamic programming basics",
96
+ "dynamic programming": "dynamic programming basics",
97
+ "memoization": "dynamic programming basics",
98
+ "1-d dp": "1d dp",
99
+ "2-d dp": "2d dp",
100
+ "union find": "union-find",
101
+ "disjoint set": "union-find",
102
+ "disjoint set union": "union-find",
103
+ "dijkstra's algorithm": "dijkstra",
104
+ "shortest path": "dijkstra",
105
+ "lis": "longest increasing subsequence",
106
+ }
107
+
108
+
109
+ def _normalize(name):
110
+ """Lowercase, collapse whitespace, drop parentheticals."""
111
+ key = " ".join((name or "").lower().split())
112
+ key = re.sub(r"\(.*?\)", " ", key)
113
+ return " ".join(key.split())
114
+
115
+
116
+ def canonical(name):
117
+ """Map free text to a topic in the graph, or None if it is not DSA."""
118
+ key = _normalize(name)
119
+ if not key:
120
+ return None
121
+ key = TOPIC_ALIASES.get(key, key)
122
+ if key in DSA_PREREQUISITES:
123
+ return key
124
+ close = difflib.get_close_matches(key, DSA_PREREQUISITES, n=1, cutoff=0.85)
125
+ return close[0] if close else None
126
+
127
+
128
+ def prerequisites(name, depth=1):
129
+ """Direct prerequisites (depth=1) or the full chain (depth=None)."""
130
+ root = canonical(name)
131
+ if not root:
132
+ return []
133
+
134
+ seen = set()
135
+ frontier = [root]
136
+ for _ in range(depth or len(DSA_PREREQUISITES)):
137
+ nxt = []
138
+ for topic in frontier:
139
+ for dep in DSA_PREREQUISITES.get(topic, ()):
140
+ if dep not in seen and dep != root:
141
+ seen.add(dep)
142
+ nxt.append(dep)
143
+ frontier = nxt
144
+ if not frontier:
145
+ break
146
+ return list(seen)
@@ -0,0 +1,90 @@
1
+ """
2
+ Groq Model Configuration for LLM nodes
3
+ """
4
+
5
+ import os
6
+ from langchain_groq import ChatGroq
7
+ from langchain_community.embeddings import JinaEmbeddings
8
+
9
+ # Load configuration lazily to avoid import-time failures
10
+ _config_loaded = False
11
+ GROQ_API_KEY = None
12
+ JINA_API_KEY = None
13
+ EXTRACT_MODEL = "openai/gpt-oss-20b"
14
+ JINA_MODEL = "jina-embeddings-v2-base-en"
15
+
16
+ def _load_config():
17
+ """Load configuration once, lazily"""
18
+ global _config_loaded, GROQ_API_KEY, JINA_API_KEY, EXTRACT_MODEL, JINA_MODEL
19
+
20
+ if _config_loaded:
21
+ return
22
+
23
+ # Try to load config from settings, fall back to .env
24
+ try:
25
+ from acquill.config.settings import get_config
26
+ config = get_config()
27
+ GROQ_API_KEY = config["providers"]["groq"]["api_key"]
28
+ JINA_API_KEY = config["providers"]["jina"]["api_key"]
29
+ EXTRACT_MODEL = config["providers"]["groq"].get("model", "openai/gpt-oss-20b")
30
+ JINA_MODEL = config["providers"]["jina"].get("model", "jina-embeddings-v2-base-en")
31
+ except Exception:
32
+ # Fall back to .env
33
+ from dotenv import load_dotenv
34
+ load_dotenv()
35
+ GROQ_API_KEY = os.getenv("GROQ_API_KEY")
36
+ JINA_API_KEY = os.getenv("JINA_API_KEY")
37
+ EXTRACT_MODEL = "openai/gpt-oss-20b"
38
+ JINA_MODEL = "jina-embeddings-v2-base-en"
39
+
40
+ _config_loaded = True
41
+
42
+ # Load config immediately so module-level code works
43
+ _load_config()
44
+
45
+ DIFF_ANALYSIS_MODEL = EXTRACT_MODEL
46
+ REPLY_MODEL = EXTRACT_MODEL
47
+ QUIZ_MODEL = EXTRACT_MODEL
48
+ DIGEST_MODEL = EXTRACT_MODEL
49
+ PATTERN_MODEL = EXTRACT_MODEL
50
+
51
+ embeddings = JinaEmbeddings(
52
+ jina_api_key=JINA_API_KEY,
53
+ model_name=JINA_MODEL
54
+ )
55
+
56
+ extract_llm = ChatGroq(
57
+ model=EXTRACT_MODEL,
58
+ temperature=0.7,
59
+ groq_api_key=GROQ_API_KEY
60
+ )
61
+
62
+ diff_analysis_llm = ChatGroq(
63
+ model=DIFF_ANALYSIS_MODEL,
64
+ temperature=0.7,
65
+ groq_api_key=GROQ_API_KEY
66
+ )
67
+
68
+ reply_llm = ChatGroq(
69
+ model=REPLY_MODEL,
70
+ temperature=0.7,
71
+ groq_api_key=GROQ_API_KEY
72
+ )
73
+
74
+ quiz_llm = ChatGroq(
75
+ model=QUIZ_MODEL,
76
+ temperature=0.7,
77
+ groq_api_key=GROQ_API_KEY
78
+ )
79
+
80
+ digest_llm = ChatGroq(
81
+ model=DIGEST_MODEL,
82
+ temperature=0.7,
83
+ groq_api_key=GROQ_API_KEY
84
+ )
85
+
86
+ pattern_llm = ChatGroq(
87
+ model=PATTERN_MODEL,
88
+ temperature=0.7,
89
+ groq_api_key=GROQ_API_KEY
90
+ )
@@ -0,0 +1,23 @@
1
+ """
2
+ LangGraph workflow definitions
3
+ """
4
+
5
+ from .checkpoint import get_checkpointer, get_thread_config, get_thread_id
6
+ from .workflows import (
7
+ build_chat_graph,
8
+ build_diff_graph,
9
+ build_reminder_graph,
10
+ build_digest_graph,
11
+ build_pattern_graph,
12
+ )
13
+
14
+ __all__ = [
15
+ 'get_checkpointer',
16
+ 'get_thread_config',
17
+ 'get_thread_id',
18
+ 'build_chat_graph',
19
+ 'build_diff_graph',
20
+ 'build_reminder_graph',
21
+ 'build_digest_graph',
22
+ 'build_pattern_graph'
23
+ ]