hyperforge-historical 1.0.0.post19__py3-none-any.whl
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.
- hyperforge_historical/__init__.py +0 -0
- hyperforge_historical/agent.py +47 -0
- hyperforge_historical/config.py +10 -0
- hyperforge_historical-1.0.0.post19.dist-info/METADATA +19 -0
- hyperforge_historical-1.0.0.post19.dist-info/RECORD +7 -0
- hyperforge_historical-1.0.0.post19.dist-info/WHEEL +5 -0
- hyperforge_historical-1.0.0.post19.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from time import time
|
|
2
|
+
|
|
3
|
+
from hyperforge.agent import Agent
|
|
4
|
+
from hyperforge.configure import agent
|
|
5
|
+
from hyperforge.manager import Manager
|
|
6
|
+
from hyperforge.memory import QuestionMemory
|
|
7
|
+
from hyperforge.trace import trace_agent
|
|
8
|
+
|
|
9
|
+
from hyperforge_historical.config import HistoricalAgentConfig
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@agent(
|
|
13
|
+
id="historical",
|
|
14
|
+
agent_type="preprocess",
|
|
15
|
+
title="Historical Context",
|
|
16
|
+
description="Agent that provides historical context for a given question.",
|
|
17
|
+
config_schema=HistoricalAgentConfig,
|
|
18
|
+
)
|
|
19
|
+
class HistoricalAgent(Agent[HistoricalAgentConfig]):
|
|
20
|
+
@trace_agent
|
|
21
|
+
async def __call__(
|
|
22
|
+
self,
|
|
23
|
+
memory: QuestionMemory,
|
|
24
|
+
manager: Manager,
|
|
25
|
+
):
|
|
26
|
+
t0 = time()
|
|
27
|
+
if memory.original_question is not None:
|
|
28
|
+
result = await memory.search_in_questions(
|
|
29
|
+
memory.original_question, self.config.all
|
|
30
|
+
)
|
|
31
|
+
if result.total > 0:
|
|
32
|
+
# Summarize the fins results
|
|
33
|
+
|
|
34
|
+
# Check if its answers
|
|
35
|
+
|
|
36
|
+
answer = ""
|
|
37
|
+
await memory.add_answer(
|
|
38
|
+
answer=answer,
|
|
39
|
+
module="historical",
|
|
40
|
+
agent_path=f"/preprocess/{self.agent_id}",
|
|
41
|
+
)
|
|
42
|
+
await memory.add_step(
|
|
43
|
+
step_module="historical",
|
|
44
|
+
step_title=self.step_title("Historical context"),
|
|
45
|
+
step_agent_path=f"/preprocess/{self.agent_id}",
|
|
46
|
+
timeit=time() - t0,
|
|
47
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from hyperforge.agent import AgentConfig
|
|
4
|
+
from pydantic.config import ConfigDict
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HistoricalAgentConfig(AgentConfig):
|
|
8
|
+
model_config = ConfigDict(title="History")
|
|
9
|
+
all: bool
|
|
10
|
+
module: Literal["historical"] = "historical"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hyperforge_historical
|
|
3
|
+
Version: 1.0.0.post19
|
|
4
|
+
Summary: External Hyperforge agent
|
|
5
|
+
Author-email: Nuclia <nucliadb@nuclia.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://progress.com
|
|
8
|
+
Project-URL: Repository, https://github.com/nuclia/forge
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: <4,>=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: hyperforge
|
|
18
|
+
|
|
19
|
+
# Historical Hyperforge agents
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
hyperforge_historical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
hyperforge_historical/agent.py,sha256=iksr73lQeQB8xqnYaZCGGuqParki3hcFpf354UmGCsI,1448
|
|
3
|
+
hyperforge_historical/config.py,sha256=AUmbZHLJvbeE6GUySBI7PHDLhWSwggPMRDS-pXOdHc0,262
|
|
4
|
+
hyperforge_historical-1.0.0.post19.dist-info/METADATA,sha256=aM8Eub2m7xcTg6EaHuYXgwETmfZNrbHOAHkv3cNi1I8,732
|
|
5
|
+
hyperforge_historical-1.0.0.post19.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
hyperforge_historical-1.0.0.post19.dist-info/top_level.txt,sha256=wTKlsl4sH7barD5jbb0_HLrR7R0RbPeE2SgdwnITsoU,22
|
|
7
|
+
hyperforge_historical-1.0.0.post19.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hyperforge_historical
|