Skip to content

Commit

Permalink
Typo fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLjl committed Nov 12, 2024
1 parent c5d437f commit d1e1234
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions test/agentchat/contrib/test_agent_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ def test_step():
user_proxy.initiate_chat(assistant, message=problem)
optimizer.record_one_conversation(assistant.chat_messages_for_summary(user_proxy), is_satisfied=True)

register_for_llm, register_for_exector = optimizer.step()
register_for_llm, register_for_executor = optimizer.step()

print("-------------------------------------")
print("register_for_llm:")
print(register_for_llm)
print("register_for_exector")
print(register_for_exector)
print("register_for_executor")
print(register_for_executor)

for item in register_for_llm:
assistant.update_function_signature(**item)
if len(register_for_exector.keys()) > 0:
user_proxy.register_function(function_map=register_for_exector)
if len(register_for_executor.keys()) > 0:
user_proxy.register_function(function_map=register_for_executor)

print("-------------------------------------")
print("Updated assistant.llm_config:")
Expand Down
14 changes: 7 additions & 7 deletions website/blog/2023-12-23-AgentOptimizer/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ optimizer.record_one_conversation(history, is_satisfied=result)
At each optimization iteration, it will return two fields register_for_llm and register_for_executor, which are subsequently utilized to update the assistant and UserProxy agents, respectively.

```python
register_for_llm, register_for_exector = optimizer.step()
register_for_llm, register_for_executor = optimizer.step()
for item in register_for_llm:
assistant.update_function_signature(**item)
if len(register_for_exector.keys()) > 0:
user_proxy.register_function(function_map=register_for_exector)
if len(register_for_executor.keys()) > 0:
user_proxy.register_function(function_map=register_for_executor)
```

3. `reset_optimizer`:

This method will reset the optimizer to the initial state, which is useful when you want to train the agent from scratch.

**AgentOptimizer** includes mechanisms to check the (1) validity of the function and (2) code implementation before returning the register_for_llm, register_for_exector.
**AgentOptimizer** includes mechanisms to check the (1) validity of the function and (2) code implementation before returning the register_for_llm, register_for_executor.
Moreover, it also includes mechanisms to check whether each update is feasible, such as avoiding the removal of a function that is not in the current functions due to hallucination.

## Pseudocode for the optimization process
Expand All @@ -81,11 +81,11 @@ for i in range(EPOCH):
is_correct = user_proxy.initiate_chat(assistant, message = problem)
history = assistant.chat_messages_for_summary(user_proxy)
optimizer.record_one_conversation(history, is_satisfied=is_correct)
register_for_llm, register_for_exector = optimizer.step()
register_for_llm, register_for_executor = optimizer.step()
for item in register_for_llm:
assistant.update_function_signature(**item)
if len(register_for_exector.keys()) > 0:
user_proxy.register_function(function_map=register_for_exector)
if len(register_for_executor.keys()) > 0:
user_proxy.register_function(function_map=register_for_executor)
```

Given a prepared training dataset, the agents iteratively solve problems from the training set to obtain conversation history and statistical information.
Expand Down

0 comments on commit d1e1234

Please sign in to comment.