mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-02 03:42:36 +02:00
Fix kg-core downloading (#371)
This commit is contained in:
parent
4461d7b289
commit
fdd9a9a9ae
2 changed files with 16 additions and 14 deletions
|
|
@ -68,7 +68,7 @@ async def fetch(url, user, id, output):
|
||||||
"id": mid,
|
"id": mid,
|
||||||
"service": "knowledge",
|
"service": "knowledge",
|
||||||
"request": {
|
"request": {
|
||||||
"operation": "fetch-kg-core",
|
"operation": "get-kg-core",
|
||||||
"user": user,
|
"user": user,
|
||||||
"id": id,
|
"id": id,
|
||||||
}
|
}
|
||||||
|
|
@ -87,22 +87,24 @@ async def fetch(url, user, id, output):
|
||||||
|
|
||||||
obj = json.loads(msg)
|
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"])
|
raise RuntimeError(obj["error"])
|
||||||
|
|
||||||
if "response" not in obj:
|
if "eos" in response:
|
||||||
continue
|
if response["eos"]: break
|
||||||
|
|
||||||
if "eos" in obj["response"]:
|
if "triples" in response:
|
||||||
if obj["response"]["eos"]: break
|
|
||||||
|
|
||||||
if "triples" in obj["response"]:
|
|
||||||
t += 1
|
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
|
ge += 1
|
||||||
write_ge(f, obj["response"]["graph-embeddings"])
|
write_ge(f, response["graph-embeddings"])
|
||||||
|
|
||||||
print(f"Got: {t} triple, {ge} GE messages.")
|
print(f"Got: {t} triple, {ge} GE messages.")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ def set_system(url, system):
|
||||||
|
|
||||||
def set_prompt(url, id, prompt, response, schema):
|
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")
|
ConfigKey(type="prompt", key="template-index")
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ def set_prompt(url, id, prompt, response, schema):
|
||||||
if id not in ix:
|
if id not in ix:
|
||||||
ix.append(id)
|
ix.append(id)
|
||||||
|
|
||||||
values = api.config_put([
|
values = api.put([
|
||||||
ConfigValue(
|
ConfigValue(
|
||||||
type="prompt", key="template-index", value=json.dumps(ix)
|
type="prompt", key="template-index", value=json.dumps(ix)
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue