These examples show how to use the OpenCAD agent's code-generation mode.
generate_mounting_bracket_code.py— requests an example-style mounting bracket script from the agent
From the repository root:
python examples/agents/generate_mounting_bracket_code.py > generated_bracket.pyBy default, the script uses the built-in deterministic generator so it runs without extra setup.
To use a LiteLLM-backed provider instead, set provider/model environment variables before running:
export OPENCAD_LLM_PROVIDER=openai
export OPENCAD_LLM_MODEL=gpt-4o-mini
python examples/agents/generate_mounting_bracket_code.py > generated_bracket.pyProvider credentials continue to come from the provider's standard environment variables.
export OPENCAD_LLM_PROVIDER=anthropic
export OPENCAD_LLM_MODEL=claude-3-5-sonnet-latest
python examples/agents/generate_mounting_bracket_code.py > generated_bracket.pyexport OPENCAD_LLM_PROVIDER=gemini
export OPENCAD_LLM_MODEL=gemini-2.0-flash
python examples/agents/generate_mounting_bracket_code.py > generated_bracket.py