Skip to content

Commit

Permalink
bump agent strategy version to 0.0.3 (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: Novice Lee <novicelee@NoviPro.local>
  • Loading branch information
Nov1c444 and Novice Lee authored Jan 9, 2025
1 parent 1e24f2b commit b1930bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions agent-strategies/cot_agent/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: 0.0.2
version: 0.0.3
type: plugin
author: "langgenius"
name: "agent"
label:
en_US: "Agent"
en_US: "Dify Agent Strategies"
zh_Hans: "Dify Agent 策略"
created_at: "2024-07-12T08:03:44.658609186Z"
icon: icon.svg
description:
Expand Down
8 changes: 6 additions & 2 deletions agent-strategies/cot_agent/output_parser/cot_output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ def parse_action(json_str):
except:
return json_str or ""

def extra_json_from_code_block(code_block) -> Generator[Union[str, AgentScratchpadUnit.Action], None, None]:
def extra_json_from_code_block(
code_block,
) -> Generator[Union[str, AgentScratchpadUnit.Action], None, None]:
code_blocks = re.findall(r"```(.*?)```", code_block, re.DOTALL)
if not code_blocks:
return
for block in code_blocks:
json_text = re.sub(r"^[a-zA-Z]+\n", "", block.strip(), flags=re.MULTILINE)
json_text = re.sub(
r"^[a-zA-Z]+\n", "", block.strip(), flags=re.MULTILINE
)
yield parse_action(json_text)

code_block_cache = ""
Expand Down
1 change: 0 additions & 1 deletion agent-strategies/cot_agent/strategies/ReAct.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ def _invoke(self, parameters: dict[str, Any]) -> Generator[AgentInvokeMessage]:
prompt_messages=prompt_messages,
stream=True,
stop=stop,
tools=prompt_messages_tools,
)

usage_dict = {}
Expand Down
7 changes: 2 additions & 5 deletions agent-strategies/cot_agent/strategies/ReAct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ parameters:
zh_Hans: 最大迭代次数
pt_BR: Maxium Iterations
default: 3
output_schema:
type: object
properties:
llm:
type: string
min: 1
max: 30
extra:
python:
source: strategies/ReAct.py
2 changes: 2 additions & 0 deletions agent-strategies/cot_agent/strategies/function_calling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ parameters:
zh_Hans: 最大迭代次数
pt_BR: Maxium Iterations
default: 3
max: 30
min: 1
extra:
python:
source: strategies/function_calling.py

0 comments on commit b1930bc

Please sign in to comment.