Agently

Latest version: v3.4.0.5

Safety actively analyzes 681775 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 5

3.2.1.0

New Features:

1. `[Request]` New models are supported!

新增了两个模型的支持!

- **Claude**:

python
import Agently
agent_factory = Agently.AgentFactory()

(
agent_factory
.set_settings("current_model", "Claude")
.set_settings("model.Claude.auth", { "api_key": "" })
switch model
model list: https://docs.anthropic.com/claude/docs/models-overview
default: claude-3-sonnet-20240229
.set_settings("model.Claude.options", { "model": "claude-3-opus-20240229" })
)

Test
agent = agent_factory.create_agent()
agent.input("Print 'It works'.").start()


- **MiniMax**:

python
import Agently
agent_factory = Agently.AgentFactory()

(
agent_factory
.set_settings("current_model", "MiniMax")
.set_settings("model.MiniMax.auth", {
"group_id": "",
"api_key": ""
})
switch model
model list:https://www.minimaxi.com/document/guides/chat-model/V2?id=65e0736ab2845de20908e2dd
default: abab5.5-chat
.set_settings("model.MiniMax.options", { "model": "abab6-chat" })
)

Test
agent = agent_factory.create_agent()
agent.input("Print 'It works'.").start()


2. `[Agent Workflow]` add new feature **.draw()** to generate mermaid code to present current workflow graph!

添加了可以根据workflow连接情况生成流程图代码(mermaid格式)的方法。

python
after connect all chunks
mermaid_code = workflow.draw()

you can use mermaid-python package to draw the graph in colab
!pip install -q -U mermaid-python
from mermaid import Mermaid
Mermaid(mermaid_code)


Bug Fixed:

1. `[Framework]`: https://github.com/Maplemx/Agently/issues/49<br />Added try except when request event loop is not in debug mode to avoid error `Event loop is closed`.<br />添加了try except逻辑,来减少在非debug模式下`Event loop is closed`的报错;
2. `[Agently Workflow]`: https://github.com/Maplemx/Agently/issues/48<br />Removed unnecessary print when workflow start running.<br />移除了workflow启动时会出现的一个不必要的print。

3.2.0.1

New Feature:

1. `[Agently Workflow]`
We're glad to introduce a brand new feature of Agently v3.2 to you all: `Agently Workflow`!

With this new feature, you can arrange and manage your LLMs based application workflow in just 3 steps, simple and easy:

1. Define and program your application logic into different workflow chunks;
2. Connect chunks using `chunk.connect_to()` in orders; (Loop and condition judugment supported)
3. Start the workflow using `workflow.startup()`.

[Visit Agently Workflow Showcase Page to Explore More](https://colab.research.google.com/github/Maplemx/Agently/blob/main/playground/workflow_series_01_building_a_multi_round_chat.ipynb)

2. `[Agent Component: Decorator]: agent.tool(tool_info:dict={})`

Now you can use `agent.tool()` to decorate a function to register it as an agent's tool:

python
agent.tool()
def get_current_date():
"""Get current date"""
return datetime.now().date().strftime("%Y-%B-%d")


You can also pass other parameters to `agent.tool()` in the same way when using `agent.register_tool()`.

Update:

1. `[Framework]` Updated inherit logic of settings and add `is_debug` parameter to `.create_agent()`;
2. `[Agent Component: Role]` Change `.set_role_name()` to `.set_role_id()` and the role id will not be passed to agent request now;
3. `[Facility: RoleManager]` Change `.set_name()` to `.set_id()`;
4. `[Agent Component: Tool]` Update tool using prompt;

Bug Fix:

1. `[Agent Component: Segment]` Clean segments' prompt cache at an earlier time and add try except logic to avoid unclean runtime cause error;

----

全新功能:

1. `[Agently Workflow]`

我们非常高兴能够向您介绍Agently v3.2版本推出的全新功能:Agently Workflow!

使用这项全新的功能,只需要一二三步走,您就能够轻松惬意地编排管理您的语言模型应用工作流了:

1. 在workflow chunks切块中编写您的应用工作流中的单块工作逻辑(如输入、判断、请求执行、数据存取等);
2. 使用`chunk.connect_to()`方法将切块按您想要的工作顺序进行连接(支持环状连接、条件分支等复杂连接关系);
3. 通过`workflow.startup()`开始运行工作流。

功能案例:[点击查看案例,了解新功能的用法](https://colab.research.google.com/github/Maplemx/Agently/blob/main/playground/workflow_series_01_building_a_multi_round_chat.ipynb)

2. `[Agent Component: Decorator]: agent.tool(tool_info:dict={})`

现在,您可以使用`agent.tool()`装饰器来将一个函数注册给Agent使用了,具体用法如下:

python
agent.tool()
def get_current_date():
"""Get current date"""
return datetime.now().date().strftime("%Y-%B-%d")


您可以向`agent.tool()`传递其他参数,参数要求和`agent.register_tool()`方法保持一致。

重要更新

1. `[框架核心]` 改善了一些框架内的`settings`设置项的继承逻辑,并且支持向`.create_agent()`传递`is_debug`参数了;
2. `[Agent能力组件:Role]` 将`.set_role_name()`方法更改为`.set_role_id()`方法,使其和业务表达解耦,同时,设置的role id将不会在agent请求模型时被传递过去,只作为代码编写时的agent身份标识;
3. `[公共设施插件: RoleManager]` 与上条相同,将`.set_name()`方法更改为`.set_id()`;
5. `[Agent能力组件:Tool]` 更新了部分工具调用的提示词,优化Tool插件的工作质量;

问题修复

1. `[Agent能力组件:Segment]` 在更早的时机清除Segments的提示词设置缓存,并添加了一段错误监听逻辑,以在运行出错时能够将当前的Segments设置清除,避免干扰下一次运行(尤其是在Colab环境中)。

3.1.5.5

New Feature:

1. `[Agent Component: Session]` Added chat history manual management methods and settings:

**Methods:**

- `.add_chat_history(role: str, cotnent: str)`
- `.get_chat_history(*, is_shorten: bool=False)`
- `.rewrite_chat_history(new_chat_history: list)`

**Settings:**

- `strict_orders`:
Setting value is set as `True` by default.
If this setting is `True`, component will ensure chat history append in "User-Assistant-User-Assistant" orders and when the order is incorrect, manual management methods above will automatically help developers combining chat history content.
You can use `.toggle_strict_orders(False)` to avoid `strict_orders` mode.
- `manual_chat_history`:
Setting value is set as `False` by default.
You can use `.toggle_manual_chat_history(True)` to active `manual chat history management` mode.
If this setting is `True`, component will stop automatically fetch and append chat history from agent request's response to allow developers to add chat history manually using methods above. Turn on this setting when `.active_session()` is on will ensure manual managed chat history be passed to next agent request to enable manual managed multi-round chat.
Update:

1. `[Tool]`Improved tool using prompt and improved the adaptation when `timelimit` argument is not in `options` dict when using search tool;
3. `[Framework]` Updated agent alias info printer, now you can use `agent.alias_manager.print_alias_info(group_by="agent_component")` to print alias group by component names;
4. `[Framework]` Updated JSON find and decode methods, import json5 lib and improved error report detail in debug mode;
5. `[Request: ERNIE]` Updated default model name to "ernie-4.0" to follow Baidu official model name updating.

Bug Fix:

1. `[Framework]` Fixed event loop closed error when using tools or fixing json decode error;
2. `[Agent Component: Segment]` Fixed a bug that will cause segment main thread close too early before all async handlers finish their works;
3. `[Agent Component: Segment]` Fixed a bug that will cause segment can not overwrite prompt_output.

3.1.5

**New Feature:**
1. Support ZhipuAI GLM-4 and GLM-3-turbo [Read here to see how to set settings](https://github.com/Maplemx/Agently/blob/main/playground/create_event_listeners_with_alias_or_decorator.ipynb)
2. Agent Component: `Decorator`:
- Move `agent.auto_func` into Decorator Component
- New decorator `agent.on_event(<event_name>)` to help developers to add event listener easier [Read Example](https://github.com/Maplemx/Agently/blob/main/playground/create_event_listeners_with_alias_or_decorator.ipynb)

**Update:**
1. Update reply getter to avoid unnecessary error `queue.empty` to make developers easier to locate error
2. Update tool using logic and update search result data structure to make response with search better.

**Bug Fixed:**
1. Fixed unexpected error when using Gemini and proxy is not set when using old version of httpx

----

**新功能:**
1. 支持智谱GLM-4和GLM-3-turbo在线模型 [阅读此案例了解如何配置使用](https://github.com/Maplemx/Agently/blob/main/playground/create_event_listeners_with_alias_or_decorator.ipynb)
2. 新增Agent组件:`Decorator`函数装饰器
- 将3.1.4版本的`agent.auto_func`函数装饰器从Agent类中移动到Decorator组件里
- 新增函数装饰器`agent.on_event(<event_name>)`,帮助开发者为Agent请求回复内容添加事件监听器 [阅读此案例了解事件监听器的作用](https://github.com/Maplemx/Agently/blob/main/playground/create_event_listeners_with_alias_or_decorator.ipynb)

**功能升级:**
1. 优化了请求线程中获取最终返回值的逻辑,以避免不必要的`queue.empty`报错,让开发者更方便地定位错误
2. 升级了工具调用逻辑和搜索结果数据结构,现在使用搜索工具能够获得更好的回复结果了

**问题修复:**
1. 修复了一个在使用旧版httpx时,请求Gemini但未设置proxy会报错的问题

3.1.4

**New Feature: Summon a Genie 🧞‍♂️ (Function Decorator) to Generate Agent Powered Function in Runtime**

As a developer, have you ever dreamed about writing some definitions and annotation in code then "boom!" all in a sudden, some genies 🧞‍♂️ come out and make all your wishes happen? Notice that: **the genies do not write the code for you, instead they just _finish the work_ for you!**

Now Agently framework present a brand new feature **"agent auto function decorator"** for you in **version 3.1.4**! Use `<agent instance>.auto_func` to decorate your function and feel the magic!

Combining the tools-using abilities we enhanced the Agently agents recently in **version 3.1.2**, just open your mind and let's see how fantasy work you can let the agents help you to do.

**Demo Code:**

python
create a search agent
search_agent = (
Agently.create_agent()
.set_settings("model.OpenAI.auth", { "api_key": "" })
)

equip search agent with tool "search_definition"
search_agent.use_public_tools("search_definition")

define your function: input arguments, output data structure requirement, function purpose
then use decorator to call search agent to help
search_agent.auto_func
def find_definition(concept_keyword:str) -> {"source": ("String", ), "definition": ("String", )}:
"""Search your knowledge or the internet to find out the definition of {concept_keyword}."""
return

do not need to complete the function coding
just call it and get your result
result = find_definition("OpenAI")


**Result Example:**
python
{'source': 'Wikipedia', 'definition': "OpenAI is a U.S. artificial intelligence (AI) research organization founded in December 2015, researching artificial intelligence with the declared intention of developing 'safe and beneficial' artificial general intelligence."}


**[Visit Show Case Page to Explore What it Can Do More!](https://github.com/Maplemx/Agently/blob/main/playground/generate_agent_powered_function_in_runtime_using_decorator.ipynb)**

----

**新功能:召唤🧞‍♂️(代码装饰器)完成只给了定义和注释的函数指向的工作**

作为程序员,你是否曾经梦想着有一天,在编写代码的时候,你只需要写下一些定义和注释,然后就有某个神奇的精灵🧞‍♂️跳出来帮你把剩下的工作都完成了?注意哦,这里我们说的,并不是帮你把那些代码写完,而是**直接帮你把你定义的工作做完**哦!

现在,Agently框架在圆周率版本(3.1.4)为您推出了这样的全新功能:"agent智能函数装饰器",你只需要在写好定义和注释的空函数上方,使用`<agent instance>.auto_func`这样一个函数装饰器,就可以感受到魔法一般的效果啦!

结合Agently最近为agent添加的工具使用能力,思路打开🫴,看看我们能让agent帮助我们做哪些神奇的事情吧。

样例代码:

python
创建一个search_agent
search_agent = (
Agently.create_agent()
.set_settings("model.OpenAI.auth", { "api_key": "" })
)

给你的search_agent装备搜索工具
search_agent.use_public_tools("search_definition")

定义你的函数(输入参数、输出格式、函数的工作目标)
然后通过装饰器召唤你的search_agent来帮忙
search_agent.auto_func
def find_definition(concept_keyword:str) -> {"source": ("String", ), "definition": ("String", )}:
"""Search your knowledge or the internet to find out the definition of {concept_keyword}."""
return

直接运行就可以获得你想要的结果
result = find_definition("OpenAI")


**[点击查看相关Show Case案例页面,了解还有哪些场景可以使用](https://github.com/Maplemx/Agently/blob/main/playground/generate_agent_powered_function_in_runtime_using_decorator.ipynb)**

3.1.3

**New Feature:**

Add embedding plugin to facility

Now You can use `Agently.facility.embedding.<ProviderName>` to use, provider including OpenAI, Google, ERNIE, ZhipuAI:

python
import Agently
OpenAI
(
Agently.facility
.set_settings("embedding.OpenAI.auth", { "api_key": "" })
)
Baidu ERNIE
(
Agently.facility
.set_settings("embedding.ERNIE.auth", { "aistudio": "" })
)
ZhipuAI
(
Agently.facility
.set_settings("embedding.ZhipuAI.auth", { "api_key": "" })
)
Google
(
Agently.facility
.set_settings("embedding.Google.auth", { "api_key": "" })
)

print(
Agently.facility.embedding.OpenAI("I'm a yellow duck.")
)


**Upgrade:**

1. Add `agent.stop_tools()` to remove tools those already register to agent;
2. Add `Agently.set_settings()` to make developers easier to set global settings;
3. FileStorage plugin storage path now is a variable to make it easier for developers to edit;

**Bug Fix:**
1. When output contain strings like '[OUTPUT]' will no longer mislead JSON clean process.

---------------

**新功能:**

Facility新增Embedding插件
现在开发者可以通过Agently.facility.embedding使用,可用厂商包括OpenAI,Google,百度文心(ERNIE),智谱,用法代码样例:

python
import Agently
OpenAI
(
Agently.facility
.set_settings("embedding.OpenAI.auth", { "api_key": "" })
)
Baidu ERNIE
(
Agently.facility
.set_settings("embedding.ERNIE.auth", { "aistudio": "" })
)
ZhipuAI
(
Agently.facility
.set_settings("embedding.ZhipuAI.auth", { "api_key": "" })
)
Google
(
Agently.facility
.set_settings("embedding.Google.auth", { "api_key": "" })
)

print(
Agently.facility.embedding.OpenAI("我是一只小鸭子")
)


**升级优化:**

1. 增加agent.stop_tools()方法,让开发者可以移除已经赋予给agent的工具;
3. 增加Agently.set_settings()方法,方便开发者进行全局设置;
4. FileStorage插件已经将存储路径调整为一个变量,可以在插件内进行设置;

**Bug Fix:**
1. 修复了当输出时携带'[OUTPUT]'字符串时,会导致JSON清洗出错的问题。

Page 3 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.