Skip to content

refactor(ai): promote WithProvider/WithModel to AI chain methods#1411

Closed
Copilot wants to merge 2 commits intobowen/#915from
copilot/sub-pr-1410
Closed

refactor(ai): promote WithProvider/WithModel to AI chain methods#1411
Copilot wants to merge 2 commits intobowen/#915from
copilot/sub-pr-1410

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

WithProvider and WithModel were option funcs passed into Agent(), conflating conversation-level config with agent selection. They are now first-class chain methods on the AI interface, consistent with WithContext.

Changes

  • contracts/ai/ai.go — added WithProvider(string) AI and WithModel(string) AI to the AI interface
  • contracts/ai/option.go — removed OptionProvider constant
  • ai/application.go — added provider/model fields; implemented chain methods following the WithContext pattern
  • ai/option.go — removed WithProvider/WithModel option funcs; WithTimeout remains as a per-agent option
  • mocks/ai/AI.go — regenerated via go tool mockery

New API

conv, err := facades.AI().
    WithContext(ctx).
    WithProvider("openai").
    WithModel("gpt-4o").
    Agent(myAgent)

// Per-request timeout still via option
conv, err := facades.AI().
    WithContext(ctx).
    Agent(myAgent, ai.WithTimeout(30*time.Second))

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com>
Copilot AI changed the title [WIP] [915] Add AI module refactor(ai): promote WithProvider/WithModel to AI chain methods Mar 14, 2026
Copilot AI requested a review from hwbrzzl March 14, 2026 04:26
@hwbrzzl hwbrzzl closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants