MCPcopy
hub / github.com/TheTom/turboquant_plus / parse

Method parse

refract/runner.py:111–133  ·  view source on GitHub ↗
(cls, spec: str)

Source from the content-addressed store, hash-verified

109
110 @classmethod
111 def parse(cls, spec: str) -> "KVConfig":
112 cfg = cls()
113 for part in spec.split(","):
114 part = part.strip()
115 if not part:
116 continue
117 if "=" not in part:
118 raise ValueError(f"bad KV spec fragment '{part}' (need key=value)")
119 k, v = part.split("=", 1)
120 k, v = k.strip(), v.strip()
121 if k == "ctk":
122 cfg.ctk = v
123 elif k == "ctv":
124 cfg.ctv = v
125 elif k == "attn_rot_k":
126 cfg.attn_rot_k = int(v)
127 elif k == "attn_rot_v":
128 cfg.attn_rot_v = int(v)
129 elif k == "attn_rot_disable":
130 cfg.attn_rot_disable = int(v)
131 else:
132 cfg.extras[k] = v
133 return cfg
134
135 def env(self) -> dict:
136 """Return the env-var overlay this config requires."""

Calls

no outgoing calls