You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGE_LOG.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The current version implements the following specialized tool (see figure) for N
8
8

9
9
### 2. Implements the specialized concept mapping tool, `Concept Mapping tool`, avoiding the need for manually maintaining the ontology database.
10
10
- The concept mapping tool implements features such as throttling (see default values below), i.e., minimum seconds between BioPortal requests (throttle; lower = faster, higher 429 risk). This done to take into account the rate limit of the bioportal.
11
-
11
+
12
12
| Variable | Where used | Default | Description |
13
13
|----------|------------|---------|-------------|
14
14
|`BIOPORTAL_API_KEY`|`conceptmappingtool.py`| — |**Required** for ConceptMappingTool. Used in Authorization header. |
@@ -17,7 +17,7 @@ The current version implements the following specialized tool (see figure) for N
17
17
|`MAX_CONCEPT_MAPPING_RESULTS`|`conceptmappingtool.py`|`1`| Top-N results per concept (1–50). |
18
18
|`CONCEPT_MAPPING_CACHE_SIZE`|`conceptmappingtool.py`|`2000`| Max in-memory cache entries for concept mapping. |
19
19
|`CONCEPT_MAPPING_MAX_TERMS`|`postprocessing.py`| — | Optional cap on how many unique terms are mapped in batch (rest get null). |
20
-
20
+
21
21
- To avoid the continuous API call, it implements the inmemory caching (to be replaced with new caching mechanism), i.e., `_CONCEPT_MAPPING_CACHE` (dict). The cache size is default `2000` set with `CONCEPT_MAPPING_CACHE_SIZE`. The FIFO-style cache eviction is applied, i.e., when the cache is full, one oldest entry is removed before inserting a new one. The lookup is done using `_map_single_concept()` before making an API call.
22
22
### 3. Implements automatic task detection
23
23
This version of **`StructSense`** introduces automatic task detection to support accurate task-to-tool mapping, enabling agents to invoke the most relevant tools for a given task.
@@ -30,7 +30,7 @@ The implementation combines an **LLM-based classifier** with a **heuristic fallb
30
30
|`"structured extraction"` or `"structured_extraction"`|`structured_extraction`|
31
31
| Otherwise |`extraction`|
32
32
33
-
Task detection is executed **once per stage** at the point where tools and post-processing are selected (e.g., `information_extraction_task`).
33
+
Task detection is executed **once per stage** at the point where tools and post-processing are selected (e.g., `information_extraction_task`).
34
34
In the full pipeline, the **first stage’s task type** determines the post-processing key and the default result shape. While each stage may theoretically define its own task type, the initial stage serves as the canonical reference for downstream processing.
Runs one agent–task pair (with optional chunking). Used by the pipeline for each stage and by CLI `run-agent`. Passes `pick_richest_alignment` for resource alignment so multiple alignment blobs are returned for merge.
Returns `"ner"`, `"resource"`, `"structured_extraction"`, or `"extraction"` from task config (LLM or heuristic). Drives post-processor, merger, and whether alignment blobs are extracted for merge.
One (or two on retry) crew kickoff; parse string output via `_parse_raw_string` → `_parse_crew_output_alignment_blobs` (if alignment resource) or `_parse_crew_output_string`.
Brace-matching extraction of every `{...}` in a string; used to get multiple alignment blocks from one LLM response.
27
27
28
28
The other functions include tool registration and invocation and merging results.
29
29
30
-
## Module Overview
30
+
## Module Overview
31
31
32
32
-**`src/structsense/app.py`**: Main entry point for **StructSense**, responsible for initializing the pipeline and orchestrating agent execution.
33
33
-**`src/structsense/cli.py`**: Defines and handles command-line interface (CLI) options for running **StructSense**.
@@ -52,7 +52,7 @@ The other functions include tool registration and invocation and merging results
52
52
Tools are attached **per stage (agent) and per task type**. The flow is:
53
53
-**Task type** is detected from the extractor task description (`task_detection.py`).
54
54
-**Tool names** for that (agent_key, task_type) come from `task_tools.py` (generic + task-specific).
55
-
-**Tool names** are resolved to **CrewAI tool instances** in `_resolve_tool()` in `task_tools.py`.
55
+
-**Tool names** are resolved to **CrewAI tool instances** in `_resolve_tool()` in `task_tools.py`.
56
56
- The agent is built with those tools; CrewAI runs the agent and the LLM can **call** the tools during execution.
57
57
58
58
### Steps to Add a New Tool
@@ -67,7 +67,7 @@ Tools are attached **per stage (agent) and per task type**. The flow is:
67
67
- To add a new tool, update `_resolve_tool(name, ...)` in `src/utils/task_tools.py` to map the tool name to its corresponding function or instantiated class.
68
68
69
69
**Example (function tool):**
70
-
70
+
71
71
```python
72
72
# In task_tools.py _resolve_tool()
73
73
if name =="your_new_tool":
@@ -112,13 +112,13 @@ The pipeline detects **task type** from the extractor task description (LLM or h
112
112
113
113
Tools are resolved **per stage (agent) and task type** so different agents and tasks can use different tools.
114
114
115
-
-**Stage (agent)**
115
+
-**Stage (agent)**
116
116
Only the **extractor** stage receives tools by default; **alignment**, **judge**, and**human_feedback** use no tools (LLM-only).
117
117
118
-
-**Generic tools**
118
+
-**Generic tools**
119
119
An agent can have **generic** tools that apply to **all** task types (e.g. a shared search or lookup). Configured in`GENERIC_TOOLS_BY_STAGE`in`src/utils/task_tools.py`.
120
120
121
-
-**Task-specific tools**
121
+
-**Task-specific tools**
122
122
Task types (e.g. `ner`, `keyphrase_extraction`) get additional tools (e.g. `extract_ner_terms`). Configured in`TOOLS_BY_TASK_TYPE` (in`task_detection`) for the extractor andin`TOOLS_BY_STAGE_AND_TASK`for other agents.
|`True`| No LLM call — all entities receive `judge_score=1.0`, `remarks="auto-approved"`|
561
-
561
+
562
562
#### Run the custom judge agent or through CrewAI (`direct_judge_api`)
563
563
564
564
When `direct_judge_api=True` (default), the judge LLM is still used, but it does **not** run through the CrewAI agent loop. Instead, StructSense uses a custom implementation that calls the LLM directly through `AsyncOpenAI` in parallel batches with retry support.
@@ -620,7 +620,7 @@ You can preload multiple stages. `--source` / `--source_text` is still required
0 commit comments