Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Commit 549dacc

Browse files
authored
Merge pull request #198 from pixlie/feature/180_named_entity_extraction_with_gliner
Named entity extraction with gliner
2 parents f671b12 + 3bfbf0f commit 549dacc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1744
-1474
lines changed

admin/src/api_types/APIEdges.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22
import type { APINodeEdges } from "./APINodeEdges";
33

4+
/**
5+
* A map of node IDs to their outgoing edges.
6+
*/
47
export type APIEdges = { [key in number]?: APINodeEdges };

admin/src/api_types/APIMatch.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

admin/src/api_types/APINodeEdges.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22

3+
/**
4+
* A list of all outgoing edges of a node, with the ID of the node and the label of the edge.
5+
* The UNIX timestamp represents when a node's edge list was last written to.
6+
*/
37
export type APINodeEdges = {
48
edges: Array<[number, string]>;
59
written_at: bigint;

admin/src/api_types/APINodeItem.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,28 @@ import type { APINodeFlags } from "./APINodeFlags";
33
import type { APIPayload } from "./APIPayload";
44
import type { NodeLabel } from "./NodeLabel";
55

6+
/**
7+
* Schema for a node in any API response.
8+
*/
69
export type APINodeItem = {
10+
/**
11+
* The ID of the node
12+
*/
713
id: number;
14+
/**
15+
* The labels of the node. A node can have multiple labels, like tags, indexed by relevance.
16+
*/
817
labels: Array<NodeLabel>;
18+
/**
19+
* The payload of the node. This can be a link, text, or a tree.
20+
*/
921
payload: APIPayload;
22+
/**
23+
* The flags of the node. This can be used to indicate if the node is processed, requesting, etc.
24+
*/
1025
flags: Array<APINodeFlags>;
26+
/**
27+
* Unix timestamp of when the node was last written to.
28+
*/
1129
written_at: bigint;
1230
};

admin/src/api_types/APIPayload.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2+
import type { Classification } from "./Classification";
3+
import type { ClassifierSettings } from "./ClassifierSettings";
4+
import type { CrawlerSettings } from "./CrawlerSettings";
5+
import type { EntityName } from "./EntityName";
6+
import type { ExtractedEntity } from "./ExtractedEntity";
27
import type { Link } from "./Link";
3-
import { WebMetadata } from "./WebMetadata";
4-
import type { TableRow } from "./TableRow";
58
import type { ProjectSettings } from "./ProjectSettings";
6-
import type { CrawlerSettings } from "./CrawlerSettings";
7-
import type { ClassifierSettings } from "./ClassifierSettings";
9+
import type { TableRow } from "./TableRow";
10+
import type { WebMetadata } from "./WebMetadata";
811

12+
/**
13+
* All nodes contain a data payload.
14+
* APIPayload is the schema for this payload and contains the type of payload and the data.
15+
*/
916
export type APIPayload =
1017
| { type: "Link"; data: Link }
1118
| { type: "WebMetadata"; data: WebMetadata }
@@ -14,4 +21,7 @@ export type APIPayload =
1421
| { type: "TableRow"; data: TableRow }
1522
| { type: "ProjectSettings"; data: ProjectSettings }
1623
| { type: "CrawlerSettings"; data: CrawlerSettings }
17-
| { type: "ClassifierSettings"; data: ClassifierSettings };
24+
| { type: "ClassifierSettings"; data: ClassifierSettings }
25+
| { type: "Classification"; data: Classification }
26+
| { type: "NamedEntitiesToExtract"; data: Array<EntityName> }
27+
| { type: "ExtractedNamedEntities"; data: Array<ExtractedEntity> };
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2+
3+
export type Classification = {
4+
is_relevant: boolean;
5+
reason: string;
6+
insight_if_classified_as_relevant: string | null;
7+
};
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22

33
export type ClassifierSettings = {
4-
query_to_classify_content_as_relevant_or_irrelevant_to_objective:
5-
| string
6-
| null;
4+
prompt_to_classify_content_as_relevant_to_objective_or_not: string | null;
75
};

admin/src/api_types/EdgeLabel.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ export type EdgeLabel =
1111
| "Suggests"
1212
| "SuggestedFor"
1313
| "Classifies"
14-
| "ClassifiedFor"
15-
| "Matches"
16-
| "MatchedFor";
14+
| "ClassifiedFor";
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22
import type { APIEdges } from "./APIEdges";
3-
import { APIMatch } from "./APIMatch";
43
import type { APINodeItem } from "./APINodeItem";
54
import type { Explore } from "./Explore";
65

6+
/**
7+
* Engine's response for an API request.
8+
*
9+
* API requests for a project are sent to its engine.
10+
* The engine responds with an `EngineResponsePayload`, which is directly passed on as
11+
* the API response.
12+
*/
713
export type EngineResponsePayload =
814
| { type: "NodeCreatedSuccessfully"; data: number }
915
| { type: "EdgeCreatedSuccessfully" }
1016
| { type: "Nodes"; data: Array<APINodeItem> }
11-
| { type: "Labels"; data: Array<string> }
1217
| { type: "Edges"; data: APIEdges }
18+
| { type: "Labels"; data: Array<string> }
1319
| { type: "Explore"; data: Explore }
14-
| { type: "Matches"; data: Array<APIMatch> }
1520
| { type: "Error"; data: string };
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22

3-
export type DateTimeWrapper = string;
3+
export type EntityName = "Person" | "Organization" | "Date" | "Place";

0 commit comments

Comments
 (0)