diff --git a/trustgraph-cli/scripts/tg-get-kg-core b/trustgraph-cli/scripts/tg-get-kg-core index 41ba8533..6eb52bde 100755 --- a/trustgraph-cli/scripts/tg-get-kg-core +++ b/trustgraph-cli/scripts/tg-get-kg-core @@ -68,7 +68,7 @@ async def fetch(url, user, id, output): "id": mid, "service": "knowledge", "request": { - "operation": "fetch-kg-core", + "operation": "get-kg-core", "user": user, "id": id, } @@ -87,22 +87,24 @@ async def fetch(url, user, id, output): obj = json.loads(msg) - if "error" in obj: + if "response" not in obj: + raise RuntimeError("No response?") + + response = obj["response"] + + if "error" in response: raise RuntimeError(obj["error"]) - if "response" not in obj: - continue + if "eos" in response: + if response["eos"]: break - if "eos" in obj["response"]: - if obj["response"]["eos"]: break - - if "triples" in obj["response"]: + if "triples" in response: t += 1 - write_triple(f, obj["response"]["triples"]) + write_triple(f, response["triples"]) - if "graph-embeddings" in obj["response"]: + if "graph-embeddings" in response: ge += 1 - write_ge(f, obj["response"]["graph-embeddings"]) + write_ge(f, response["graph-embeddings"]) print(f"Got: {t} triple, {ge} GE messages.") diff --git a/trustgraph-cli/scripts/tg-set-prompt b/trustgraph-cli/scripts/tg-set-prompt index 67f8e6d2..c19326e5 100755 --- a/trustgraph-cli/scripts/tg-set-prompt +++ b/trustgraph-cli/scripts/tg-set-prompt @@ -25,9 +25,9 @@ def set_system(url, system): def set_prompt(url, id, prompt, response, schema): - api = Api(url) + api = Api(url).config() - values = api.config_get([ + values = api.get([ ConfigKey(type="prompt", key="template-index") ]) @@ -49,7 +49,7 @@ def set_prompt(url, id, prompt, response, schema): if id not in ix: ix.append(id) - values = api.config_put([ + values = api.put([ ConfigValue( type="prompt", key="template-index", value=json.dumps(ix) ),