Skip to content

Commit 6e69e11

Browse files
KazooTTTekzhu
andauthored
Fix/typo (microsoft#1034)
* fix: typo * fix: typo * fix: typo of function name * fix: typo of function name of test file * Update test_token_count.py --------- Co-authored-by: Eric Zhu <[email protected]>
1 parent 34e055c commit 6e69e11

36 files changed

+70
-70
lines changed

autogen/agentchat/assistant_agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(
7070
**kwargs,
7171
)
7272

73-
# Update the provided desciption if None, and we are using the default system_message,
73+
# Update the provided description if None, and we are using the default system_message,
7474
# then use the default description.
7575
if description is None:
7676
if system_message == self.DEFAULT_SYSTEM_MESSAGE:

autogen/agentchat/contrib/compressible_agent.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _manage_history_on_token_limit(self, messages, token_used, max_token_allowed
225225
# 1. mode = "TERMINATE", terminate the agent if no token left.
226226
if self.compress_config["mode"] == "TERMINATE":
227227
if max_token_allowed - token_used <= 0:
228-
# Teminate if no token left.
228+
# Terminate if no token left.
229229
print(
230230
colored(
231231
f'Warning: Terminate Agent "{self.name}" due to no token left for oai reply. max token for {model}: {max_token_allowed}, existing token count: {token_used}',
@@ -320,7 +320,7 @@ def on_oai_token_limit(
320320
cmsg["role"] = "user"
321321
sender._oai_messages[self][i] = cmsg
322322

323-
# sucessfully compressed, return False, None for generate_oai_reply to be called with the updated messages
323+
# successfully compressed, return False, None for generate_oai_reply to be called with the updated messages
324324
return False, None
325325
return final, None
326326

@@ -332,7 +332,7 @@ def compress_messages(
332332
"""Compress a list of messages into one message.
333333
334334
The first message (the initial prompt) will not be compressed.
335-
The rest of the messages will be compressed into one message, the model is asked to distinuish the role of each message: USER, ASSISTANT, FUNCTION_CALL, FUNCTION_RETURN.
335+
The rest of the messages will be compressed into one message, the model is asked to distinguish the role of each message: USER, ASSISTANT, FUNCTION_CALL, FUNCTION_RETURN.
336336
Check out the compress_sys_msg.
337337
338338
TODO: model used in compression agent is different from assistant agent: For example, if original model used by is gpt-4; we start compressing at 70% of usage, 70% of 8092 = 5664; and we use gpt 3.5 here max_toke = 4096, it will raise error. choosinng model automatically?

autogen/agentchat/contrib/gpt_assistant_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _get_run_response(self, thread, run):
203203
new_messages.append(
204204
{
205205
"role": msg.role,
206-
"content": f"Recieved file id={content.image_file.file_id}",
206+
"content": f"Received file id={content.image_file.file_id}",
207207
}
208208
)
209209
return new_messages
@@ -219,7 +219,7 @@ def _get_run_response(self, thread, run):
219219
}
220220

221221
logger.info(
222-
"Intermediate executing(%s, Sucess: %s) : %s",
222+
"Intermediate executing(%s, Success: %s) : %s",
223223
tool_response["name"],
224224
is_exec_success,
225225
tool_response["content"],

autogen/agentchat/contrib/img_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get_image_data(image_file: str, use_b64=True) -> bytes:
2626
return content
2727

2828

29-
def llava_formater(prompt: str, order_image_tokens: bool = False) -> Tuple[str, List[str]]:
29+
def llava_formatter(prompt: str, order_image_tokens: bool = False) -> Tuple[str, List[str]]:
3030
"""
3131
Formats the input prompt by replacing image tags and returns the new prompt along with image locations.
3232

autogen/agentchat/contrib/llava_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from regex import R
1111

1212
from autogen.agentchat.agent import Agent
13-
from autogen.agentchat.contrib.img_utils import get_image_data, llava_formater
13+
from autogen.agentchat.contrib.img_utils import get_image_data, llava_formatter
1414
from autogen.agentchat.contrib.multimodal_conversable_agent import MultimodalConversableAgent
1515
from autogen.code_utils import content_str
1616

@@ -162,7 +162,7 @@ def llava_call(prompt: str, llm_config: dict) -> str:
162162
Makes a call to the LLaVA service to generate text based on a given prompt
163163
"""
164164

165-
prompt, images = llava_formater(prompt, order_image_tokens=False)
165+
prompt, images = llava_formatter(prompt, order_image_tokens=False)
166166

167167
for im in images:
168168
if len(im) == 0:

autogen/agentchat/conversable_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def generate_code_execution_reply(
676676
else:
677677
messages_to_scan += 1
678678

679-
# iterate through the last n messages reversly
679+
# iterate through the last n messages reversely
680680
# if code blocks are found, execute the code blocks and return the output
681681
# if no code blocks are found, continue
682682
for i in range(min(len(messages), messages_to_scan)):
@@ -1292,7 +1292,7 @@ def update_function_signature(self, func_sig: Union[str, Dict], is_remove: None)
12921292
12931293
Args:
12941294
func_sig (str or dict): description/name of the function to update/remove to the model. See: https://platform.openai.com/docs/api-reference/chat/create#chat/create-functions
1295-
is_remove: whether removing the funciton from llm_config with name 'func_sig'
1295+
is_remove: whether removing the function from llm_config with name 'func_sig'
12961296
"""
12971297

12981298
if not self.llm_config:

autogen/oai/client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _separate_create_config(self, config):
136136
return create_config, extra_kwargs
137137

138138
def _client(self, config, openai_config):
139-
"""Create a client with the given config to overrdie openai_config,
139+
"""Create a client with the given config to override openai_config,
140140
after removing extra kwargs.
141141
"""
142142
openai_config = {**openai_config, **{k: v for k, v in config.items() if k in self.openai_kwargs}}
@@ -244,7 +244,7 @@ def yes_or_no_filter(context, response):
244244
try:
245245
response.cost
246246
except AttributeError:
247-
# update atrribute if cost is not calculated
247+
# update attribute if cost is not calculated
248248
response.cost = self.cost(response)
249249
cache.set(key, response)
250250
self._update_usage_summary(response, use_cache=True)
@@ -349,7 +349,7 @@ def _completions_create(self, client, params):
349349
def _update_usage_summary(self, response: ChatCompletion | Completion, use_cache: bool) -> None:
350350
"""Update the usage summary.
351351
352-
Usage is calculated no mattter filter is passed or not.
352+
Usage is calculated no matter filter is passed or not.
353353
"""
354354

355355
def update_usage(usage_summary):

autogen/oai/completion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def _eval(cls, config: dict, prune=True, eval_only=False):
430430
if previous_num_completions:
431431
n_tokens_list[i] += n_output_tokens
432432
responses_list[i].extend(responses)
433-
# Assumption 1: assuming requesting n1, n2 responses separatively then combining them
433+
# Assumption 1: assuming requesting n1, n2 responses separately then combining them
434434
# is the same as requesting (n1+n2) responses together
435435
else:
436436
n_tokens_list.append(n_output_tokens)

samples/apps/autogen-assistant/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Now that you have AutoGen Assistant installed and running, you are ready to expl
7777
7878
This demo focuses on the research assistant use case with some generalizations:
7979
80-
- **Skills**: The agent is provided with a list of skills that it can leverage while attempting to address a user's query. Each skill is a python function that may be in any file in a folder made availabe to the agents. We separate the concept of global skills available to all agents `backend/files/global_utlis_dir` and user level skills `backend/files/user/<user_hash>/utils_dir`, relevant in a multi user environment. Agents are aware skills as they are appended to the system message. A list of example skills is available in the `backend/global_utlis_dir` folder. Modify the file or create a new file with a function in the same directory to create new global skills.
80+
- **Skills**: The agent is provided with a list of skills that it can leverage while attempting to address a user's query. Each skill is a python function that may be in any file in a folder made available to the agents. We separate the concept of global skills available to all agents `backend/files/global_utlis_dir` and user level skills `backend/files/user/<user_hash>/utils_dir`, relevant in a multi user environment. Agents are aware skills as they are appended to the system message. A list of example skills is available in the `backend/global_utlis_dir` folder. Modify the file or create a new file with a function in the same directory to create new global skills.
8181

8282
- **Conversation Persistence**: Conversation history is persisted in an sqlite database `database.sqlite`.
8383

samples/apps/autogen-assistant/autogenra/utils/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def get_all_skills(user_skills_path: str, global_skills_path: str, dest_dir: str
250250
}
251251

252252
if dest_dir:
253-
# chcek if dest_dir exists
253+
# check if dest_dir exists
254254
if not os.path.exists(dest_dir):
255255
os.makedirs(dest_dir)
256256
# copy all skills to dest_dir

samples/apps/autogen-assistant/frontend/src/components/header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const Header = ({ meta, link }: any) => {
9494
return (
9595
<div
9696
key={index + "linkrow"}
97-
className={`text-primary items-center hover:text-accent hovder:bg-secondary px-1 pt-1 block text-sm font-medium `}
97+
className={`text-primary items-center hover:text-accent hover:bg-secondary px-1 pt-1 block text-sm font-medium `}
9898
>
9999
<Link
100100
className="hover:text-accent h-full flex flex-col"

samples/apps/autogen-assistant/frontend/src/components/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const ColorTween = (
169169
endColor: string,
170170
percent: number
171171
) => {
172-
// exaple startColor = "#ff0000" endColor = "#0000ff" percent = 0.5
172+
// example startColor = "#ff0000" endColor = "#0000ff" percent = 0.5
173173
const start = {
174174
r: parseInt(startColor.substring(1, 3), 16),
175175
g: parseInt(startColor.substring(3, 5), 16),

samples/apps/autogen-assistant/frontend/src/components/views/gallery/gallery.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const GalleryView = ({ location }: any) => {
129129
</div>
130130
<div className="text-xs">
131131
{" "}
132-
{item.messages.length} messsage{item.messages.length > 1 && "s"}
132+
{item.messages.length} message{item.messages.length > 1 && "s"}
133133
</div>
134134
<div className="my-2 border-t border-dashed w-full pt-2 inline-flex gap-2 ">
135135
<TagsView tags={item.tags} />{" "}

samples/tools/testbed/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This Testbed sample has been tested in, and is known to work with, Autogen versi
66

77
## Setup
88

9-
Before you begin, you must configure your API keys for use with the Testbed. As with other Autogen applications, the Testbed will look for the OpenAI keys in a file in the current working directy, or environment variable named, OAI_CONFIG_LIST. This can be overrriden using a command-line parameter described later.
9+
Before you begin, you must configure your API keys for use with the Testbed. As with other Autogen applications, the Testbed will look for the OpenAI keys in a file in the current working directory, or environment variable named, OAI_CONFIG_LIST. This can be overridden using a command-line parameter described later.
1010

1111
For some scenarios, additional keys may be required (e.g., keys for the Bing Search API). These can be added to an `ENV` file in the `includes` folder. A sample has been provided in ``includes/ENV.example``. Edit ``includes/ENV`` as needed.
1212

@@ -56,7 +56,7 @@ options:
5656

5757
## Results
5858

59-
By default, the Testbed stores results in a folder heirarchy with the following template:
59+
By default, the Testbed stores results in a folder hierarchy with the following template:
6060

6161
``./results/[scenario]/[instance_id]/[repetition]``
6262

samples/tools/testbed/run_scenarios.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def expand_scenario(scenario_dir, scenario, output_dir):
119119

120120
template = scenario["template"]
121121

122-
# Either key works for finding the substiturions list. "values" may be deprecated in the future
122+
# Either key works for finding the substitutions list. "values" may be deprecated in the future
123123
substitutions = scenario["substitutions"] if "substitutions" in scenario else scenario["values"]
124124

125125
# Older versions are only one-level deep. Convert them,
@@ -159,7 +159,7 @@ def expand_scenario(scenario_dir, scenario, output_dir):
159159
# If the destination is a directory, use the same filename
160160
shutil.copyfile(src_path, os.path.join(dest_path, os.path.basename(src_path)))
161161
else:
162-
# Otherwuse use the filename provided
162+
# Otherwise use the filename provided
163163
shutil.copyfile(src_path, dest_path)
164164

165165
# Expand templated files
@@ -184,7 +184,7 @@ def run_scenario_natively(work_dir):
184184
Run a scenario in the native environment.
185185
186186
Args:
187-
work_dir (path): the path to the working directory previously created to house this sceario instance
187+
work_dir (path): the path to the working directory previously created to house this scenario instance
188188
"""
189189

190190
# Get the current working directory
@@ -253,7 +253,7 @@ def run_scenario_in_docker(work_dir, requirements, timeout=600, docker_image=Non
253253
Run a scenario in a Docker environment.
254254
255255
Args:
256-
work_dir (path): the path to the working directory previously created to house this sceario instance
256+
work_dir (path): the path to the working directory previously created to house this scenario instance
257257
timeout (Optional, int): the number of seconds to allow a Docker container to run before timing out
258258
"""
259259

@@ -462,7 +462,7 @@ def build_default_docker_image(docker_client, image_tag):
462462
if not os.path.isfile(req_file):
463463
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), req_file)
464464

465-
# Warn aboit a common error
465+
# Warn about a common error
466466
env_file = os.path.join(GLOBAL_INCLUDES_DIR, "ENV")
467467
example_file = os.path.join(GLOBAL_INCLUDES_DIR, "ENV.example")
468468
if not os.path.isfile(env_file):

samples/tools/testbed/scenarios/AutoGPT/Templates/TwoAgents/scenario.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
testbed_utils.init()
66

77
work_dir = "coding"
8-
target_folder = "__TARGET_FOLDER__" # path to the arifact folder
8+
target_folder = "__TARGET_FOLDER__" # path to the artifact folder
99

1010
config_list = config_list_from_json("OAI_CONFIG_LIST", filter_dict={"model": ["__MODEL__"]})
1111

samples/tools/testbed/scenarios/AutoGPT/challenges/3_qa_small_csv/data.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
]
2929
},
3030
"name": "AnswerQuestionSmallCsv",
31-
"task": "Read and analyze 'file1.csv', then answer the quetion: How much was spent on utilities in total? Write the answer in file 'output.txt'."
31+
"task": "Read and analyze 'file1.csv', then answer the question: How much was spent on utilities in total? Write the answer in file 'output.txt'."
3232
}

samples/tools/testbed/scenarios/MATH/problems_to_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def problem_to_json():
4646
with open("problems.jsonl", "w") as f:
4747
for i, problem in enumerate(problems):
4848
# a = {
49-
# 'id': f'problem{i}',
49+
# 'id': problem{i}',
5050
# 'template': 'scenario.py',
5151
# 'substitutions': {
5252
# '__PROMPT__': problem,

samples/tools/testbed/utils/collate_autogpt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def collate(results_dir="results"):
9393
Test_M, x_M0, x_M1, ..., X_MN
9494
9595
96-
Where x_ij is the number of AsssitantAgent conversation turns needed to pass all the tests for problem i, in Trial/repetition j. If the agent was not able to pass the tests by the end of the conversation, the value will be -1. If data for the trial is missing, the value will be an empty string "".
96+
Where x_ij is the number of AssistantAgent conversation turns needed to pass all the tests for problem i, in Trial/repetition j. If the agent was not able to pass the tests by the end of the conversation, the value will be -1. If data for the trial is missing, the value will be an empty string "".
9797
""".strip(),
9898
formatter_class=argparse.RawTextHelpFormatter,
9999
)

samples/tools/testbed/utils/collate_gaia_csv.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ def collate(results_dir):
2727
for test_id in os.listdir(results_dir):
2828
test_path = os.path.join(results_dir, test_id)
2929

30-
# Collect the reslts vector
30+
# Collect the results vector
3131
results = [test_id]
3232

3333
instance = 0
3434
instance_dir = os.path.join(test_path, str(instance))
3535
while os.path.isdir(instance_dir):
3636
expected_answer_file = os.path.join(instance_dir, "expected_answer.txt")
3737
if not os.path.isfile(expected_answer_file):
38-
# Expected ansewr is missing
38+
# Expected answer is missing
3939
results.append("")
4040

4141
instance += 1

samples/tools/testbed/utils/collate_gaia_jsonl.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def normalize_answer(a):
1515

1616
def collate(results_dir, instance=0):
1717
"""
18-
Collate the results of running GAIA. Print the results in the format acceped by the leaderboard.
18+
Collate the results of running GAIA. Print the results in the format accepted by the leaderboard.
1919
2020
Args:
21-
results_dir (path): The folder were results were be saved.
21+
results_dir (path): The folder where results were be saved.
2222
"""
2323

2424
for test_id in os.listdir(results_dir):
@@ -61,7 +61,7 @@ def collate(results_dir, instance=0):
6161
description=f"""
6262
{script_name} will collate the results of the GAIA scenarios into the jsonl format that can be submit to the GAIA leaderboard.
6363
64-
NOTE: You will likely need to concatenate resuls for level 1, level 2 and level 3 to form a complete submission.
64+
NOTE: You will likely need to concatenate results for level 1, level 2 and level 3 to form a complete submission.
6565
""".strip(),
6666
formatter_class=argparse.RawTextHelpFormatter,
6767
)

samples/tools/testbed/utils/collate_human_eval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def collate(results_dir):
8383
HumanEval_M, x_M0, x_M1, ..., X_MN
8484
8585
86-
Where x_ij is the number of AsssitantAgent conversation turns needed to pass all the tests for problem i, in Trial/repetition j. If the agent was not able to pass the tests by the end of the conversation, the value will be -1. If data for the trial is missing, the value will be an empty string "".
86+
Where x_ij is the number of AssistantAgent conversation turns needed to pass all the tests for problem i, in Trial/repetition j. If the agent was not able to pass the tests by the end of the conversation, the value will be -1. If data for the trial is missing, the value will be an empty string "".
8787
""".strip(),
8888
formatter_class=argparse.RawTextHelpFormatter,
8989
)

test/agentchat/contrib/test_compressible_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def constrain_num_messages(messages):
138138
sys.platform in ["darwin", "win32"] or not OPENAI_INSTALLED,
139139
reason="do not run on MacOS or windows or dependency is not installed",
140140
)
141-
def test_compress_messsage():
141+
def test_compress_message():
142142
assistant = CompressibleAgent(
143143
name="assistant",
144144
llm_config={
@@ -202,5 +202,5 @@ def test_mode_terminate():
202202
if __name__ == "__main__":
203203
test_mode_compress()
204204
test_mode_customized()
205-
test_compress_messsage()
205+
test_compress_message()
206206
test_mode_terminate()

test/agentchat/contrib/test_gpt_assistant.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_gpt_assistant_chat():
4242
},
4343
"required": ["question"],
4444
},
45-
"description": "This is an API endpoint allowing users (analysts) to input question about GitHub in text format to retrieve the realted and structured data.",
45+
"description": "This is an API endpoint allowing users (analysts) to input question about GitHub in text format to retrieve the related and structured data.",
4646
}
4747

4848
name = "For test_gpt_assistant_chat"
@@ -202,13 +202,13 @@ def test_get_assistant_files():
202202
)
203203

204204
files = assistant.openai_client.beta.assistants.files.list(assistant_id=assistant.assistant_id)
205-
retrived_file_ids = [fild.id for fild in files]
205+
retrieved_file_ids = [fild.id for fild in files]
206206
expected_file_id = file.id
207207

208208
assistant.delete_assistant()
209209
openai_client.files.delete(file.id)
210210

211-
assert expected_file_id in retrived_file_ids
211+
assert expected_file_id in retrieved_file_ids
212212

213213

214214
@pytest.mark.skipif(

0 commit comments

Comments
 (0)