Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding declarative HTTP tools to autogen ext #5181

Merged
merged 46 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
57cbb2e
initial commit for declarative-mcp-tools
EItanya Jan 24, 2025
dd00059
update without local deps
EItanya Jan 24, 2025
db763d5
Merge branch 'main' of https://github.com/microsoft/autogen into decl…
EItanya Jan 25, 2025
9c4a00b
remove MCP and add more http options
EItanya Jan 25, 2025
95fc65e
unit tests are working
EItanya Jan 25, 2025
3c1a8ce
Merge branch 'main' into declarative-mcp-tools
EItanya Jan 25, 2025
7b644e2
works again with path params stuff
EItanya Jan 25, 2025
873ac5c
add unit tests for the new path params stuff
EItanya Jan 25, 2025
dfb9b50
unit tests now fully passing with params, example works with httpbin …
EItanya Jan 25, 2025
7395c0a
update docs for args
EItanya Jan 25, 2025
98b0519
revert autogen studio
EItanya Jan 25, 2025
4644bc8
formatting
EItanya Jan 26, 2025
1773520
Merge branch 'main' into declarative-mcp-tools
EItanya Jan 27, 2025
64c08a6
Merge branch 'main' into declarative-mcp-tools
EItanya Jan 27, 2025
65b7c72
Merge branch 'main' into declarative-mcp-tools
EItanya Jan 28, 2025
4f9901e
update deps
EItanya Feb 1, 2025
b55ac3e
merge with main
EItanya Feb 1, 2025
e6b14df
add respose_type and tests
EItanya Feb 1, 2025
09f653f
run check
EItanya Feb 1, 2025
f572696
fix pyright checks
EItanya Feb 1, 2025
c6a1c38
make mypy happy
EItanya Feb 1, 2025
e6d1728
Merge branch 'main' into declarative-mcp-tools
EItanya Feb 3, 2025
2e611c1
move the graphrag tests into a subdir to not leak conftest.py
EItanya Feb 3, 2025
c35d6a2
Merge branch 'main' into declarative-mcp-tools
EItanya Feb 3, 2025
ade7e65
Merge branch 'main' into declarative-mcp-tools
victordibia Feb 4, 2025
3272eb3
Merge branch 'main' into declarative-mcp-tools
victordibia Feb 4, 2025
d6e176a
PR comments
EItanya Feb 4, 2025
ad30c83
Merge branch 'main' into declarative-mcp-tools
EItanya Feb 4, 2025
d25e119
udpate uv.lock
EItanya Feb 4, 2025
0a51544
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 4, 2025
58718a8
Merge branch 'main' of https://github.com/microsoft/autogen into decl…
EItanya Feb 6, 2025
286a628
mypy finally passing
EItanya Feb 6, 2025
cade3e6
Merge branch 'main' of https://github.com/microsoft/autogen into decl…
EItanya Feb 6, 2025
59f2139
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 7, 2025
a3a175e
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 7, 2025
220ad3e
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 8, 2025
2b48ea1
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 8, 2025
4ad329e
merge with main
EItanya Feb 9, 2025
07c526f
Merge branch 'declarative-mcp-tools' of github.com:EItanya/autogen in…
EItanya Feb 9, 2025
6ccbcf1
ignore excluded mypy error
EItanya Feb 9, 2025
405f3f6
fix import
EItanya Feb 9, 2025
7853cfb
Merge branch 'main' into declarative-mcp-tools
EItanya Feb 10, 2025
bbae288
Merge branch 'main' into declarative-mcp-tools
EItanya Feb 10, 2025
053c424
Merge branch 'main' into declarative-mcp-tools
ekzhu Feb 10, 2025
03b14f9
format
ekzhu Feb 10, 2025
0dea967
doc: update API reference and add documentation for http tool
ekzhu Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add unit tests for the new path params stuff
EItanya committed Jan 25, 2025
commit 873ac5c6bb4b8b069090c67c43c0056642bcb30a
11 changes: 11 additions & 0 deletions python/packages/autogen-ext/tests/tools/http/conftest.py
Original file line number Diff line number Diff line change
@@ -27,6 +27,17 @@ class TestResponse(BaseModel):
async def test_endpoint(body: TestArgs = Body(...)) -> TestResponse:
return TestResponse(result=f"Received: {body.query} with value {body.value}")

@app.post("/test/{query}/{value}")
async def test_path_params_endpoint(query: str, value: int) -> TestResponse:
return TestResponse(result=f"Received: {query} with value {value}")

@app.put("/test/{query}/{value}")
async def test_path_params_and_body_endpoint(
query: str,
value: int,
body: dict = Body(...)
) -> TestResponse:
return TestResponse(result=f"Received: {query} with value {value} and extra {body.get("extra")}")

@app.get("/test")
async def test_get_endpoint(query: str, value: int) -> TestResponse:
39 changes: 39 additions & 0 deletions python/packages/autogen-ext/tests/tools/http/test_http_tool.py
Original file line number Diff line number Diff line change
@@ -77,6 +77,45 @@ async def test_put_request(test_config: ComponentModel, test_server: None) -> No
assert isinstance(result, dict)
assert result["result"] == "Received: test query with value 42"

@pytest.mark.asyncio
async def test_path_params(test_config: ComponentModel, test_server: None) -> None:
# Modify config to use path parameters
config = test_config.model_copy()
config.config["path"] = "/test/{query}/{value}"
tool = HttpTool.load_component(config)

result = await tool.run_json({"query": "test query", "value": 42}, CancellationToken())

assert isinstance(result, dict)
assert result["result"] == "Received: test query with value 42"

@pytest.mark.asyncio
async def test_path_params_and_body(test_config: ComponentModel, test_server: None) -> None:
# Modify config to use path parameters and include body parameters
config = test_config.model_copy()
config.config["method"] = "PUT"
config.config["path"] = "/test/{query}/{value}"
config.config["json_schema"] = {
"type": "object",
"properties": {
"query": {"type": "string", "description": "The test query"},
"value": {"type": "integer", "description": "A test value"},
"extra": {"type": "string", "description": "Extra body parameter"}
},
"required": ["query", "value", "extra"]
}
tool = HttpTool.load_component(config)

result = await tool.run_json({
"query": "test query",
"value": 42,
"extra": "extra data"
}, CancellationToken())

assert isinstance(result, dict)
assert result["result"] == "Received: test query with value 42 and extra extra data"



@pytest.mark.asyncio
async def test_delete_request(test_config: ComponentModel, test_server: None) -> None: