sie-haystack 0.6.18__tar.gz → 0.6.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -244,6 +244,10 @@ override.tf.json
244
244
  # tfvars files may contain secrets
245
245
  *.tfvars
246
246
  *.tfvars.json
247
+ # Reviewed worker-AMI release contracts contain only immutable public package,
248
+ # AMI, and Terraform backend coordinates; the release workflow accepts only
249
+ # committed files from this exact internal path.
250
+ !deploy/terraform/aws/internal-examples/cloud-benchmark-runner/worker-ami/releases/*.tfvars.json
247
251
  # Exception: this edge tfvars carries only a Secrets Manager ARN (a resource
248
252
  # identifier, not a secret) so the staging-us edge apply needs no manual -var.
249
253
  !deploy/cloud/terraform/aws-edge/staging-us.tfvars
@@ -272,4 +276,7 @@ tmp/
272
276
  .local/
273
277
 
274
278
  .requirements-modal.txt
279
+ b6_results.json
275
280
  packages/sie_cloud/deploy/manifests/archive/
281
+ # Raw dev-cloud load-test reports are local artifacts, not source-controlled baselines.
282
+ packages/sie_cloud/bench/results/dev-us-*/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sie-haystack
3
- Version: 0.6.18
3
+ Version: 0.6.20
4
4
  Summary: SIE integration for Haystack
5
5
  Author-email: Superlinked <dev@superlinked.com>
6
6
  License: Apache-2.0
@@ -75,3 +75,24 @@ ranker = SIERanker(
75
75
  result = ranker.run(query="What is Python?", documents=embedded_docs, top_k=3)
76
76
  ranked_docs = result["documents"]
77
77
  ```
78
+
79
+ Relation models such as GLiREL classify relations between supplied entity
80
+ spans. Extract those spans first, then pass them through the relation
81
+ extractor's `entities` input:
82
+
83
+ ```python
84
+ from haystack_integrations.components.extractors.sie import SIEExtractor
85
+
86
+ text = "Tim Cook is the CEO of Apple Inc."
87
+ entity_extractor = SIEExtractor(
88
+ model="urchade/gliner_multi-v2.1",
89
+ labels=["person", "organization"],
90
+ )
91
+ relation_extractor = SIEExtractor(
92
+ model="jackboyla/glirel-large-v0",
93
+ labels=["ceo_of"],
94
+ )
95
+
96
+ entities = entity_extractor.run(text=text)["entities"]
97
+ result = relation_extractor.run(text=text, entities=entities)
98
+ ```
@@ -53,3 +53,24 @@ ranker = SIERanker(
53
53
  result = ranker.run(query="What is Python?", documents=embedded_docs, top_k=3)
54
54
  ranked_docs = result["documents"]
55
55
  ```
56
+
57
+ Relation models such as GLiREL classify relations between supplied entity
58
+ spans. Extract those spans first, then pass them through the relation
59
+ extractor's `entities` input:
60
+
61
+ ```python
62
+ from haystack_integrations.components.extractors.sie import SIEExtractor
63
+
64
+ text = "Tim Cook is the CEO of Apple Inc."
65
+ entity_extractor = SIEExtractor(
66
+ model="urchade/gliner_multi-v2.1",
67
+ labels=["person", "organization"],
68
+ )
69
+ relation_extractor = SIEExtractor(
70
+ model="jackboyla/glirel-large-v0",
71
+ labels=["ceo_of"],
72
+ )
73
+
74
+ entities = entity_extractor.run(text=text)["entities"]
75
+ result = relation_extractor.run(text=text, entities=entities)
76
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sie-haystack"
3
- version = "0.6.18"
3
+ version = "0.6.20"
4
4
  description = "SIE integration for Haystack"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -10,6 +10,7 @@ from dataclasses import dataclass
10
10
  from typing import Any
11
11
 
12
12
  from haystack import component
13
+ from sie_sdk.types import Item
13
14
 
14
15
 
15
16
  @dataclass
@@ -125,23 +126,40 @@ class SIEExtractor:
125
126
  self,
126
127
  text: str,
127
128
  labels: list[str] | None = None,
129
+ entities: list[Entity | dict[str, Any]] | None = None,
128
130
  ) -> dict[str, list]:
129
131
  """Extract structured information from text.
130
132
 
131
133
  Args:
132
134
  text: The text to extract from.
133
135
  labels: Override the configured labels for this call.
136
+ entities: Entity spans for relation extraction models such as GLiREL.
137
+ Each span uses character offsets with an exclusive ``end``.
134
138
 
135
139
  Returns:
136
140
  Dictionary with entities, relations, classifications, and objects.
137
141
  """
138
- from sie_sdk.types import Item
139
-
140
142
  effective_labels = labels if labels is not None else self._labels
143
+ metadata = None
144
+ if entities is not None:
145
+ metadata = {
146
+ "entities": [
147
+ dict(entity)
148
+ if isinstance(entity, dict)
149
+ else {
150
+ "text": entity.text,
151
+ "label": entity.label,
152
+ "score": entity.score,
153
+ "start": entity.start,
154
+ "end": entity.end,
155
+ }
156
+ for entity in entities
157
+ ]
158
+ }
141
159
 
142
160
  result = self.client.extract(
143
161
  self._model,
144
- Item(text=text),
162
+ Item(text=text, metadata=metadata),
145
163
  labels=effective_labels,
146
164
  )
147
165
 
@@ -61,6 +61,25 @@ class TestSIEExtractor:
61
61
  call_kwargs = mock_sie_client.extract.call_args.kwargs
62
62
  assert call_kwargs.get("labels") == override_labels
63
63
 
64
+ def test_run_passes_entities_for_relation_extraction(self, mock_sie_client: object) -> None:
65
+ """Relation entity spans are forwarded through SIE item metadata."""
66
+ extractor = SIEExtractor(model="jackboyla/glirel-large-v0", labels=["ceo_of"])
67
+ extractor._client = mock_sie_client
68
+ entities = [
69
+ Entity(text="Tim Cook", label="PERSON", score=1.0, start=0, end=8),
70
+ Entity(text="Apple Inc.", label="ORG", score=1.0, start=23, end=33),
71
+ ]
72
+
73
+ extractor.run(text="Tim Cook is the CEO of Apple Inc.", entities=entities)
74
+
75
+ item = mock_sie_client.extract.call_args.args[1]
76
+ assert item["metadata"] == {
77
+ "entities": [
78
+ {"text": "Tim Cook", "label": "PERSON", "score": 1.0, "start": 0, "end": 8},
79
+ {"text": "Apple Inc.", "label": "ORG", "score": 1.0, "start": 23, "end": 33},
80
+ ]
81
+ }
82
+
64
83
  def test_custom_model(self, mock_sie_client: object) -> None:
65
84
  """Test using a custom model name."""
66
85
  extractor = SIEExtractor(model="custom/extraction-model")