flock-core 0.3.14__py3-none-any.whl → 0.3.15__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.
Potentially problematic release.
This version of flock-core might be problematic. Click here for more details.
- flock/core/flock_factory.py +2 -0
- flock/core/tools/basic_tools.py +24 -0
- flock/evaluators/memory/azure_search_evaluator.py +0 -0
- flock/modules/azure-search/azure_search_module.py +0 -0
- flock/modules/callback/callback_module.py +0 -14
- flock/modules/memory/memory_module.py +13 -31
- {flock_core-0.3.14.dist-info → flock_core-0.3.15.dist-info}/METADATA +1 -1
- {flock_core-0.3.14.dist-info → flock_core-0.3.15.dist-info}/RECORD +11 -9
- {flock_core-0.3.14.dist-info → flock_core-0.3.15.dist-info}/WHEEL +0 -0
- {flock_core-0.3.14.dist-info → flock_core-0.3.15.dist-info}/entry_points.txt +0 -0
- {flock_core-0.3.14.dist-info → flock_core-0.3.15.dist-info}/licenses/LICENSE +0 -0
flock/core/flock_factory.py
CHANGED
|
@@ -34,6 +34,7 @@ class FlockFactory:
|
|
|
34
34
|
temperature: float = 0.0,
|
|
35
35
|
max_tokens: int = 4096,
|
|
36
36
|
alert_latency_threshold_ms: int = 30000,
|
|
37
|
+
no_output: bool = False,
|
|
37
38
|
) -> FlockAgent:
|
|
38
39
|
"""Creates a default FlockAgent.
|
|
39
40
|
|
|
@@ -63,6 +64,7 @@ class FlockFactory:
|
|
|
63
64
|
render_table=enable_rich_tables,
|
|
64
65
|
theme=output_theme,
|
|
65
66
|
wait_for_input=wait_for_input,
|
|
67
|
+
no_output=no_output,
|
|
66
68
|
)
|
|
67
69
|
output_module = OutputModule("output", config=output_config)
|
|
68
70
|
|
flock/core/tools/basic_tools.py
CHANGED
|
@@ -43,6 +43,30 @@ def web_search_duckduckgo(
|
|
|
43
43
|
raise
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
@traced_and_logged
|
|
47
|
+
def web_search_bing(keywords: str):
|
|
48
|
+
try:
|
|
49
|
+
import httpx
|
|
50
|
+
|
|
51
|
+
subscription_key = os.environ["BING_SEARCH_V7_SUBSCRIPTION_KEY"]
|
|
52
|
+
endpoint = "https://api.bing.microsoft.com/v7.0/search"
|
|
53
|
+
|
|
54
|
+
# Query term(s) to search for.
|
|
55
|
+
query = keywords
|
|
56
|
+
|
|
57
|
+
# Construct a request
|
|
58
|
+
mkt = "en-US"
|
|
59
|
+
params = {"q": query, "mkt": mkt}
|
|
60
|
+
headers = {"Ocp-Apim-Subscription-Key": subscription_key}
|
|
61
|
+
|
|
62
|
+
response = httpx.get(endpoint, headers=headers, params=params)
|
|
63
|
+
response.raise_for_status()
|
|
64
|
+
search_results = response.json()
|
|
65
|
+
return search_results["webPages"]
|
|
66
|
+
except Exception:
|
|
67
|
+
raise
|
|
68
|
+
|
|
69
|
+
|
|
46
70
|
def extract_links_from_markdown(markdown: str, url: str) -> list:
|
|
47
71
|
# Regular expression to find all markdown links
|
|
48
72
|
link_pattern = re.compile(r"\[([^\]]+)\]\(([^)]+)\)")
|
|
File without changes
|
|
File without changes
|
|
@@ -70,17 +70,3 @@ class CallbackModule(FlockModule):
|
|
|
70
70
|
"""Run error callback if configured."""
|
|
71
71
|
if self.config.on_error_callback:
|
|
72
72
|
await self.config.on_error_callback(agent, error, inputs)
|
|
73
|
-
|
|
74
|
-
# Other hooks just pass through
|
|
75
|
-
async def post_initialize(self, agent: Any, inputs: dict[str, Any]) -> None:
|
|
76
|
-
pass
|
|
77
|
-
|
|
78
|
-
async def post_evaluate(
|
|
79
|
-
self, agent: Any, inputs: dict[str, Any], result: dict[str, Any]
|
|
80
|
-
) -> dict[str, Any]:
|
|
81
|
-
return result
|
|
82
|
-
|
|
83
|
-
async def post_terminate(
|
|
84
|
-
self, agent: Any, inputs: dict[str, Any], result: dict[str, Any]
|
|
85
|
-
) -> None:
|
|
86
|
-
pass
|
|
@@ -98,38 +98,14 @@ class MemoryModule(FlockModule):
|
|
|
98
98
|
if not self.memory_store:
|
|
99
99
|
return inputs
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
input_text = json.dumps(inputs)
|
|
103
|
-
query_embedding = self.memory_store.compute_embedding(input_text)
|
|
104
|
-
concepts = await self._extract_concepts(
|
|
105
|
-
agent, input_text, self.config.number_of_concepts_to_extract
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
memory_results = []
|
|
109
|
-
for op in self.memory_ops:
|
|
110
|
-
if op["type"] == "semantic":
|
|
111
|
-
semantic_results = self.memory_store.retrieve(
|
|
112
|
-
query_embedding,
|
|
113
|
-
concepts,
|
|
114
|
-
similarity_threshold=self.config.similarity_threshold,
|
|
115
|
-
)
|
|
116
|
-
memory_results.extend(semantic_results)
|
|
117
|
-
elif op["type"] == "exact":
|
|
118
|
-
exact_results = self.memory_store.exact_match(inputs)
|
|
119
|
-
memory_results.extend(exact_results)
|
|
120
|
-
|
|
121
|
-
if memory_results:
|
|
122
|
-
logger.debug(
|
|
123
|
-
f"Found {len(memory_results)} relevant memories",
|
|
124
|
-
agent=agent.name,
|
|
125
|
-
)
|
|
126
|
-
inputs["memory_results"] = memory_results
|
|
101
|
+
inputs = await self.search_memory(agent, inputs)
|
|
127
102
|
|
|
128
|
-
|
|
103
|
+
if "context" in inputs:
|
|
104
|
+
agent.input = (
|
|
105
|
+
agent.input + ", context: list | context with more information"
|
|
106
|
+
)
|
|
129
107
|
|
|
130
|
-
|
|
131
|
-
logger.warning(f"Memory retrieval failed: {e}", agent=agent.name)
|
|
132
|
-
return inputs
|
|
108
|
+
return inputs
|
|
133
109
|
|
|
134
110
|
def get_memory_filename(self, module_name: str) -> str:
|
|
135
111
|
"""Generate the full file path for the memory file."""
|
|
@@ -205,12 +181,18 @@ class MemoryModule(FlockModule):
|
|
|
205
181
|
exact_results = self.memory_store.exact_match(query)
|
|
206
182
|
memory_results.extend(exact_results)
|
|
207
183
|
|
|
184
|
+
context: list[dict[str, Any]] = []
|
|
208
185
|
if memory_results:
|
|
186
|
+
for result in memory_results:
|
|
187
|
+
context.append(
|
|
188
|
+
{"content": result.content, "concepts": result.concepts}
|
|
189
|
+
)
|
|
190
|
+
|
|
209
191
|
logger.debug(
|
|
210
192
|
f"Found {len(memory_results)} relevant memories",
|
|
211
193
|
agent=agent.name,
|
|
212
194
|
)
|
|
213
|
-
query["
|
|
195
|
+
query["context"] = context
|
|
214
196
|
|
|
215
197
|
return query
|
|
216
198
|
|
|
@@ -14,7 +14,7 @@ flock/core/flock.py,sha256=IURlcuNvdsnqKkvgXtX4v_pGWQ8Lfb60X--MT0zvxHo,19881
|
|
|
14
14
|
flock/core/flock_agent.py,sha256=qG6j-aSxSTEcvv5tjMyw3RTCaBooIGF7IVhAUOrhPOo,11946
|
|
15
15
|
flock/core/flock_api.py,sha256=2rHnmEdtT5KPZYwGesRT7LqwbrgKClODHT-O56u7pcQ,7140
|
|
16
16
|
flock/core/flock_evaluator.py,sha256=j7riJj_KsWoBnKmLiGp-U0CRhxDyJbgEdLGN26tfKm8,1588
|
|
17
|
-
flock/core/flock_factory.py,sha256=
|
|
17
|
+
flock/core/flock_factory.py,sha256=lprpvkk4RJkI0_5ouPU04KEEJA-0bjuQJDIP-KQhfis,2672
|
|
18
18
|
flock/core/flock_module.py,sha256=3DmxOc39gQS-tiJcgUCjMaLr8QDDJR4acV_M76Xcf6I,2602
|
|
19
19
|
flock/core/flock_router.py,sha256=A5GaxcGvtiFlRLHBTW7okh5RDm3BdKam2uXvRHRaj7k,2187
|
|
20
20
|
flock/core/context/context.py,sha256=AW0qKIAkgZucVroGsulrPVPc4WmWuqWIrVPHf2qaOLI,6380
|
|
@@ -40,7 +40,7 @@ flock/core/mixin/prompt_parser.py,sha256=eOqI-FK3y17gVqpc_y5GF-WmK1Jv8mFlkZxTcgw
|
|
|
40
40
|
flock/core/registry/agent_registry.py,sha256=TUClh9e3eA6YzZC1CMTlsTPvQeqb9jYHewi-zPpcWM8,4987
|
|
41
41
|
flock/core/serialization/secure_serializer.py,sha256=n5-zRvvXddgJv1FFHsaQ2wuYdL3WUSGPvG_LGaffEJo,6144
|
|
42
42
|
flock/core/serialization/serializable.py,sha256=SymJ0YrjBx48mOBItYSqoRpKuzIc4vKWRS6ScTzre7s,2573
|
|
43
|
-
flock/core/tools/basic_tools.py,sha256=
|
|
43
|
+
flock/core/tools/basic_tools.py,sha256=P1-RWkw57U2vSxPTCd5awlNg4MME4GkBLEB5HiiKmkw,5715
|
|
44
44
|
flock/core/tools/llm_tools.py,sha256=Bdt4Dpur5dGpxd2KFEQyxjfZazvW1HCDKY6ydMj6UgQ,21811
|
|
45
45
|
flock/core/tools/markdown_tools.py,sha256=W6fGM48yGHbifVlaOk1jOtVcybfRbRmf20VbDOZv8S4,6031
|
|
46
46
|
flock/core/tools/dev_tools/github.py,sha256=a2OTPXS7kWOVA4zrZHynQDcsmEi4Pac5MfSjQOLePzA,5308
|
|
@@ -48,11 +48,13 @@ flock/core/util/cli_helper.py,sha256=QSpP10WRNcjXzVFwpTQA8lSBy7707Qlv7uCit1XjUms
|
|
|
48
48
|
flock/core/util/hydrator.py,sha256=6qNwOwCZB7r6y25BZ--0PGofrAlfMaXbDKFQeP5NLts,11196
|
|
49
49
|
flock/core/util/input_resolver.py,sha256=g9vDPdY4OH-G7qjas5ksGEHueokHGFPMoLOvC-ngeLo,5984
|
|
50
50
|
flock/evaluators/declarative/declarative_evaluator.py,sha256=f8ldgZZp94zC4CoGzBufKvbvtckCGBe9EHTOoAZfZK0,1695
|
|
51
|
+
flock/evaluators/memory/azure_search_evaluator.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
52
|
flock/evaluators/memory/memory_evaluator.py,sha256=SmerXyNaqm8DTV0yw-WqWkn9DXIf6x-nPG1eyTV6NY8,3452
|
|
52
53
|
flock/evaluators/natural_language/natural_language_evaluator.py,sha256=6nVEeh8_uwv_h-d3FWlA0GbzDzRtdhvxCGKirHtyvOU,2012
|
|
53
54
|
flock/evaluators/zep/zep_evaluator.py,sha256=9NOELl7JAuUcx_FQrxY6b-_vN3MjwDyW7ZppPIGeCFc,1954
|
|
54
|
-
flock/modules/
|
|
55
|
-
flock/modules/
|
|
55
|
+
flock/modules/azure-search/azure_search_module.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
+
flock/modules/callback/callback_module.py,sha256=SQ9LGNVvcSRrr5BPYwWfTUvHqEdwB5f9voFkQTZwwtU,2503
|
|
57
|
+
flock/modules/memory/memory_module.py,sha256=Ej2tCTrexf_c4MUxUg8DcwevHSIp2xDVF-95DUJAeEU,14417
|
|
56
58
|
flock/modules/memory/memory_parser.py,sha256=FLH7GL8XThvHiCMfX3eQH7Sz-f62fzhAUmO6_gaDI7U,4372
|
|
57
59
|
flock/modules/memory/memory_storage.py,sha256=CNcLDMmvv0x7Z3YMKr6VveS_VCa7rKPw8l2d-XgqokA,27246
|
|
58
60
|
flock/modules/output/output_module.py,sha256=ygk553PxKulmoGlRL0F_iP_FMiDteEtAcz9zUfYYTdI,7153
|
|
@@ -409,8 +411,8 @@ flock/workflow/activities.py,sha256=JDfcmn99k5UTN3QNm5hAdn_eRjWRYhWSIw1U0kMOAh4,
|
|
|
409
411
|
flock/workflow/agent_activities.py,sha256=NhBZscflEf2IMfSRa_pBM_TRP7uVEF_O0ROvWZ33eDc,963
|
|
410
412
|
flock/workflow/temporal_setup.py,sha256=VWBgmBgfTBjwM5ruS_dVpA5AVxx6EZ7oFPGw4j3m0l0,1091
|
|
411
413
|
flock/workflow/workflow.py,sha256=I9MryXW_bqYVTHx-nl2epbTqeRy27CAWHHA7ZZA0nAk,1696
|
|
412
|
-
flock_core-0.3.
|
|
413
|
-
flock_core-0.3.
|
|
414
|
-
flock_core-0.3.
|
|
415
|
-
flock_core-0.3.
|
|
416
|
-
flock_core-0.3.
|
|
414
|
+
flock_core-0.3.15.dist-info/METADATA,sha256=t66Wek4_NowqINrTeZkvZRwiYBdVVpBCyYPE9s62twU,20502
|
|
415
|
+
flock_core-0.3.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
416
|
+
flock_core-0.3.15.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
|
|
417
|
+
flock_core-0.3.15.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
|
|
418
|
+
flock_core-0.3.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|