-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add toolsets parameter for agent execution #146
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
Conversation
Add AgentToolset type and toolset parameter to agent.execute() method. This allows users to explicitly specify which tool categories to enable for agent execution requests. Available categories: core, image_analysis, image_generation, 3d_reconstruction, visualization, document, video, web, skills. Co-Authored-By: dinesh@vlm.run <dinesh@vlm.run>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
vlmrun/client/agent.py
Outdated
| metadata: Optional[RequestMetadata] = None, | ||
| callback_url: Optional[str] = None, | ||
| model: str = "vlmrun-orion-1:auto", | ||
| toolset: Optional[List[AgentToolset]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use toolsets instead of toolset
vlmrun/client/agent.py
Outdated
| data["callback_url"] = callback_url | ||
|
|
||
| if toolset is not None: | ||
| data["toolset"] = toolset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use data[toolsets]
Co-Authored-By: dinesh@vlm.run <dinesh@vlm.run>
vlmrun/client/types.py
Outdated
| AgentToolset = Literal[ | ||
| "core", | ||
| "image_analysis", | ||
| "image_generation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image-gen
vlmrun/client/types.py
Outdated
| # AgentToolset type - tool categories available for agent execution | ||
| AgentToolset = Literal[ | ||
| "core", | ||
| "image_analysis", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use image
vlmrun/client/types.py
Outdated
| "image_analysis", | ||
| "image_generation", | ||
| "3d_reconstruction", | ||
| "visualization", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viz
vlmrun/client/types.py
Outdated
| "document", | ||
| "video", | ||
| "web", | ||
| "skills", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop skills
- image_analysis -> image - image_generation -> image-gen - visualization -> viz - Remove skills category Co-Authored-By: dinesh@vlm.run <dinesh@vlm.run>
… notebooks (#94) ## Summary Adds the `toolsets` parameter to the `chat_completion` helper function in all 4 Orion cookbook notebooks, and **adds appropriate toolsets to each individual call** based on the task description. Changes across 4 notebooks: - **12_orion_image_understanding.ipynb**: 11 calls updated with toolsets (`core`, `image`, `image-gen`, `viz`, `document`) - **12_orion_video_understanding.ipynb**: 7 calls updated with toolsets (`video`, `core`, `viz`, `image-gen`) - **13_orion_3d_reconstruction.ipynb**: 3 calls updated with toolsets (`world_gen`, `image`, `video`) - **14_orion_document_understanding.ipynb**: 6 calls updated with toolsets (`document`, `core`, `viz`, `image-gen`) Each notebook's `chat_completion` helper function now accepts an optional `toolsets: list[str] | None = None` parameter that gets passed to `client.agent.completions.create()` via `extra_body`. ## Updates since last revision - Fixed `custom_key` function to accept `toolsets` parameter - the cachetools decorator passes all kwargs to the key function - Updated `custom_key` return tuple to include `toolsets_key` so different toolset combinations are cached separately - **Fixed toolsets passing mechanism**: Changed from `kwargs["toolsets"] = toolsets` to `kwargs["extra_body"] = {"toolsets": toolsets}` - the OpenAI-compatible client doesn't natively support `toolsets`, so it must be passed via `extra_body` - **Renamed toolset**: Changed `3d_reconstruction` to `world_gen` for 3D reconstruction tasks ## Review & Testing Checklist for Human - [ ] **Verify `extra_body` is read by backend** - Confirm the backend correctly extracts `toolsets` from the `extra_body` field in the OpenAI-compatible request - [ ] **Confirm `world_gen` toolset name** - Verify the backend expects `world_gen` as the toolset name for 3D reconstruction tasks - [ ] **Run at least one notebook end-to-end** - Test that the notebooks execute correctly with the toolsets parameter (both the `custom_key` and `extra_body` fixes should resolve previous TypeErrors) - [ ] **Verify toolset assignments match intended behavior** - Review that each call uses the correct toolsets for its task **Recommended test:** ```python # Test that toolsets are correctly passed via extra_body result, _ = chat_completion( prompt="Detect all the faces in the image", images=[image], response_model=DetectionsResponse, toolsets=["image"] ) ``` ### Notes This is part of a larger task to expose the toolsets parameter across docs, cookbook, and both SDKs. Related PRs: - Docs: vlm-run/docs#172 - Python SDK: vlm-run/vlmrun-python-sdk#146 - Node SDK: vlm-run/vlmrun-node-sdk#122 Link to Devin run: https://app.devin.ai/sessions/a73e91efc6644456a83528267b200be1 Requested by: dinesh@vlm.run --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: dinesh@vlm.run <dinesh@vlm.run>
Summary
Adds the
toolsetsparameter to theagent.execute()method, allowing users to explicitly specify which tool categories should be available during agent execution. This exposes the new toolset functionality added in vlm-lab#1524.Changes:
AgentToolsetLiteral type with 8 categories:core,image,image-gen,3d_reconstruction,viz,document,video,webtoolsetsparameter toagent.execute()methodUpdates since last revision
toolsettotoolsets(plural) per reviewer feedbackimage_analysis→image,image_generation→image-gen,visualization→vizskillscategory (now 8 categories instead of 9)Review & Testing Checklist for Human
vlm-lab/vlm/agents/types.py(TOOL_CATEGORIESdict keys) - especially confirm the hyphenatedimage-genformattoolsets(plural) nottoolset(singular) in the request payloadclient.agent.execute(name="...", toolsets=["image", "core"])to confirm the backend accepts the parameteragent.completions(OpenAI SDK wrapper) also needs toolsets support - currently users would need to useextra_body={"toolsets": [...]}which isn't documentedNotes
This is part of a larger task to expose the toolsets parameter across docs, cookbook, and both SDKs. Companion PRs:
Link to Devin run: https://app.devin.ai/sessions/a73e91efc6644456a83528267b200be1
Requested by: dinesh@vlm.run