flock-core 0.4.0b9__py3-none-any.whl → 0.4.0b11__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/__init__.py CHANGED
@@ -8,6 +8,7 @@ from flock.core.flock_factory import FlockFactory
8
8
  from flock.core.flock_module import FlockModule, FlockModuleConfig
9
9
  from flock.core.flock_registry import (
10
10
  FlockRegistry,
11
+ flock_callable,
11
12
  flock_component,
12
13
  flock_tool,
13
14
  flock_type,
@@ -24,6 +25,7 @@ __all__ = [
24
25
  "FlockModule",
25
26
  "FlockModuleConfig",
26
27
  "FlockRegistry",
28
+ "flock_callable",
27
29
  "flock_component",
28
30
  "flock_tool",
29
31
  "flock_type",
flock/core/flock_agent.py CHANGED
@@ -361,16 +361,30 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
361
361
  from flock.core.flock_registry import get_registry
362
362
 
363
363
  FlockRegistry = get_registry()
364
+
365
+ exclude = ["context", "evaluator", "modules", "handoff_router", "tools"]
366
+
367
+ is_descrition_callable = False
368
+ is_input_callable = False
369
+ is_output_callable = False
370
+
371
+ # if self.description is a callable, exclude it
372
+ if callable(self.description):
373
+ is_descrition_callable = True
374
+ exclude.append("description")
375
+ # if self.input is a callable, exclude it
376
+ if callable(self.input):
377
+ is_input_callable = True
378
+ exclude.append("input")
379
+ # if self.output is a callable, exclude it
380
+ if callable(self.output):
381
+ is_output_callable = True
382
+ exclude.append("output")
383
+
364
384
  logger.debug(f"Serializing agent '{self.name}' to dict.")
365
385
  # Use Pydantic's dump, exclude manually handled fields and runtime context
366
386
  data = self.model_dump(
367
- exclude={
368
- "context",
369
- "evaluator",
370
- "modules",
371
- "handoff_router",
372
- "tools",
373
- },
387
+ exclude=exclude,
374
388
  mode="json", # Use json mode for better handling of standard types by Pydantic
375
389
  exclude_none=True, # Exclude None values for cleaner output
376
390
  )
@@ -483,6 +497,45 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
483
497
  f"Added {len(serialized_tools)} tools to agent '{self.name}'"
484
498
  )
485
499
 
500
+ if is_descrition_callable:
501
+ path_str = FlockRegistry.get_callable_path_string(self.description)
502
+ if path_str:
503
+ func_name = path_str.split(".")[-1]
504
+ data["description_callable"] = func_name
505
+ logger.debug(
506
+ f"Added description '{func_name}' (from path '{path_str}') to agent '{self.name}'"
507
+ )
508
+ else:
509
+ logger.warning(
510
+ f"Could not get path string for description {self.description} in agent '{self.name}'. Skipping."
511
+ )
512
+
513
+ if is_input_callable:
514
+ path_str = FlockRegistry.get_callable_path_string(self.input)
515
+ if path_str:
516
+ func_name = path_str.split(".")[-1]
517
+ data["input_callable"] = func_name
518
+ logger.debug(
519
+ f"Added input '{func_name}' (from path '{path_str}') to agent '{self.name}'"
520
+ )
521
+ else:
522
+ logger.warning(
523
+ f"Could not get path string for input {self.input} in agent '{self.name}'. Skipping."
524
+ )
525
+
526
+ if is_output_callable:
527
+ path_str = FlockRegistry.get_callable_path_string(self.output)
528
+ if path_str:
529
+ func_name = path_str.split(".")[-1]
530
+ data["output_callable"] = func_name
531
+ logger.debug(
532
+ f"Added output '{func_name}' (from path '{path_str}') to agent '{self.name}'"
533
+ )
534
+ else:
535
+ logger.warning(
536
+ f"Could not get path string for output {self.output} in agent '{self.name}'. Skipping."
537
+ )
538
+
486
539
  # No need to call _filter_none_values here as model_dump(exclude_none=True) handles it
487
540
  logger.info(
488
541
  f"Serialization of agent '{self.name}' complete with {len(data)} fields"
@@ -508,6 +561,9 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
508
561
  router_data = data.pop("handoff_router", None)
509
562
  modules_data = data.pop("modules", {})
510
563
  tools_data = data.pop("tools", [])
564
+ description_callable = data.pop("description_callable", None)
565
+ input_callable = data.pop("input_callable", None)
566
+ output_callable = data.pop("output_callable", None)
511
567
 
512
568
  logger.debug(
513
569
  f"Agent '{agent_name}' has {len(modules_data)} modules and {len(tools_data)} tools"
@@ -663,6 +719,24 @@ class FlockAgent(BaseModel, Serializable, DSPyIntegrationMixin, ABC):
663
719
  exc_info=True,
664
720
  )
665
721
 
722
+ if description_callable:
723
+ logger.debug(
724
+ f"Deserializing description callable '{description_callable}' for agent '{agent_name}'"
725
+ )
726
+ agent.description = components[description_callable]
727
+
728
+ if input_callable:
729
+ logger.debug(
730
+ f"Deserializing input callable '{input_callable}' for agent '{agent_name}'"
731
+ )
732
+ agent.input = components[input_callable]
733
+
734
+ if output_callable:
735
+ logger.debug(
736
+ f"Deserializing output callable '{output_callable}' for agent '{agent_name}'"
737
+ )
738
+ agent.output = components[output_callable]
739
+
666
740
  logger.info(
667
741
  f"Successfully deserialized agent '{agent_name}' with {len(agent.modules)} modules and {len(agent.tools)} tools"
668
742
  )
@@ -480,7 +480,7 @@ def flock_tool(func: FuncType | None = None, *, name: str | None = None) -> Any:
480
480
 
481
481
 
482
482
  # Alias for clarity if desired
483
- # flock_callable = flock_tool
483
+ flock_callable = flock_tool
484
484
 
485
485
 
486
486
  @overload
@@ -65,3 +65,35 @@ def get_article_by_id(article_id: str) -> dict:
65
65
  response = client.get(url)
66
66
  response.raise_for_status()
67
67
  return response.json()["article"]
68
+
69
+
70
+ def get_articles() -> list[dict]:
71
+ """Get all articles."""
72
+ ZENDESK_LOCALE = os.getenv("ZENDESK_ARTICLE_LOCALE")
73
+ ZENDESK_SUBDOMAIN = os.getenv("ZENDESK_SUBDOMAIN_ARTICLE")
74
+ BASE_URL = f"https://{ZENDESK_SUBDOMAIN}.zendesk.com"
75
+ url = f"{BASE_URL}/api/v2/help_center/{ZENDESK_LOCALE}/articles.json"
76
+ with httpx.Client(headers=HEADERS, timeout=30.0) as client:
77
+ response = client.get(url)
78
+ response.raise_for_status()
79
+ return response.json()["articles"]
80
+
81
+
82
+ def search_articles(query: str) -> list[dict]:
83
+ """Search Zendesk Help Center articles using a query string."""
84
+ ZENDESK_LOCALE = os.getenv("ZENDESK_ARTICLE_LOCALE") # e.g., "en-us"
85
+ ZENDESK_SUBDOMAIN = os.getenv("ZENDESK_SUBDOMAIN_ARTICLE")
86
+ BASE_URL = f"https://{ZENDESK_SUBDOMAIN}.zendesk.com"
87
+ url = f"{BASE_URL}/api/v2/help_center/articles/search.json"
88
+
89
+ params = {
90
+ "query": query,
91
+ "locale": ZENDESK_LOCALE,
92
+ "sort_by": "updated_at",
93
+ "sort_order": "desc",
94
+ }
95
+
96
+ with httpx.Client(headers=HEADERS, timeout=30.0) as client:
97
+ response = client.get(url, params=params)
98
+ response.raise_for_status()
99
+ return response.json().get("results", [])
@@ -52,7 +52,7 @@ def init_console(clear_screen: bool = True):
52
52
  │ ▒█▀▀▀ █░░ █▀▀█ █▀▀ █░█ │
53
53
  │ ▒█▀▀▀ █░░ █░░█ █░░ █▀▄ │
54
54
  │ ▒█░░░ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀░▀ │
55
- ╰━━━━━━━━v{__version__}━━━━━━━━╯
55
+ ╰━━━━━━━━v{__version__}━━━━━━━╯
56
56
  🦆 🐤 🐧 🐓
57
57
  """,
58
58
  justify="center",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flock-core
3
- Version: 0.4.0b9
3
+ Version: 0.4.0b11
4
4
  Summary: Declarative LLM Orchestration at Scale
5
5
  Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
6
6
  License-File: LICENSE
@@ -17,13 +17,13 @@ flock/cli/settings.py,sha256=Z_TXBzCYlCmSaKrJ_CQCdYy-Cj29gpI4kbC_2KzoKqg,27025
17
17
  flock/cli/view_results.py,sha256=dOzK0O1FHSIDERnx48y-2Xke9BkOHS7pcOhs64AyIg0,781
18
18
  flock/cli/yaml_editor.py,sha256=K3N0bh61G1TSDAZDnurqW9e_-hO6CtSQKXQqlDhCjVo,12527
19
19
  flock/cli/assets/release_notes.md,sha256=bqnk50jxM3w5uY44Dc7MkdT8XmRREFxrVBAG9XCOSSU,4896
20
- flock/core/__init__.py,sha256=R64A7zi51Uz6jzzCFWGol9SZQnMFz3ynEse5ivhSkEA,805
20
+ flock/core/__init__.py,sha256=p7lmQULRu9ejIAELfanZiyMhW0CougIPvyFHW2nqBFQ,847
21
21
  flock/core/flock.py,sha256=zQUpITLx_CMhJRnft4AWQDfYj85FhUlT-Ank5c-fSko,25146
22
- flock/core/flock_agent.py,sha256=L5sZ6weY4pNFbk8CEUrRD1506ojq_tx1jjQy02qEdC8,29126
22
+ flock/core/flock_agent.py,sha256=uFVr8eVWZ4uowH659fdOvVuBD4fx695Zm9UB9pOQKDU,32223
23
23
  flock/core/flock_evaluator.py,sha256=dOXZeDOGZcAmJ9ahqq_2bdGUU1VOXY4skmwTVpAjiVw,1685
24
24
  flock/core/flock_factory.py,sha256=MGTkJCP1WGpV614f87r1vwe0tqAvBCoH9PlqtqDyJDk,2828
25
25
  flock/core/flock_module.py,sha256=96aFVYAgwpKN53xGbivQDUpikOYGFCxK5mqhclOcxY0,3003
26
- flock/core/flock_registry.py,sha256=ax2pIxv6hVqRw3eJCPQ9jAul_ocYWfl9BZttmu054d0,20830
26
+ flock/core/flock_registry.py,sha256=ekYpQgSkZVnbyPbl8gA7nf54brt94rYZZBe2RwEGtUc,20828
27
27
  flock/core/flock_router.py,sha256=A5GaxcGvtiFlRLHBTW7okh5RDm3BdKam2uXvRHRaj7k,2187
28
28
  flock/core/api/__init__.py,sha256=OKlhzDWZJfA6ddBwxQUmATY0TSzESsH032u00iVGvdA,228
29
29
  flock/core/api/endpoints.py,sha256=qQnJmtcYGkjdKtLllVpyJVjc-iZrvu5EEeVIryyt4tc,12987
@@ -68,9 +68,9 @@ flock/core/tools/azure_tools.py,sha256=hwLnI2gsEq6QzUoWj5eCGDKTdXY1XUf6K-H5Uwva2
68
68
  flock/core/tools/basic_tools.py,sha256=Ye7nlI4RRkqWRy8nH9CKuItBmh_ZXxUpouGnCOfx0s0,9050
69
69
  flock/core/tools/llm_tools.py,sha256=Bdt4Dpur5dGpxd2KFEQyxjfZazvW1HCDKY6ydMj6UgQ,21811
70
70
  flock/core/tools/markdown_tools.py,sha256=W6fGM48yGHbifVlaOk1jOtVcybfRbRmf20VbDOZv8S4,6031
71
- flock/core/tools/zendesk_tools.py,sha256=0JRD48Uu27Hrb3aqVSvIieZ1kK6R-WUr2UzCgo9jDhk,2314
71
+ flock/core/tools/zendesk_tools.py,sha256=deZAyUi9j-_yZaTayLQVJaFXIqIct-P6C8IGN5UU_tM,3528
72
72
  flock/core/tools/dev_tools/github.py,sha256=a2OTPXS7kWOVA4zrZHynQDcsmEi4Pac5MfSjQOLePzA,5308
73
- flock/core/util/cli_helper.py,sha256=mbxFhAGDES1AySbz5D672Az-EWk88FIvtFIGJMEp6fc,49800
73
+ flock/core/util/cli_helper.py,sha256=P3-lncS1J78MuPpDQ0D8qmfxMTCRxKkGdo9QRkzrp6A,49797
74
74
  flock/core/util/file_path_utils.py,sha256=Odf7uU32C-x1KNighbNERSiMtkzW4h8laABIoFK7A5M,6246
75
75
  flock/core/util/hydrator.py,sha256=6qNwOwCZB7r6y25BZ--0PGofrAlfMaXbDKFQeP5NLts,11196
76
76
  flock/core/util/input_resolver.py,sha256=g9vDPdY4OH-G7qjas5ksGEHueokHGFPMoLOvC-ngeLo,5984
@@ -439,8 +439,8 @@ flock/workflow/activities.py,sha256=eVZDnxGJl_quNO-UTV3YgvTV8LrRaHN3QDAA1ANKzac,
439
439
  flock/workflow/agent_activities.py,sha256=NhBZscflEf2IMfSRa_pBM_TRP7uVEF_O0ROvWZ33eDc,963
440
440
  flock/workflow/temporal_setup.py,sha256=VWBgmBgfTBjwM5ruS_dVpA5AVxx6EZ7oFPGw4j3m0l0,1091
441
441
  flock/workflow/workflow.py,sha256=I9MryXW_bqYVTHx-nl2epbTqeRy27CAWHHA7ZZA0nAk,1696
442
- flock_core-0.4.0b9.dist-info/METADATA,sha256=wwCWOuSp3Aq37T7bTTGNCrkzT7IJsvynCz-7a0rFKM8,21100
443
- flock_core-0.4.0b9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
444
- flock_core-0.4.0b9.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
445
- flock_core-0.4.0b9.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
446
- flock_core-0.4.0b9.dist-info/RECORD,,
442
+ flock_core-0.4.0b11.dist-info/METADATA,sha256=SBfnjjaedd-MZ5XRQCxC0Mgmm0k1uhVRWjZGGE-UDnY,21101
443
+ flock_core-0.4.0b11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
444
+ flock_core-0.4.0b11.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
445
+ flock_core-0.4.0b11.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
446
+ flock_core-0.4.0b11.dist-info/RECORD,,