synapse-pkg 2.0.0a3__tar.gz → 2.0.0a5__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.0a3
3
+ Version: 2.0.0a5
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.0a3"
7
+ version = "2.0.0a5"
8
8
  description = "Knowledge graph extraction library powered by LLMs"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,5 +1,4 @@
1
1
  import sys
2
-
3
2
  from . import commands
4
3
 
5
4
 
@@ -11,6 +10,7 @@ def main():
11
10
  print("Available commands:")
12
11
  print(" init")
13
12
  print(" knowledge")
13
+ print(" setup")
14
14
  return
15
15
 
16
16
  command = sys.argv[1].lower()
@@ -20,6 +20,9 @@ def main():
20
20
 
21
21
  elif command == "knowledge":
22
22
  commands.knowledge()
23
+
24
+ elif command == "setup":
25
+ commands.setup()
23
26
 
24
27
  else:
25
28
  print(f"Unknown command: {command}")
@@ -0,0 +1,39 @@
1
+ from .persistence import initialize_synapse, save_config
2
+ from .processor import build_repository_context
3
+ from .extractor import build_compressed_context
4
+ from .provider import get_ollama_model
5
+
6
+
7
+ def setup():
8
+ models = get_ollama_model()
9
+
10
+ for i,model in enumerate(models,start=1):
11
+ print(f"{i}, {model}")
12
+ choice = int(input("select a model"))
13
+ selected_model = models[choice-1]
14
+ save_config(
15
+ {
16
+ "provider":"ollama",
17
+ "model": selected_model
18
+ }
19
+ )
20
+ print("configuration saved")
21
+
22
+
23
+ def init():
24
+ initialize_synapse()
25
+
26
+
27
+ def knowledge():
28
+ print("Initializing repository context...")
29
+
30
+ build_repository_context()
31
+
32
+ print(
33
+ "Repository context initialized.\n"
34
+ "Building compressed repository context..."
35
+ )
36
+
37
+ build_compressed_context()
38
+
39
+ print("Successfully initialized compressed repository context.")
@@ -1,5 +1,5 @@
1
1
  import git
2
- from .persistence import load_compressed_context, save_compressed_context, load_metadata, save_metadata
2
+ from .persistence import load_compressed_context, save_compressed_context, load_metadata, save_metadata, load_config
3
3
  from .git_manager import (
4
4
  get_repository_changes,
5
5
  split_commit_by_file
@@ -9,6 +9,8 @@ import json
9
9
 
10
10
  repo = git.Repo(search_parent_directories=True)
11
11
 
12
+ config = load_config()
13
+
12
14
 
13
15
  MAX_PROMPT_SIZE = 30000
14
16
  MAX_FILES_PER_COMMIT = 3
@@ -625,9 +627,16 @@ def clean_json_response(raw: str) -> dict:
625
627
 
626
628
  def get_response(prompt, num_predict=4096):
627
629
 
630
+ if config["model"]:
631
+ model = config["model"]
632
+ else:
633
+ print("no model configured.")
634
+ print("Run 'synapse setup' first.")
635
+ return
636
+
628
637
  try:
629
638
  response = chat(
630
- model="qwen3:14b-q4_K_M",
639
+ model=model,
631
640
  messages=[
632
641
  {
633
642
  "role": "system",
@@ -0,0 +1,8 @@
1
+ import ollama
2
+ def get_ollama_model():
3
+ response = ollama.list()
4
+ model_names=[]
5
+ for model in response.models:
6
+ model_names.append(model.model)
7
+ return model_names
8
+ print(get_ollama_model())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-pkg
3
- Version: 2.0.0a3
3
+ Version: 2.0.0a5
4
4
  Summary: Knowledge graph extraction library powered by LLMs
5
5
  Author: Piyush Garg
6
6
  Requires-Python: >=3.10
@@ -8,6 +8,7 @@ synapse/extractor.py
8
8
  synapse/git_manager.py
9
9
  synapse/persistence.py
10
10
  synapse/processor.py
11
+ synapse/provider.py
11
12
  synapse_pkg.egg-info/PKG-INFO
12
13
  synapse_pkg.egg-info/SOURCES.txt
13
14
  synapse_pkg.egg-info/dependency_links.txt
@@ -1,22 +0,0 @@
1
- from .persistence import initialize_synapse
2
- from .processor import build_repository_context
3
- from .extractor import build_compressed_context
4
-
5
-
6
- def init():
7
- initialize_synapse()
8
-
9
-
10
- def knowledge():
11
- print("Initializing repository context...")
12
-
13
- build_repository_context()
14
-
15
- print(
16
- "Repository context initialized.\n"
17
- "Building compressed repository context..."
18
- )
19
-
20
- build_compressed_context()
21
-
22
- print("Successfully initialized compressed repository context.")
File without changes
File without changes
File without changes