Skip to content

Commit

Permalink
Merge pull request #334 from airtai/refactoring-0.3.0
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
davorrunje authored Oct 8, 2024
2 parents 21a77b5 + 3d91d86 commit 9a3fbe5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/runtime/autogen/test_autogen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from pathlib import Path
from typing import Annotated, Any

Expand Down Expand Up @@ -202,32 +203,36 @@ def simple_workflow(
)


@pytest.mark.openai
@pytest.mark.skipif(
sys.platform == "darwin", reason="Test fails on macOS due to docker usage settings"
)
def test_register_api(openai_gpt4o_mini_llm_config: dict[str, Any]) -> None:
user_proxy = UserProxyAgent(
name="User_Proxy",
human_input_mode="ALWAYS",
llm_config=openai_gpt4o_mini_llm_config,
)
assistant = ConversableAgent(
name="Teacher_Agent",
system_message="You are a math teacher.",
llm_config=openai_gpt4o_mini_llm_config,
)
json_path = Path(__file__).parent / "api" / "openapi" / "templates" / "openapi.json"
json_path = (
Path(__file__).parents[2] / "api" / "openapi" / "templates" / "openapi.json"
)
assert json_path.exists()
openapi_json = json_path.read_text()
client = OpenAPI.create(openapi_json)

wf = AutoGenWorkflows()
function_to_register = "update_item_items__item_id__ships__ship__put"
wf.register_api(
api=client,
callers=user_proxy,
executors=assistant,
callers=assistant,
executors=user_proxy,
functions=function_to_register,
)

tools = user_proxy.llm_config["tools"]
tools = assistant.llm_config["tools"]
assert len(tools) == 1
assert tools[0]["function"]["name"] == function_to_register

Expand Down

0 comments on commit 9a3fbe5

Please sign in to comment.