Skip to content

feat(models): extend model contract for tool calling (#156)#177

Merged
leo-aa88 merged 1 commit into
mainfrom
feat/models-tool-definitions-156
Jun 10, 2026
Merged

feat(models): extend model contract for tool calling (#156)#177
leo-aa88 merged 1 commit into
mainfrom
feat/models-tool-definitions-156

Conversation

@leo-aa88

Copy link
Copy Markdown
Member

Summary

  • Extends the provider-neutral model contract in internal/models with ToolDef, ToolCall, and ToolResult types.
  • Adds Tools / ToolChoice to GenerateRequest, ToolCalls / StopReason to GenerateResponse, ToolResults to ChatMessage, and PromptTokens / CompletionTokens to GenerateMeta.
  • Documents the contract in internal/models/doc.go and docs/DESIGN_DOC.md §12.2 F.
  • Wires OpenAI usage token counts into GenerateMeta (already parsed; now surfaced).
  • Adds JSON serialization round-trip and edge-case unit tests.

Closes #156

Test plan

  • go test ./internal/models/... -race
  • go test ./... -race
  • go vet ./...
  • gofmt -l . (clean)
  • Existing GenerateRequest{Model, Messages} call sites compile unchanged
  • ToolChoice zero value resolves to "auto" via ToolChoiceOrDefault()

Made with Cursor

Add provider-neutral ToolDef, ToolCall, ToolResult types and extend
GenerateRequest/GenerateResponse/ChatMessage/GenerateMeta so the agent
loop can express tool definitions, tool-use responses, and token usage.

Closes #156

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

ReviewGate [PASS] PASS

Stats

  • Files changed: 6
  • Raw LOC changed: 378
  • LOC after §10.4 exclusions (human_loc_changed): 378
  • PR author class: human (human collaborator account) — login leo-aa88 (§10.4.2).

No deterministic warnings fired.

Suggested labels: reviewability-pass

File categories: 6 files (0 risky)

@github-actions

Copy link
Copy Markdown

Automated review

Summary

Enhancements to model contract, tool definitions, and token metrics.

Findings

  • No issues found.

@leo-aa88 leo-aa88 merged commit 9ddf8ba into main Jun 10, 2026
7 checks passed
@leo-aa88 leo-aa88 deleted the feat/models-tool-definitions-156 branch June 10, 2026 06:00
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.

[A1] Extend the model abstraction to support tool definitions and tool-call responses

1 participant