A naive polygon segment selector using OpenAI Agents SDK function calling for prompt-based segment selection. The repository explores possibilities for an AI-assisted geometric task.
Selected Segments by Agent
This repository uses the image named python:3.12
for running devcontainer.
-
Ensure you have Docker and Visual Studio Code with the Remote - Containers extension installed.
-
Clone the repository.
git clone https://github.com/PARKCHEOLHEE-lab/segment-selector.git
-
Open the project with VSCode.
-
When prompted at the bottom left on the VSCode, click
Reopen in Container
or use the command palette (F1) and selectRemote-Containers: Reopen in Container
. -
VS Code will build the Docker container and set up the environment.
-
Once the container is built and running, you're ready to start working with the project.
selector.py
: Implementation of the segment selector agentplotter.py
: Visualizer for selected segmentstestsets.py
: Test cases with polygon boundaries and selection promptsmain.py
: Entry point for running the segment selector
Testcase*.png
: Visualization results of different test cases
test_selection.py
: Unit tests about whether the agent's decisions are intended results
-
Set up OpenAI API key:
export OPENAI_API_KEY=your_api_key
-
Run the main script:
python segment_selector/src/main.py
-
Adding New Tools:
- Use
@function_tool
decorator to add new tools for the agent - Define static methods in
SegmentSelector
class to automatically register tools
- Use
-
Configuration:
- Adjust hyperparameters in the
SegmentSelectorConfiguration
class - Modify
MODEL_SETTINGS
in theSegmentSelectorConfiguration
for different behaviors
- Adjust hyperparameters in the