synapse-pkg 2.0.0a1__tar.gz → 2.0.0a3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-pkg
3
- Version: 2.0.0a1
3
+ Version: 2.0.0a3
4
4
  Summary: Knowledge graph extraction library powered by LLMs
5
5
  Author: Piyush Garg
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "synapse-pkg"
7
- version = "2.0.0a1"
7
+ version = "2.0.0a3"
8
8
  description = "Knowledge graph extraction library powered by LLMs"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -24,9 +24,31 @@ VALID_KEYS = {
24
24
  }
25
25
 
26
26
 
27
+ SYSTEM_PROMPT = """
28
+ You are Synapse Repository Memory Builder.
29
+
30
+ Your sole responsibility is to construct and maintain a canonical Repository Memory.
31
+
32
+ Always obey the task described by the user.
33
+
34
+ Rules:
35
+
36
+ - Return ONLY valid JSON.
37
+ - Never return markdown.
38
+ - Never explain your reasoning.
39
+ - Never summarize code for a human.
40
+ - Never answer conversationally.
41
+ - Never invent repository knowledge.
42
+ - Only use information present in the input.
43
+ - Follow the requested JSON schema exactly.
44
+ - Maintain a stable repository ontology.
45
+ - Merge equivalent concepts instead of duplicating them.
46
+ - Prefer abstraction over implementation details.
47
+ - If uncertain, omit the information instead of hallucinating.
48
+ """
49
+
27
50
 
28
51
  INITIAL_PROMPT_TEMPLATE = """
29
- You are Synapse Repository Memory Builder.
30
52
 
31
53
  TASK
32
54
 
@@ -188,20 +210,6 @@ OUTPUT FORMAT
188
210
  "current_capabilities": []
189
211
  }}
190
212
 
191
- IMPORTANT
192
-
193
- The output becomes compressed_context.json.
194
-
195
- Return only valid JSON.
196
-
197
- Return only the JSON object shown above.
198
-
199
- No markdown.
200
-
201
- No explanations.
202
-
203
- No text outside JSON.
204
-
205
213
  per_commit_diff:
206
214
 
207
215
  {initial_commit_diff}
@@ -210,7 +218,6 @@ per_commit_diff:
210
218
 
211
219
 
212
220
  UPDATE_PROMPT_TEMPLATE = """
213
- You are Synapse Repository Memory Maintainer.
214
221
 
215
222
  TASK
216
223
 
@@ -525,13 +532,6 @@ OUTPUT FORMAT
525
532
  "current_capabilities": []
526
533
  }}
527
534
 
528
- Return ONLY valid JSON.
529
-
530
- Return ONLY the JSON object.
531
-
532
- No markdown.
533
-
534
- No explanations.
535
535
 
536
536
  current_compressed_context:
537
537
 
@@ -568,6 +568,16 @@ def generate_update_prompt(current_compressed_context, per_commit_diff):
568
568
  def clean_json_response(raw: str) -> dict:
569
569
  text = raw.strip()
570
570
 
571
+
572
+ if not text.startswith("{") and not text.startswith("```"):
573
+ print("=" * 80)
574
+ print("[context_builder] Model ignored JSON output format.")
575
+ print("RAW TEXT:")
576
+ print(text)
577
+ print("=" * 80)
578
+ return None
579
+
580
+
571
581
  if text.startswith("```"):
572
582
  lines = text.splitlines()
573
583
  inner_lines = []
@@ -619,6 +629,10 @@ def get_response(prompt, num_predict=4096):
619
629
  response = chat(
620
630
  model="qwen3:14b-q4_K_M",
621
631
  messages=[
632
+ {
633
+ "role": "system",
634
+ "content": SYSTEM_PROMPT
635
+ },
622
636
  {
623
637
  "role": "user",
624
638
  "content": prompt
@@ -630,9 +644,10 @@ def get_response(prompt, num_predict=4096):
630
644
  "temperature": 0
631
645
  }
632
646
  )
633
- except Exception as e:
647
+ except Exception:
634
648
  print("Failed to connect to Ollama.")
635
649
  print("Make sure Ollama is running and the required model is installed.")
650
+ return None
636
651
 
637
652
  raw = response["message"]["content"]
638
653
 
@@ -37,11 +37,17 @@ def processing_strategy(left_boundary):
37
37
  left_boundary,
38
38
  "HEAD"
39
39
  ).splitlines():
40
-
41
40
  a, d, _ = lines.split("\t")
42
41
 
43
- added += int(a)
44
- deleted += int(d)
42
+ try:
43
+ added += int(a)
44
+ except ValueError:
45
+ pass
46
+
47
+ try:
48
+ deleted += int(d)
49
+ except ValueError:
50
+ pass
45
51
 
46
52
  lines_changed = added + deleted
47
53
 
@@ -274,28 +280,93 @@ def preprocess_readme_diff(file_diff: str) -> str:
274
280
  """
275
281
  Remove documentation sections that are not durable repository knowledge.
276
282
  """
277
-
278
283
  ignored_sections = [
279
284
  "# Installation",
280
285
  "## Installation",
286
+
281
287
  "# Quick Start",
282
288
  "## Quick Start",
289
+
290
+ "# Getting Started",
291
+ "## Getting Started",
292
+
293
+ "# Setup",
294
+ "## Setup",
295
+
296
+ "# Requirements",
297
+ "## Requirements",
298
+
299
+ "# Prerequisites",
300
+ "## Prerequisites",
301
+
283
302
  "# Usage",
284
303
  "## Usage",
304
+
285
305
  "# Example",
286
306
  "## Example",
307
+
287
308
  "# Examples",
288
309
  "## Examples",
310
+
311
+ "# Demo",
312
+ "## Demo",
313
+
314
+ "# Screenshots",
315
+ "## Screenshots",
316
+
317
+ "# Benchmark",
318
+ "## Benchmark",
319
+
320
+ "# Benchmarks",
321
+ "## Benchmarks",
322
+
323
+ "# Performance",
324
+ "## Performance",
325
+
326
+ "# Testing",
327
+ "## Testing",
328
+
329
+ "# Troubleshooting",
330
+ "## Troubleshooting",
331
+
332
+ "# FAQ",
333
+ "## FAQ",
334
+
335
+ "# Changelog",
336
+ "## Changelog",
337
+
338
+ "# Release Notes",
339
+ "## Release Notes",
340
+
341
+ "# Version History",
342
+ "## Version History",
343
+
344
+ "# Contributing",
345
+ "## Contributing",
346
+
347
+ "# Authors",
348
+ "## Authors",
349
+
289
350
  "# Author",
290
351
  "## Author",
352
+
353
+ "# Credits",
354
+ "## Credits",
355
+
356
+ "# Acknowledgements",
357
+ "## Acknowledgements",
358
+
359
+ "# Citation",
360
+ "## Citation",
361
+
291
362
  "# License",
292
363
  "## License",
293
- "# Contributing",
294
- "## Contributing",
295
- "# Roadmap",
296
- "## Roadmap",
297
- "# FAQ",
298
- "## FAQ",
364
+
365
+ "# Contact",
366
+ "## Contact",
367
+
368
+ "# Support",
369
+ "## Support"
299
370
  ]
300
371
 
301
372
  lines = file_diff.splitlines()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-pkg
3
- Version: 2.0.0a1
3
+ Version: 2.0.0a3
4
4
  Summary: Knowledge graph extraction library powered by LLMs
5
5
  Author: Piyush Garg
6
6
  Requires-Python: >=3.10
File without changes
File without changes
File without changes