hyperforge-static-string 1.0.0.post22__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.
@@ -0,0 +1,3 @@
1
+ from .agent import StaticStringAgent
2
+
3
+ AGENTS = {"static_string": StaticStringAgent}
@@ -0,0 +1,78 @@
1
+ from time import time
2
+ from typing import Any, ClassVar, Dict, Optional
3
+
4
+ from hyperforge.agent import Agent
5
+ from hyperforge.configure import agent
6
+ from hyperforge.context.agent import ContextAgent
7
+ from hyperforge.context.config import ContextAgentConfig
8
+ from hyperforge.definition import FunctionDefinition
9
+ from hyperforge.manager import Manager
10
+ from hyperforge.memory import Chunk, Context, QuestionMemory
11
+ from pydantic import Field
12
+
13
+
14
+ class StaticStringAgentConfig(ContextAgentConfig):
15
+ context: str = Field(description="Data to add to the context")
16
+
17
+
18
+ @agent(
19
+ id="static_string",
20
+ agent_type="context",
21
+ title="Static String",
22
+ description="Use a static string to provide context for answering questions.",
23
+ config_schema=StaticStringAgentConfig,
24
+ )
25
+ class StaticStringAgent(ContextAgent, Agent[StaticStringAgentConfig]):
26
+ __published_functions__: ClassVar[Dict[str, FunctionDefinition]] = {
27
+ "static_string": FunctionDefinition(
28
+ name="static_string",
29
+ description="Returns a static string to provide context for answering questions.",
30
+ parameters={},
31
+ )
32
+ }
33
+
34
+ def static_string(self) -> str:
35
+ return self.config.context
36
+
37
+ async def _get_question_context(
38
+ self,
39
+ memory: QuestionMemory,
40
+ manager: Manager,
41
+ question_uuid: str,
42
+ question: str,
43
+ flow_id: str,
44
+ extra_context: Optional[Dict[str, Any]] = None,
45
+ ) -> list[tuple[str, str]]:
46
+ error = None
47
+ t0 = time()
48
+ missing = await self.save_ctx_and_return_missing(
49
+ memory=memory,
50
+ context=Context(
51
+ original_question_uuid=memory.original_question_uuid,
52
+ actual_question_uuid=question_uuid,
53
+ question=question,
54
+ chunks=[
55
+ Chunk(
56
+ chunk_id="static_string",
57
+ text=self.static_string(),
58
+ origin_agent=self.config.module,
59
+ )
60
+ ],
61
+ source=f"/context/{self.agent_id}",
62
+ agent=self.config.module,
63
+ ),
64
+ question=question,
65
+ manager=manager,
66
+ flow_id=flow_id,
67
+ )
68
+ await memory.add_step(
69
+ step_module=self.config.module,
70
+ step_title=self.step_title("Search results"),
71
+ step_agent_path=f"/context/{self.agent_id}",
72
+ step_value="String done",
73
+ timeit=time() - t0,
74
+ input_nuclia_tokens=0.5,
75
+ output_nuclia_tokens=0.5,
76
+ error=error,
77
+ )
78
+ return [missing] if missing is not None else []
File without changes
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyperforge_static_string
3
+ Version: 1.0.0.post22
4
+ Summary: A Hyperforge agent that always returns a fixed string
5
+ License: MIT License
6
+ Project-URL: Homepage, https://progress.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: hyperforge
@@ -0,0 +1,7 @@
1
+ hyperforge_static_string/__init__.py,sha256=S8hdhczHC75Ob_wSUv7UA7rnjwPqwBHpFexCF2TKfpo,84
2
+ hyperforge_static_string/agent.py,sha256=ND4i4uLgoaPCPsWJMRVQOaT3Zp6yZzJNH1Gn4UVOOi8,2669
3
+ hyperforge_static_string/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ hyperforge_static_string-1.0.0.post22.dist-info/METADATA,sha256=fQZRjA43ZvM4A4evleWckWG6Mpm4T-X0iGWb_X-Q1w4,399
5
+ hyperforge_static_string-1.0.0.post22.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ hyperforge_static_string-1.0.0.post22.dist-info/top_level.txt,sha256=JrrzA2f5nLrmWaeJHGf4NFNA-ovOlql1dAjaGSlX1So,25
7
+ hyperforge_static_string-1.0.0.post22.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ hyperforge_static_string