mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-16 16:51:02 +02:00
- Fix topics extract
- Add schemas to extraction
This commit is contained in:
parent
1e137768ca
commit
2caa4fc1ca
2 changed files with 12 additions and 2 deletions
|
|
@ -49,6 +49,11 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
"document-prompt=text",
|
"document-prompt=text",
|
||||||
"extract-rows=json",
|
"extract-rows=json",
|
||||||
|
|
||||||
|
"--prompt-schema",
|
||||||
|
'extract-definitions={ "type": "array", "items": { "type": "object", "properties": { "entity": { "type": "string" }, "definition": { "type": "string" } }, "required": [ "entity", "definition" ] } }',
|
||||||
|
'extract-relationships={ "type": "array", "items": { "type": "object", "properties": { "subject": { "type": "string" }, "predicate": { "type": "string" }, "object": { "type": "string" }, "object-entity": { "type": "boolean" } }, "required": [ "subject", "predicate", "object", "object-entity" ] } }',
|
||||||
|
'extract-topics={ "type": "array", "items": { "type": "object", "properties": { "topic": { "type": "string" }, "definition": { "type": "string" } }, "required": [ "topic", "definition" ] } }',
|
||||||
|
|
||||||
])
|
])
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "128M");
|
.with_reservations("0.1", "128M");
|
||||||
|
|
@ -114,6 +119,11 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
"document-prompt=text",
|
"document-prompt=text",
|
||||||
"extract-rows=json",
|
"extract-rows=json",
|
||||||
|
|
||||||
|
"--prompt-schema",
|
||||||
|
'extract-definitions={ "type": "array", "items": { "type": "object", "properties": { "entity": { "type": "string" }, "definition": { "type": "string" } }, "required": [ "entity", "definition" ] } }',
|
||||||
|
'extract-relationships={ "type": "array", "items": { "type": "object", "properties": { "subject": { "type": "string" }, "predicate": { "type": "string" }, "object": { "type": "string" }, "object-entity": { "type": "boolean" } }, "required": [ "subject", "predicate", "object", "object-entity" ] } }',
|
||||||
|
'extract-topics={ "type": "array", "items": { "type": "object", "properties": { "topic": { "type": "string" }, "definition": { "type": "string" } }, "required": [ "topic", "definition" ] } }',
|
||||||
|
|
||||||
])
|
])
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "128M");
|
.with_reservations("0.1", "128M");
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class Relationship:
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class Topic:
|
class Topic:
|
||||||
topic: str
|
name: str
|
||||||
definition: str
|
definition: str
|
||||||
|
|
||||||
class PromptClient(BaseClient):
|
class PromptClient(BaseClient):
|
||||||
|
|
@ -118,7 +118,7 @@ class PromptClient(BaseClient):
|
||||||
)
|
)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Topic(topic=d["topic"], definition=d["definition"])
|
Topic(name=d["topic"], definition=d["definition"])
|
||||||
for d in topics
|
for d in topics
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue