Skip to content

Commit db28718

Browse files
authored
Disable Azure tests and fix open ai tests (#3587)
* Disable Azure tests * fix calculator notebook * use gpt-4o-mini for tests * use gpt-4o * use gpt-4o * fix formatting * Fix models used in contrib tests * Fix retrieval test * WIP * Skip * Fix format * Fix formatting
1 parent 43b0d59 commit db28718

22 files changed

+52
-66
lines changed

autogen/agentchat/contrib/vectordb/pgvectordb.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
from typing import Callable, List, Optional, Union
55

66
import numpy as np
7+
8+
# try:
9+
import pgvector
10+
from pgvector.psycopg import register_vector
711
from sentence_transformers import SentenceTransformer
812

913
from .base import Document, ItemID, QueryResults, VectorDB
1014
from .utils import get_logger
1115

12-
try:
13-
import pgvector
14-
from pgvector.psycopg import register_vector
15-
except ImportError:
16-
raise ImportError("Please install pgvector: `pip install pgvector`")
16+
# except ImportError:
17+
# raise ImportError("Please install pgvector: `pip install pgvector`")
1718

1819
try:
1920
import psycopg
@@ -416,6 +417,7 @@ def query(
416417
results = []
417418
for query_text in query_texts:
418419
vector = self.embedding_function(query_text)
420+
vector_string = "[" + ",".join([f"{x:.8f}" for x in vector]) + "]"
419421

420422
if distance_type.lower() == "cosine":
421423
index_function = "<=>"
@@ -428,7 +430,7 @@ def query(
428430
query = (
429431
f"SELECT id, documents, embedding, metadatas "
430432
f"FROM {self.name} "
431-
f"{clause} embedding {index_function} '{str(vector)}' {distance_threshold} "
433+
f"{clause} embedding {index_function} '{vector_string}' {distance_threshold} "
432434
f"LIMIT {n_results}"
433435
)
434436
cursor.execute(query)

notebook/agentchat_MathChat.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
" \"OAI_CONFIG_LIST\",\n",
5858
" filter_dict={\n",
5959
" \"model\": {\n",
60-
" \"gpt-4-1106-preview\",\n",
61-
" \"gpt-3.5-turbo\",\n",
62-
" \"gpt-35-turbo\",\n",
60+
" \"gpt-4o\",\n",
6361
" }\n",
6462
" },\n",
6563
")"

notebook/agentchat_auto_feedback_from_code_execution.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"\n",
3838
"config_list = autogen.config_list_from_json(\n",
3939
" \"OAI_CONFIG_LIST\",\n",
40-
" filter_dict={\"tags\": [\"gpt-4\"]}, # comment out to get all\n",
40+
" filter_dict={\"tags\": [\"gpt-4o\"]}, # comment out to get all\n",
4141
")\n",
4242
"# When using a single openai endpoint, you can use the following:\n",
43-
"# config_list = [{\"model\": \"gpt-4\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}]"
43+
"# config_list = [{\"model\": \"gpt-4o\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}]"
4444
]
4545
},
4646
{

notebook/agentchat_cost_token_tracking.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"config_list = autogen.config_list_from_json(\n",
8080
" \"OAI_CONFIG_LIST\",\n",
8181
" filter_dict={\n",
82-
" \"model\": [\"gpt-3.5-turbo\", \"gpt-3.5-turbo-16k\"], # comment out to get all\n",
82+
" \"model\": [\"gpt-3.5-turbo\"], # comment out to get all\n",
8383
" },\n",
8484
")"
8585
]

notebook/agentchat_function_call_currency_calculator.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"\n",
6666
"config_list = autogen.config_list_from_json(\n",
6767
" \"OAI_CONFIG_LIST\",\n",
68-
" filter_dict={\"tags\": [\"3.5-tool\"]}, # comment out to get all\n",
68+
" filter_dict={\"tags\": [\"tool\"]}, # comment out to get all\n",
6969
")"
7070
]
7171
},

notebook/agentchat_groupchat_finite_state_machine.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
" \"cache_seed\": 44, # change the seed for different trials\n",
9595
" \"config_list\": autogen.config_list_from_json(\n",
9696
" \"OAI_CONFIG_LIST\",\n",
97-
" filter_dict={\"tags\": [\"gpt-4\", \"gpt-4-32k\"]}, # comment out to get all\n",
97+
" filter_dict={\"tags\": [\"gpt-4o\"]}, # comment out to get all\n",
9898
" ),\n",
9999
" \"temperature\": 0,\n",
100100
"}"

notebook/agentchat_groupchat_stateflow.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"config_list = autogen.config_list_from_json(\n",
4444
" \"OAI_CONFIG_LIST\",\n",
4545
" filter_dict={\n",
46-
" \"tags\": [\"gpt-4\", \"gpt-4-32k\"],\n",
46+
" \"tags\": [\"gpt-4o\"],\n",
4747
" },\n",
4848
")"
4949
]

test/agentchat/contrib/agent_eval/test_agent_eval.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,15 @@ def remove_ground_truth(test_case: str):
3232
filter_dict={
3333
"api_type": ["openai"],
3434
"model": [
35-
"gpt-4-turbo",
36-
"gpt-4-turbo-preview",
37-
"gpt-4-0125-preview",
38-
"gpt-4-1106-preview",
35+
"gpt-4o-mini",
3936
"gpt-3.5-turbo",
40-
"gpt-3.5-turbo-0125",
41-
"gpt-3.5-turbo-1106",
4237
],
4338
},
4439
)
4540

4641
aoai_config_list = autogen.config_list_from_json(
4742
OAI_CONFIG_LIST,
4843
file_location=KEY_LOC,
49-
filter_dict={"api_type": ["azure"]},
5044
)
5145

5246
success_str = open("test/test_files/agenteval-in-out/samples/sample_math_response_successful.txt", "r").read()

test/agentchat/contrib/capabilities/chat_with_teachable_agent.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
1212

1313
# Specify the model to use. GPT-3.5 is less reliable than GPT-4 at learning from user input.
14-
filter_dict = {"model": ["gpt-4-0125-preview"]}
14+
filter_dict = {"model": ["gpt-4o-mini"]}
15+
# filter_dict = {"model": ["gpt-4-0125-preview"]}
1516
# filter_dict = {"model": ["gpt-3.5-turbo-1106"]}
1617
# filter_dict = {"model": ["gpt-4-0613"]}
1718
# filter_dict = {"model": ["gpt-3.5-turbo"]}

test/agentchat/contrib/capabilities/test_image_generation_capability.py

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
2727
from conftest import MOCK_OPEN_AI_API_KEY, skip_openai # noqa: E402
2828

29-
filter_dict = {"model": ["gpt-35-turbo-16k", "gpt-3.5-turbo-16k"]}
30-
3129
RESOLUTIONS = ["256x256", "512x512", "1024x1024"]
3230
QUALITIES = ["standard", "hd"]
3331
PROMPTS = [

test/agentchat/contrib/capabilities/test_teachable_agent.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
# filter_dict={"model": ["gpt-3.5-turbo-1106"]}
2929
# filter_dict={"model": ["gpt-3.5-turbo-0613"]}
3030
# filter_dict={"model": ["gpt-4"]}
31-
filter_dict = {"tags": ["gpt-35-turbo-16k", "gpt-3.5-turbo-16k"]}
31+
# filter_dict = {"tags": ["gpt-35-turbo-16k", "gpt-3.5-turbo-16k"]}
32+
filter_dict = {"model": ["gpt-4o-mini"]}
3233

3334

3435
def create_teachable_agent(reset_db=False, verbosity=0):

test/agentchat/contrib/retrievechat/test_pgvector_retrievechat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_retrievechat():
7878
},
7979
"embedding_function": sentence_transformer_ef,
8080
"get_or_create": True, # set to False if you don't want to reuse an existing collection
81-
"overwrite": False, # set to True if you want to overwrite an existing collection
81+
"overwrite": True, # set to True if you want to overwrite an existing collection
8282
},
8383
code_execution_config=False, # set to False if you don't want to execute the code
8484
)

test/agentchat/contrib/retrievechat/test_qdrant_retrievechat.py

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def test_retrievechat():
6969
"client": client,
7070
"docs_path": "./website/docs",
7171
"chunk_token_size": 2000,
72+
"get_or_create": True,
73+
"overwrite": True,
7274
},
7375
)
7476

test/agentchat/contrib/retrievechat/test_retrievechat.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,19 @@ def test_retrievechat():
5454
)
5555

5656
sentence_transformer_ef = ef.SentenceTransformerEmbeddingFunction()
57+
docs_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../website/docs"))
5758
ragproxyagent = RetrieveUserProxyAgent(
5859
name="ragproxyagent",
5960
human_input_mode="NEVER",
6061
max_consecutive_auto_reply=2,
6162
retrieve_config={
62-
"docs_path": "./website/docs",
63+
"docs_path": docs_path,
6364
"chunk_token_size": 2000,
6465
"model": config_list[0]["model"],
6566
"client": chromadb.PersistentClient(path="/tmp/chromadb"),
6667
"embedding_function": sentence_transformer_ef,
6768
"get_or_create": True,
69+
"overwrite": True,
6870
},
6971
)
7072

test/agentchat/contrib/test_agent_optimizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_step():
8989
max_consecutive_auto_reply=3,
9090
)
9191

92-
optimizer = AgentOptimizer(max_actions_per_step=3, llm_config=llm_config)
92+
optimizer = AgentOptimizer(max_actions_per_step=3, llm_config=llm_config, optimizer_model="gpt-4o-mini")
9393
user_proxy.initiate_chat(assistant, message=problem)
9494
optimizer.record_one_conversation(assistant.chat_messages_for_summary(user_proxy), is_satisfied=True)
9595

test/agentchat/contrib/test_gpt_assistant.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@
4040
],
4141
},
4242
)
43-
aoai_config_list = autogen.config_list_from_json(
44-
OAI_CONFIG_LIST,
45-
file_location=KEY_LOC,
46-
filter_dict={"api_type": ["azure"], "tags": ["assistant"]},
47-
)
43+
# TODO: fix azure settings or remove it.
44+
# aoai_config_list = autogen.config_list_from_json(
45+
# OAI_CONFIG_LIST,
46+
# file_location=KEY_LOC,
47+
# filter_dict={"api_type": ["azure"], "tags": ["assistant"]},
48+
# )
4849

4950

5051
@pytest.mark.skipif(
@@ -53,17 +54,17 @@
5354
)
5455
def test_config_list() -> None:
5556
assert len(openai_config_list) > 0
56-
assert len(aoai_config_list) > 0
57+
# TODO: fix azure settings or remove it.
58+
# assert len(aoai_config_list) > 0
5759

5860

5961
@pytest.mark.skipif(
6062
skip_openai,
6163
reason=reason,
6264
)
6365
def test_gpt_assistant_chat() -> None:
64-
for gpt_config in [openai_config_list, aoai_config_list]:
65-
_test_gpt_assistant_chat({"config_list": gpt_config})
66-
_test_gpt_assistant_chat(gpt_config[0])
66+
_test_gpt_assistant_chat({"config_list": openai_config_list})
67+
_test_gpt_assistant_chat(openai_config_list[0])
6768

6869

6970
def _test_gpt_assistant_chat(gpt_config) -> None:
@@ -135,8 +136,8 @@ def ask_ossinsight(question: str) -> str:
135136
reason=reason,
136137
)
137138
def test_get_assistant_instructions() -> None:
138-
for gpt_config in [openai_config_list, aoai_config_list]:
139-
_test_get_assistant_instructions(gpt_config)
139+
_test_get_assistant_instructions(openai_config_list)
140+
# _test_get_assistant_instructions(aoai_config_list)
140141

141142

142143
def _test_get_assistant_instructions(gpt_config) -> None:
@@ -164,8 +165,8 @@ def _test_get_assistant_instructions(gpt_config) -> None:
164165
reason=reason,
165166
)
166167
def test_gpt_assistant_instructions_overwrite() -> None:
167-
for gpt_config in [openai_config_list, aoai_config_list]:
168-
_test_gpt_assistant_instructions_overwrite(gpt_config)
168+
_test_gpt_assistant_instructions_overwrite(openai_config_list)
169+
# _test_gpt_assistant_instructions_overwrite(aoai_config_list)
169170

170171

171172
def _test_gpt_assistant_instructions_overwrite(gpt_config) -> None:

test/agentchat/contrib/test_web_surfer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_web_surfer_oai() -> None:
9797
llm_config = {"config_list": config_list, "timeout": 180, "cache_seed": 42}
9898

9999
# adding Azure name variations to the model list
100-
model = ["gpt-3.5-turbo-1106", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo-16k"]
100+
model = ["gpt-4o-mini"]
101101
model += [m.replace(".", "") for m in model]
102102

103103
summarizer_llm_config = {

test/agentchat/test_tool_calls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_update_tool():
144144
config_list_gpt4 = autogen.config_list_from_json(
145145
OAI_CONFIG_LIST,
146146
filter_dict={
147-
"tags": ["gpt-4"],
147+
"tags": ["gpt-4o-mini"],
148148
},
149149
file_location=KEY_LOC,
150150
)

test/io/test_websockets.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,8 @@ def on_connect(iostream: IOWebsockets, success_dict: Dict[str, bool] = success_d
9797
OAI_CONFIG_LIST,
9898
filter_dict={
9999
"model": [
100+
"gpt-4o-mini",
100101
"gpt-3.5-turbo",
101-
"gpt-3.5-turbo-16k",
102-
"gpt-4",
103-
"gpt-4-0314",
104-
"gpt4",
105-
"gpt-4-32k",
106-
"gpt-4-32k-0314",
107-
"gpt-4-32k-v0314",
108102
],
109103
},
110104
file_location=KEY_LOC,

test/oai/_test_completion.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,8 @@ def test_nocontext():
143143
file_location=KEY_LOC,
144144
filter_dict={
145145
"model": {
146+
"gpt-4o-mini",
146147
"gpt-3.5-turbo",
147-
"gpt-3.5-turbo-16k",
148-
"gpt-3.5-turbo-16k-0613",
149-
"gpt-3.5-turbo-0301",
150-
"chatgpt-35-turbo-0301",
151-
"gpt-35-turbo-v0301",
152-
"gpt",
153148
},
154149
},
155150
),
@@ -179,13 +174,8 @@ def test_humaneval(num_samples=1):
179174
env_or_file=OAI_CONFIG_LIST,
180175
filter_dict={
181176
"model": {
177+
"gpt-4o-mini",
182178
"gpt-3.5-turbo",
183-
"gpt-3.5-turbo-16k",
184-
"gpt-3.5-turbo-16k-0613",
185-
"gpt-3.5-turbo-0301",
186-
"chatgpt-35-turbo-0301",
187-
"gpt-35-turbo-v0301",
188-
"gpt",
189179
},
190180
},
191181
file_location=KEY_LOC,

test/oai/test_client.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def get_usage(response):
6666
return {}
6767

6868

69-
@pytest.mark.skipif(skip, reason="openai>=1 not installed")
69+
# @pytest.mark.skipif(skip, reason="openai>=1 not installed")
70+
@pytest.mark.skip(reason="This test is not working until Azure settings are updated")
7071
def test_aoai_chat_completion():
7172
config_list = config_list_from_json(
7273
env_or_file=OAI_CONFIG_LIST,
@@ -88,7 +89,8 @@ def test_aoai_chat_completion():
8889
print(client.extract_text_or_completion_object(response))
8990

9091

91-
@pytest.mark.skipif(skip or not TOOL_ENABLED, reason="openai>=1.1.0 not installed")
92+
# @pytest.mark.skipif(skip or not TOOL_ENABLED, reason="openai>=1.1.0 not installed")
93+
@pytest.mark.skip(reason="This test is not working until Azure settings are updated")
9294
def test_oai_tool_calling_extraction():
9395
config_list = config_list_from_json(
9496
env_or_file=OAI_CONFIG_LIST,

test/oai/test_client_stream.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434

3535
@pytest.mark.skipif(skip, reason="openai>=1 not installed")
36+
@pytest.mark.skip(reason="This test is not working until Azure settings are updated.")
3637
def test_aoai_chat_completion_stream() -> None:
3738
config_list = config_list_from_json(
3839
env_or_file=OAI_CONFIG_LIST,
@@ -236,7 +237,7 @@ def test_chat_tools_stream() -> None:
236237
config_list = config_list_from_json(
237238
env_or_file=OAI_CONFIG_LIST,
238239
file_location=KEY_LOC,
239-
filter_dict={"tags": ["multitool"]},
240+
filter_dict={"tags": ["tool"]},
240241
)
241242
tools = [
242243
{

0 commit comments

Comments
 (0)