aap-core 0.1.2.dev1__tar.gz → 0.1.3.dev1__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.
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aap-core
3
- Version: 0.1.2.dev1
3
+ Version: 0.1.3.dev1
4
4
  Summary: Agent design pattern core framework
5
+ Keywords: agent,ai,pattern,llm
5
6
  Author: Ly Hon Quang
6
7
  Author-email: Ly Hon Quang <lyhonquang@gmail.com>
7
8
  License: MIT
@@ -21,3 +22,4 @@ Requires-Python: >=3.10.12
21
22
  Project-URL: Repository, https://github.com/quanghona/agent_design_pattern.git
22
23
  Description-Content-Type: text/markdown
23
24
 
25
+ # AI Agent Pattern (AAP)
@@ -0,0 +1 @@
1
+ # AI Agent Pattern (AAP)
@@ -1,9 +1,10 @@
1
1
  [project]
2
2
  name = "aap_core"
3
- version = "0.1.2.dev1"
3
+ version = "0.1.3.dev1"
4
4
  description = "Agent design pattern core framework"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
7
+ keywords = ["agent", "ai", "pattern", "llm"]
7
8
  authors = [
8
9
  { name = "Ly Hon Quang", email = "lyhonquang@gmail.com" }
9
10
  ]
@@ -5,9 +5,9 @@ from typing import Callable, Generic, List, Tuple
5
5
  from pydantic import Field, PrivateAttr
6
6
 
7
7
  from .guardrail import BaseGuardRail, PassGuardRail
8
- from .prompt_enhancer import (
9
- BasePromptEnhancer,
10
- IdentityPromptEnhancer,
8
+ from .prompt_augmenter import (
9
+ BasePromptAugmenter,
10
+ IdentityPromptAugmenter,
11
11
  )
12
12
  from .types import AgentMessage, BaseChain, ChainMessage, ChainResponse
13
13
 
@@ -108,8 +108,8 @@ class TypicalLLMChain(BaseLLMChain):
108
108
  default=PassGuardRail(),
109
109
  description="validate the input message",
110
110
  )
111
- prompt_enhancer: BasePromptEnhancer = Field(
112
- default=IdentityPromptEnhancer(),
111
+ prompt_augmenter: BasePromptAugmenter = Field(
112
+ default=IdentityPromptAugmenter(),
113
113
  description="add more context to the prompt or rewrite / refine the prompt",
114
114
  )
115
115
  tools: Sequence[Callable] = Field(
@@ -128,21 +128,17 @@ class TypicalLLMChain(BaseLLMChain):
128
128
 
129
129
  def invoke(self, message: AgentMessage, **kwargs) -> AgentMessage:
130
130
  message = self.input_guardrail(message)
131
- message = self.prompt_enhancer(message)
131
+ message = self.prompt_augmenter(message)
132
132
  message = self.generate(message, **kwargs)
133
133
  message = self.output_guardrail(message)
134
134
  return message
135
135
 
136
136
 
137
- class LLMPromptEnhancer(BasePromptEnhancer):
138
- """A prompt enhancer that use an LLM chain to rewrite the prompt."""
137
+ class MetaPromptAugmenter(BasePromptAugmenter):
138
+ """A prompt augmenter that use an LLM chain to rewrite the prompt."""
139
139
 
140
140
  chain: BaseLLMChain = Field(..., description="LLM chain that rewrite the prompt")
141
141
 
142
- def __call__(self, message: AgentMessage, **kwargs) -> AgentMessage:
142
+ def augment(self, message: AgentMessage, **kwargs) -> AgentMessage:
143
143
  message = self.chain.invoke(message, **kwargs)
144
- if message.execution_result != "success":
145
- return message
146
- _, message.query = message.responses[-1]
147
- message.responses = []
148
144
  return message
@@ -334,6 +334,7 @@ class CoordinatorAgent(BaseAgent):
334
334
  # TODO: check step dependency and parallelize steps to speed up
335
335
  summary_steps_key = self.summary_steps_key.replace("context_", "")
336
336
  for i, (step_msg, step_agent, dependencies) in enumerate(steps):
337
+ # TODO: deal with the dependencies
337
338
  step_msg.context = {summary_steps_key: sub_task_result}
338
339
  self.state = f"step {i}: worker {step_agent.card.name} running"
339
340
  sub_task_result.append(step_agent.execute(step_msg, **kwargs))