nora-lib 0.0.5.dev1__tar.gz → 0.0.5.dev2__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.
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/PKG-INFO +1 -1
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/interactions/interactions_service.py +12 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/interactions/models.py +10 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib.egg-info/PKG-INFO +1 -1
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/setup.py +1 -1
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/README.md +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/__init__.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/context/__init__.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/context/context_service.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/context/models.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/interactions/__init__.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/py.typed +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/tasks/__init__.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/tasks/models.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib/tasks/state.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib.egg-info/SOURCES.txt +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib.egg-info/dependency_links.txt +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib.egg-info/requires.txt +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/nora_lib.egg-info/top_level.txt +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/pyproject.toml +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/setup.cfg +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/tests/tasks/__init__.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/tests/tasks/test_state.py +0 -0
- {nora_lib-0.0.5.dev1 → nora_lib-0.0.5.dev2}/tests/test_placeholder.py +0 -0
|
@@ -4,6 +4,7 @@ import requests
|
|
|
4
4
|
from typing import List, Optional
|
|
5
5
|
|
|
6
6
|
from nora_lib.interactions.models import (
|
|
7
|
+
AnnotationBatch,
|
|
7
8
|
Event,
|
|
8
9
|
EventType,
|
|
9
10
|
Message,
|
|
@@ -45,6 +46,17 @@ class InteractionsService:
|
|
|
45
46
|
)
|
|
46
47
|
response.raise_for_status()
|
|
47
48
|
|
|
49
|
+
def save_annotation(self, annotation: AnnotationBatch) -> None:
|
|
50
|
+
"""Save an annotation to the Interactions API"""
|
|
51
|
+
annotation_url = f"{self.base_url}/interaction/v1/annotation"
|
|
52
|
+
response = requests.post(
|
|
53
|
+
annotation_url,
|
|
54
|
+
json=annotation.model_dump(),
|
|
55
|
+
headers=self.headers,
|
|
56
|
+
timeout=int(self.timeout),
|
|
57
|
+
)
|
|
58
|
+
response.raise_for_status()
|
|
59
|
+
|
|
48
60
|
def get_message(self, message_id: str) -> ReturnedMessage:
|
|
49
61
|
"""Fetch a message from the Interactions API"""
|
|
50
62
|
message_url = f"{self.base_url}/interaction/v1/search/message"
|
|
@@ -25,6 +25,16 @@ class Annotation(BaseModel):
|
|
|
25
25
|
attributes: Optional[Dict[str, str]] = None
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
class AnnotationBatch(BaseModel):
|
|
29
|
+
actor_id: UUID
|
|
30
|
+
message_id: str
|
|
31
|
+
annotations: List[Annotation]
|
|
32
|
+
|
|
33
|
+
@field_serializer("actor_id")
|
|
34
|
+
def serialize_actor_id(self, actor_id: UUID):
|
|
35
|
+
return str(actor_id)
|
|
36
|
+
|
|
37
|
+
|
|
28
38
|
class Message(BaseModel):
|
|
29
39
|
message_id: str
|
|
30
40
|
actor_id: UUID
|
|
@@ -7,7 +7,7 @@ dev_requirements = ["mypy", "pytest", "black", "types-requests"]
|
|
|
7
7
|
|
|
8
8
|
setuptools.setup(
|
|
9
9
|
name="nora_lib",
|
|
10
|
-
version="0.0.5.
|
|
10
|
+
version="0.0.5.dev2",
|
|
11
11
|
description="For making and coordinating agents and tools",
|
|
12
12
|
url="https://github.com/allenai/nora_lib",
|
|
13
13
|
packages=setuptools.find_packages(exclude=(["tests"])),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|